firefly 1.2.0 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY CHANGED
@@ -1,3 +1,12 @@
1
+ = 1.2.1/1.2.2 / 2011-01-26
2
+
3
+ * 2011-01-26 - Added GUI support for custom short codes. [ariejan]
4
+
5
+ = 1.2.0 / 2011-01-26
6
+
7
+ * 2010-12-30 - Support for specifying one's own preferred short codes via the API. Also, invalid URL creations return a 422 code, not 200.
8
+ * 2010-12-30 - Make Barby optional to save some gems for those of us who don't need QR code generation. [mboeh]
9
+
1
10
  = 1.1.0 / 2010-10-02
2
11
 
3
12
  * 2010-10-02 - Generate a QR Code image when accessing http://:host/:code.png
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.0
1
+ 1.2.2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{firefly}
8
- s.version = "1.2.0"
8
+ s.version = "1.2.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{2011-01-26}
12
+ s.date = %q{2011-01-28}
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 = [
@@ -18,6 +18,8 @@ module Firefly
18
18
 
19
19
  # Shorten a long_url and return a new FireFly::Url
20
20
  def self.shorten(long_url, code = nil)
21
+ code = nil if code !~ /\S/
22
+
21
23
  return nil unless valid_url?(long_url)
22
24
  return nil unless valid_code?(code)
23
25
 
@@ -21,6 +21,14 @@ describe "API" do
21
21
  last_response.body.should eql("http://test.host/#{url.code}")
22
22
  end
23
23
 
24
+ it "should generate a short code if `short` is blank" do
25
+ self.send verb, '/api/add', :url => "http://example.org", :short => "", :api_key => 'test'
26
+ url = Firefly::Url.first(:url => "http://example.org/")
27
+
28
+ last_response.should be_ok
29
+ last_response.body.should eql("http://test.host/#{url.code}")
30
+ end
31
+
24
32
  it "should permit including a requested short code" do
25
33
  self.send verb, '/api/add', :url => "http://example.org", :short => 'orz', :api_key => 'test'
26
34
 
@@ -14,7 +14,9 @@
14
14
  %form{ :action => '/api/add', :method => 'post' }
15
15
  %input{ :type => "hidden", :name => "visual", :value => "1" }
16
16
  %p
17
- %input.big_url{ :type => 'text', :name => 'url', :id => 'url', :size => 50, :autocomplete => "off", :spellcheck => 'false' }
17
+ %input.big_url{ :type => 'text', :placeholder => "Paste your long URL here...", :name => 'url', :id => 'url', :size => 40, :autocomplete => "off", :spellcheck => 'false' }
18
+ %span{ :style => "font-size: 1.8em;" }= '>'
19
+ %input.big_url{ :type => 'text', :placeholder => "Optional short code", :name => 'short', :id => 'short', :size => 20, :autocomplete => "off", :spellcheck => 'false' }
18
20
  %p
19
21
  %input.big_url{ :type => 'submit', :name => 'submit', :id => 'submit', :value => "Make it short!" }
20
22
 
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: 31
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
- - 0
10
- version: 1.2.0
9
+ - 2
10
+ version: 1.2.2
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: 2011-01-26 00:00:00 +01:00
18
+ date: 2011-01-28 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency