firefly 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/HISTORY +4 -0
- data/VERSION +1 -1
- data/firefly.gemspec +4 -4
- data/lib/firefly/server.rb +29 -0
- metadata +23 -4
data/HISTORY
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
= 0.4.2 / 2010-06-06
|
2
|
+
|
3
|
+
* 2010-06-06 - Added a fix for MySQL users to update the `code` column to use the correct collation. Fixes #9 [ariejan]
|
4
|
+
|
1
5
|
= 0.4.1 / 2010-04-30
|
2
6
|
|
3
7
|
* 2010-04-30 - Normalize URLs before shortening them. This prevents false duplicates. [ariejan]
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.2
|
data/firefly.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{firefly}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ariejan de Vroom"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-06-06}
|
13
13
|
s.description = %q{FireFly is a simple URL shortner for personal use. It's powered by Sinatra and can be run with any Rack-capable web server.}
|
14
14
|
s.email = %q{ariejan@ariejan.net}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -50,7 +50,7 @@ Gem::Specification.new do |s|
|
|
50
50
|
s.rdoc_options = ["--charset=UTF-8"]
|
51
51
|
s.require_paths = ["lib"]
|
52
52
|
s.rubyforge_project = %q{firefly}
|
53
|
-
s.rubygems_version = %q{1.3.
|
53
|
+
s.rubygems_version = %q{1.3.7}
|
54
54
|
s.summary = %q{FireFly is a simple URL shortner for personal use}
|
55
55
|
s.test_files = [
|
56
56
|
"spec/firefly/api_spec.rb",
|
@@ -64,7 +64,7 @@ Gem::Specification.new do |s|
|
|
64
64
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
65
65
|
s.specification_version = 3
|
66
66
|
|
67
|
-
if Gem::Version.new(Gem::
|
67
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
68
68
|
s.add_runtime_dependency(%q<sinatra>, [">= 1.0"])
|
69
69
|
s.add_runtime_dependency(%q<dm-core>, [">= 0.10.2"])
|
70
70
|
s.add_runtime_dependency(%q<dm-aggregates>, [">= 0.10.2"])
|
data/lib/firefly/server.rb
CHANGED
@@ -163,11 +163,40 @@ module Firefly
|
|
163
163
|
begin
|
164
164
|
DataMapper.setup(:default, @config[:database])
|
165
165
|
DataMapper.auto_upgrade!
|
166
|
+
check_mysql_collation
|
166
167
|
rescue
|
167
168
|
puts "Error setting up database connection. Please check the `database` setting in config.ru"
|
169
|
+
puts $!
|
170
|
+
puts "-------"
|
171
|
+
puts $!.backtrace
|
168
172
|
exit(1)
|
169
173
|
end
|
170
174
|
end
|
175
|
+
|
176
|
+
def check_mysql_collation(first_try = true)
|
177
|
+
# Make sure the 'code' column is case-sensitive. This hack is for
|
178
|
+
# MySQL only, other database systems don't have this problem.
|
179
|
+
if DataMapper.repository(:default).adapter =~ "DataMapper::Adapters::MysqlAdapter"
|
180
|
+
query = "SHOW FULL COLUMNS FROM firefly_urls WHERE Field='code';"
|
181
|
+
collation = DataMapper.repository(:default).adapter.select(query)[0][:collation]
|
182
|
+
|
183
|
+
if collation != "utf8_bin"
|
184
|
+
if first_try
|
185
|
+
puts " ~ Your MySQL database is not using the 'utf8-bin' collation. Trying to fix..."
|
186
|
+
DataMapper.repository(:default).adapter.execute("ALTER TABLE firefly_urls MODIFY `code` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin;")
|
187
|
+
return check_mysql_collation(false)
|
188
|
+
else
|
189
|
+
puts " ~ Failed to set the collation for `code` in `firefly_urls`. Please see http://wiki.github.com/ariejan/firefly/faq for details."
|
190
|
+
return false
|
191
|
+
end
|
192
|
+
else
|
193
|
+
if !first_try
|
194
|
+
puts " ~ Successfully fixed your database."
|
195
|
+
end
|
196
|
+
return true
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
171
200
|
end
|
172
201
|
end
|
173
202
|
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: firefly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 11
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 4
|
8
|
-
-
|
9
|
-
version: 0.4.
|
9
|
+
- 2
|
10
|
+
version: 0.4.2
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Ariejan de Vroom
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-06-06 00:00:00 +02:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: sinatra
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 15
|
27
30
|
segments:
|
28
31
|
- 1
|
29
32
|
- 0
|
@@ -34,9 +37,11 @@ dependencies:
|
|
34
37
|
name: dm-core
|
35
38
|
prerelease: false
|
36
39
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
37
41
|
requirements:
|
38
42
|
- - ">="
|
39
43
|
- !ruby/object:Gem::Version
|
44
|
+
hash: 51
|
40
45
|
segments:
|
41
46
|
- 0
|
42
47
|
- 10
|
@@ -48,9 +53,11 @@ dependencies:
|
|
48
53
|
name: dm-aggregates
|
49
54
|
prerelease: false
|
50
55
|
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
51
57
|
requirements:
|
52
58
|
- - ">="
|
53
59
|
- !ruby/object:Gem::Version
|
60
|
+
hash: 51
|
54
61
|
segments:
|
55
62
|
- 0
|
56
63
|
- 10
|
@@ -62,9 +69,11 @@ dependencies:
|
|
62
69
|
name: do_sqlite3
|
63
70
|
prerelease: false
|
64
71
|
requirement: &id004 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
65
73
|
requirements:
|
66
74
|
- - ">="
|
67
75
|
- !ruby/object:Gem::Version
|
76
|
+
hash: 25
|
68
77
|
segments:
|
69
78
|
- 0
|
70
79
|
- 10
|
@@ -77,9 +86,11 @@ dependencies:
|
|
77
86
|
name: haml
|
78
87
|
prerelease: false
|
79
88
|
requirement: &id005 !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
80
90
|
requirements:
|
81
91
|
- - ">="
|
82
92
|
- !ruby/object:Gem::Version
|
93
|
+
hash: 43
|
83
94
|
segments:
|
84
95
|
- 2
|
85
96
|
- 2
|
@@ -91,9 +102,11 @@ dependencies:
|
|
91
102
|
name: rspec
|
92
103
|
prerelease: false
|
93
104
|
requirement: &id006 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
94
106
|
requirements:
|
95
107
|
- - ">="
|
96
108
|
- !ruby/object:Gem::Version
|
109
|
+
hash: 27
|
97
110
|
segments:
|
98
111
|
- 1
|
99
112
|
- 3
|
@@ -105,9 +118,11 @@ dependencies:
|
|
105
118
|
name: rack-test
|
106
119
|
prerelease: false
|
107
120
|
requirement: &id007 !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
108
122
|
requirements:
|
109
123
|
- - ">="
|
110
124
|
- !ruby/object:Gem::Version
|
125
|
+
hash: 13
|
111
126
|
segments:
|
112
127
|
- 0
|
113
128
|
- 5
|
@@ -163,23 +178,27 @@ rdoc_options:
|
|
163
178
|
require_paths:
|
164
179
|
- lib
|
165
180
|
required_ruby_version: !ruby/object:Gem::Requirement
|
181
|
+
none: false
|
166
182
|
requirements:
|
167
183
|
- - ">="
|
168
184
|
- !ruby/object:Gem::Version
|
185
|
+
hash: 3
|
169
186
|
segments:
|
170
187
|
- 0
|
171
188
|
version: "0"
|
172
189
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
190
|
+
none: false
|
173
191
|
requirements:
|
174
192
|
- - ">="
|
175
193
|
- !ruby/object:Gem::Version
|
194
|
+
hash: 3
|
176
195
|
segments:
|
177
196
|
- 0
|
178
197
|
version: "0"
|
179
198
|
requirements: []
|
180
199
|
|
181
200
|
rubyforge_project: firefly
|
182
|
-
rubygems_version: 1.3.
|
201
|
+
rubygems_version: 1.3.7
|
183
202
|
signing_key:
|
184
203
|
specification_version: 3
|
185
204
|
summary: FireFly is a simple URL shortner for personal use
|