firefly 0.4.5 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY CHANGED
@@ -1,4 +1,8 @@
1
- = HEAD
1
+ = 1.0.0 / 2010-09-19
2
+
3
+ * 2010-09-18 - Added better support for URLs with spaces and other special characters. Closes #19
4
+
5
+ = 0.4.5 / 2010-08-10
2
6
 
3
7
  * 2010-08-10 - Added sorting of shortened URLs. Closes #12.
4
8
  * 2010-08-10 - Added CSV, XML and YAML export of all shortened URLs. Closes #11.
data/Rakefile CHANGED
@@ -12,15 +12,15 @@ begin
12
12
  gemspec.authors = ["Ariejan de Vroom"]
13
13
  gemspec.rubyforge_project = 'firefly'
14
14
  gemspec.add_dependency('sinatra', '~> 1.0')
15
- gemspec.add_dependency('dm-core', '~> 1.0.0')
16
- gemspec.add_dependency('dm-migrations', '~> 1.0.0')
17
- gemspec.add_dependency('dm-transactions', '~> 1.0.0')
18
- gemspec.add_dependency('dm-aggregates', '~> 1.0.0')
19
- gemspec.add_dependency('dm-sqlite-adapter', '~> 1.0.0')
20
- gemspec.add_dependency('haml', '~> 3.0.9')
15
+ gemspec.add_dependency('dm-core', '~> 1.0.2')
16
+ gemspec.add_dependency('dm-migrations', '~> 1.0.2')
17
+ gemspec.add_dependency('dm-transactions', '~> 1.0.2')
18
+ gemspec.add_dependency('dm-aggregates', '~> 1.0.2')
19
+ gemspec.add_dependency('dm-sqlite-adapter', '~> 1.0.2')
20
+ gemspec.add_dependency('haml', '~> 3.0.18')
21
21
 
22
22
  gemspec.add_development_dependency('rspec', '~> 1.3.0')
23
- gemspec.add_development_dependency('rack-test', '~> 0.5.3')
23
+ gemspec.add_development_dependency('rack-test', '~> 0.5.4')
24
24
  end
25
25
  Jeweler::GemcutterTasks.new
26
26
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.5
1
+ 1.0.1
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.5"
8
+ s.version = "1.0.1"
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-08-10}
12
+ s.date = %q{2010-09-19}
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 = [
@@ -70,35 +70,35 @@ Gem::Specification.new do |s|
70
70
 
71
71
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
72
72
  s.add_runtime_dependency(%q<sinatra>, ["~> 1.0"])
73
- s.add_runtime_dependency(%q<dm-core>, ["~> 1.0.0"])
74
- s.add_runtime_dependency(%q<dm-migrations>, ["~> 1.0.0"])
75
- s.add_runtime_dependency(%q<dm-transactions>, ["~> 1.0.0"])
76
- s.add_runtime_dependency(%q<dm-aggregates>, ["~> 1.0.0"])
77
- s.add_runtime_dependency(%q<dm-sqlite-adapter>, ["~> 1.0.0"])
78
- s.add_runtime_dependency(%q<haml>, ["~> 3.0.9"])
73
+ s.add_runtime_dependency(%q<dm-core>, ["~> 1.0.2"])
74
+ s.add_runtime_dependency(%q<dm-migrations>, ["~> 1.0.2"])
75
+ s.add_runtime_dependency(%q<dm-transactions>, ["~> 1.0.2"])
76
+ s.add_runtime_dependency(%q<dm-aggregates>, ["~> 1.0.2"])
77
+ s.add_runtime_dependency(%q<dm-sqlite-adapter>, ["~> 1.0.2"])
78
+ s.add_runtime_dependency(%q<haml>, ["~> 3.0.18"])
79
79
  s.add_development_dependency(%q<rspec>, ["~> 1.3.0"])
80
- s.add_development_dependency(%q<rack-test>, ["~> 0.5.3"])
80
+ s.add_development_dependency(%q<rack-test>, ["~> 0.5.4"])
81
81
  else
82
82
  s.add_dependency(%q<sinatra>, ["~> 1.0"])
83
- s.add_dependency(%q<dm-core>, ["~> 1.0.0"])
84
- s.add_dependency(%q<dm-migrations>, ["~> 1.0.0"])
85
- s.add_dependency(%q<dm-transactions>, ["~> 1.0.0"])
86
- s.add_dependency(%q<dm-aggregates>, ["~> 1.0.0"])
87
- s.add_dependency(%q<dm-sqlite-adapter>, ["~> 1.0.0"])
88
- s.add_dependency(%q<haml>, ["~> 3.0.9"])
83
+ s.add_dependency(%q<dm-core>, ["~> 1.0.2"])
84
+ s.add_dependency(%q<dm-migrations>, ["~> 1.0.2"])
85
+ s.add_dependency(%q<dm-transactions>, ["~> 1.0.2"])
86
+ s.add_dependency(%q<dm-aggregates>, ["~> 1.0.2"])
87
+ s.add_dependency(%q<dm-sqlite-adapter>, ["~> 1.0.2"])
88
+ s.add_dependency(%q<haml>, ["~> 3.0.18"])
89
89
  s.add_dependency(%q<rspec>, ["~> 1.3.0"])
90
- s.add_dependency(%q<rack-test>, ["~> 0.5.3"])
90
+ s.add_dependency(%q<rack-test>, ["~> 0.5.4"])
91
91
  end
92
92
  else
93
93
  s.add_dependency(%q<sinatra>, ["~> 1.0"])
94
- s.add_dependency(%q<dm-core>, ["~> 1.0.0"])
95
- s.add_dependency(%q<dm-migrations>, ["~> 1.0.0"])
96
- s.add_dependency(%q<dm-transactions>, ["~> 1.0.0"])
97
- s.add_dependency(%q<dm-aggregates>, ["~> 1.0.0"])
98
- s.add_dependency(%q<dm-sqlite-adapter>, ["~> 1.0.0"])
99
- s.add_dependency(%q<haml>, ["~> 3.0.9"])
94
+ s.add_dependency(%q<dm-core>, ["~> 1.0.2"])
95
+ s.add_dependency(%q<dm-migrations>, ["~> 1.0.2"])
96
+ s.add_dependency(%q<dm-transactions>, ["~> 1.0.2"])
97
+ s.add_dependency(%q<dm-aggregates>, ["~> 1.0.2"])
98
+ s.add_dependency(%q<dm-sqlite-adapter>, ["~> 1.0.2"])
99
+ s.add_dependency(%q<haml>, ["~> 3.0.18"])
100
100
  s.add_dependency(%q<rspec>, ["~> 1.3.0"])
101
- s.add_dependency(%q<rack-test>, ["~> 0.5.3"])
101
+ s.add_dependency(%q<rack-test>, ["~> 0.5.4"])
102
102
  end
103
103
  end
104
104
 
data/lib/firefly/url.rb CHANGED
@@ -29,7 +29,7 @@ module Firefly
29
29
  private
30
30
  # Normalize the URL
31
31
  def self.normalize_url(url)
32
- URI.parse(url).normalize.to_s
32
+ URI.parse(URI.escape(url)).normalize.to_s
33
33
  end
34
34
 
35
35
  # Validates the URL to be a valid http or https one.
@@ -33,6 +33,28 @@ describe "Url" do
33
33
  Firefly::Url.shorten("http://example.com")
34
34
  }.should_not change(Firefly::Url, :count)
35
35
  end
36
+
37
+ it "should shortend urls containing spaces" do
38
+ lambda {
39
+ url = Firefly::Url.shorten("http://example.com/article with spaces.html")
40
+ }.should change(Firefly::Url, :count).by(1)
41
+ end
42
+
43
+ it "should escape urls with spaces" do
44
+ url = Firefly::Url.shorten("http://example.com/article with spaces.html")
45
+ url.url.should eql("http://example.com/article%20with%20spaces.html")
46
+ end
47
+
48
+ it "should shortend urls containing weird characters" do
49
+ lambda {
50
+ url = Firefly::Url.shorten("http://example.com/?a=\11\15")
51
+ }.should change(Firefly::Url, :count).by(1)
52
+ end
53
+
54
+ it "should escape urls with weird characters" do
55
+ url = Firefly::Url.shorten("http://example.com/?a=\11\15")
56
+ url.url.should eql("http://example.com/?a=%09%0D")
57
+ end
36
58
  end
37
59
 
38
60
  describe "long url validation" do
@@ -74,4 +96,4 @@ describe "Url" do
74
96
  }.should change(@url, :clicks).by(1)
75
97
  end
76
98
  end
77
- end
99
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: firefly
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
+ - 1
7
8
  - 0
8
- - 4
9
- - 5
10
- version: 0.4.5
9
+ - 1
10
+ version: 1.0.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ariejan de Vroom
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-10 00:00:00 +02:00
18
+ date: 2010-09-19 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -41,12 +41,12 @@ dependencies:
41
41
  requirements:
42
42
  - - ~>
43
43
  - !ruby/object:Gem::Version
44
- hash: 23
44
+ hash: 19
45
45
  segments:
46
46
  - 1
47
47
  - 0
48
- - 0
49
- version: 1.0.0
48
+ - 2
49
+ version: 1.0.2
50
50
  type: :runtime
51
51
  version_requirements: *id002
52
52
  - !ruby/object:Gem::Dependency
@@ -57,12 +57,12 @@ dependencies:
57
57
  requirements:
58
58
  - - ~>
59
59
  - !ruby/object:Gem::Version
60
- hash: 23
60
+ hash: 19
61
61
  segments:
62
62
  - 1
63
63
  - 0
64
- - 0
65
- version: 1.0.0
64
+ - 2
65
+ version: 1.0.2
66
66
  type: :runtime
67
67
  version_requirements: *id003
68
68
  - !ruby/object:Gem::Dependency
@@ -73,12 +73,12 @@ dependencies:
73
73
  requirements:
74
74
  - - ~>
75
75
  - !ruby/object:Gem::Version
76
- hash: 23
76
+ hash: 19
77
77
  segments:
78
78
  - 1
79
79
  - 0
80
- - 0
81
- version: 1.0.0
80
+ - 2
81
+ version: 1.0.2
82
82
  type: :runtime
83
83
  version_requirements: *id004
84
84
  - !ruby/object:Gem::Dependency
@@ -89,12 +89,12 @@ dependencies:
89
89
  requirements:
90
90
  - - ~>
91
91
  - !ruby/object:Gem::Version
92
- hash: 23
92
+ hash: 19
93
93
  segments:
94
94
  - 1
95
95
  - 0
96
- - 0
97
- version: 1.0.0
96
+ - 2
97
+ version: 1.0.2
98
98
  type: :runtime
99
99
  version_requirements: *id005
100
100
  - !ruby/object:Gem::Dependency
@@ -105,12 +105,12 @@ dependencies:
105
105
  requirements:
106
106
  - - ~>
107
107
  - !ruby/object:Gem::Version
108
- hash: 23
108
+ hash: 19
109
109
  segments:
110
110
  - 1
111
111
  - 0
112
- - 0
113
- version: 1.0.0
112
+ - 2
113
+ version: 1.0.2
114
114
  type: :runtime
115
115
  version_requirements: *id006
116
116
  - !ruby/object:Gem::Dependency
@@ -121,12 +121,12 @@ dependencies:
121
121
  requirements:
122
122
  - - ~>
123
123
  - !ruby/object:Gem::Version
124
- hash: 21
124
+ hash: 35
125
125
  segments:
126
126
  - 3
127
127
  - 0
128
- - 9
129
- version: 3.0.9
128
+ - 18
129
+ version: 3.0.18
130
130
  type: :runtime
131
131
  version_requirements: *id007
132
132
  - !ruby/object:Gem::Dependency
@@ -153,12 +153,12 @@ dependencies:
153
153
  requirements:
154
154
  - - ~>
155
155
  - !ruby/object:Gem::Version
156
- hash: 13
156
+ hash: 3
157
157
  segments:
158
158
  - 0
159
159
  - 5
160
- - 3
161
- version: 0.5.3
160
+ - 4
161
+ version: 0.5.4
162
162
  type: :development
163
163
  version_requirements: *id009
164
164
  description: FireFly is a simple URL shortner for personal use. It's powered by Sinatra and can be run with any Rack-capable web server.