too_short 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/controller_methods.rb +14 -11
- data/spec/spec_helper.rb +2 -2
- data/spec/test_directories/app/models/crazy_rubinius_file.rbc +2 -0
- data/too_short.gemspec +4 -4
- metadata +6 -33
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
data/lib/controller_methods.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module TooShort
|
2
|
-
|
2
|
+
|
3
3
|
# To be included in the controller that should handle short URLs, i.e
|
4
4
|
# class ShortUrlsController < ApplicationController
|
5
5
|
# include TooShort::ControllerMethods
|
@@ -17,31 +17,34 @@ module TooShort
|
|
17
17
|
respond_to_valid_short_url
|
18
18
|
else
|
19
19
|
respond_to_invalid_short_url
|
20
|
-
end
|
20
|
+
end
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
def respond_to_valid_short_url
|
24
24
|
redirect_to @object_from_short_url
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
def respond_to_invalid_short_url
|
28
28
|
respond_to do |wants|
|
29
29
|
error_hash = {:error => 'Invalid short url'}
|
30
30
|
wants.html { render :text => error_hash[:error]}
|
31
31
|
wants.xml { render :xml => error_hash}
|
32
|
-
wants.json { render :json => error_hash}
|
32
|
+
wants.json { render :json => error_hash}
|
33
33
|
end
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
private
|
37
|
-
|
37
|
+
|
38
38
|
def require_all_model_classes
|
39
39
|
# Rails only loads classes when they are used
|
40
40
|
# To populate our registry we require each file in app/models
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
if defined?(Rails)
|
42
|
+
files = Dir.glob(Rails.root.to_s + '/app/models/**/*.rb').map { |path| File.basename(path) }
|
43
|
+
files.select{|f| f =~ /^\w/}.each do |f|
|
44
|
+
f.sub('.rb', '').camelize.constantize
|
45
|
+
end
|
46
|
+
end
|
44
47
|
end
|
45
|
-
|
48
|
+
|
46
49
|
end
|
47
50
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -2,8 +2,8 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
2
2
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
3
|
require 'rspec'
|
4
4
|
require 'too_short'
|
5
|
-
require '
|
6
|
-
require '
|
5
|
+
require 'test_directories/app/models/post.rb'
|
6
|
+
require 'test_directories/app/models/post_comment.rb'
|
7
7
|
|
8
8
|
# Requires supporting files with custom matchers and macros, etc,
|
9
9
|
# in ./support/ and its subdirectories.
|
data/too_short.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{too_short}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Simon Baumgartner"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-05-13}
|
13
13
|
s.description = %q{TooShort allows you to create persistent short URLs for your resources, without any additional storage.}
|
14
14
|
s.email = %q{makesens3@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
|
|
30
30
|
"spec/ar_base_extensions_spec.rb",
|
31
31
|
"spec/controller_methods_spec.rb",
|
32
32
|
"spec/spec_helper.rb",
|
33
|
+
"spec/test_directories/app/models/crazy_rubinius_file.rbc",
|
33
34
|
"spec/test_directories/app/models/post.rb",
|
34
35
|
"spec/test_directories/app/models/post_comment.rb",
|
35
36
|
"spec/too_short_spec.rb",
|
@@ -38,7 +39,7 @@ Gem::Specification.new do |s|
|
|
38
39
|
s.homepage = %q{http://github.com/sens3/too_short}
|
39
40
|
s.licenses = ["MIT"]
|
40
41
|
s.require_paths = ["lib"]
|
41
|
-
s.rubygems_version = %q{1.
|
42
|
+
s.rubygems_version = %q{1.6.2}
|
42
43
|
s.summary = %q{A URL shortener for your resources}
|
43
44
|
s.test_files = [
|
44
45
|
"spec/ar_base_extensions_spec.rb",
|
@@ -50,7 +51,6 @@ Gem::Specification.new do |s|
|
|
50
51
|
]
|
51
52
|
|
52
53
|
if s.respond_to? :specification_version then
|
53
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
54
54
|
s.specification_version = 3
|
55
55
|
|
56
56
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: too_short
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
- 4
|
9
|
-
version: 0.1.4
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.5
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Simon Baumgartner
|
@@ -14,7 +10,7 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date: 2011-
|
13
|
+
date: 2011-05-13 00:00:00 -04:00
|
18
14
|
default_executable:
|
19
15
|
dependencies:
|
20
16
|
- !ruby/object:Gem::Dependency
|
@@ -24,10 +20,6 @@ dependencies:
|
|
24
20
|
requirements:
|
25
21
|
- - ">="
|
26
22
|
- !ruby/object:Gem::Version
|
27
|
-
segments:
|
28
|
-
- 3
|
29
|
-
- 0
|
30
|
-
- 0
|
31
23
|
version: 3.0.0
|
32
24
|
type: :runtime
|
33
25
|
prerelease: false
|
@@ -39,10 +31,6 @@ dependencies:
|
|
39
31
|
requirements:
|
40
32
|
- - ">="
|
41
33
|
- !ruby/object:Gem::Version
|
42
|
-
segments:
|
43
|
-
- 3
|
44
|
-
- 0
|
45
|
-
- 0
|
46
34
|
version: 3.0.0
|
47
35
|
type: :runtime
|
48
36
|
prerelease: false
|
@@ -54,10 +42,6 @@ dependencies:
|
|
54
42
|
requirements:
|
55
43
|
- - ~>
|
56
44
|
- !ruby/object:Gem::Version
|
57
|
-
segments:
|
58
|
-
- 2
|
59
|
-
- 3
|
60
|
-
- 0
|
61
45
|
version: 2.3.0
|
62
46
|
type: :development
|
63
47
|
prerelease: false
|
@@ -69,10 +53,6 @@ dependencies:
|
|
69
53
|
requirements:
|
70
54
|
- - ~>
|
71
55
|
- !ruby/object:Gem::Version
|
72
|
-
segments:
|
73
|
-
- 1
|
74
|
-
- 0
|
75
|
-
- 0
|
76
56
|
version: 1.0.0
|
77
57
|
type: :development
|
78
58
|
prerelease: false
|
@@ -84,10 +64,6 @@ dependencies:
|
|
84
64
|
requirements:
|
85
65
|
- - ~>
|
86
66
|
- !ruby/object:Gem::Version
|
87
|
-
segments:
|
88
|
-
- 1
|
89
|
-
- 5
|
90
|
-
- 2
|
91
67
|
version: 1.5.2
|
92
68
|
type: :development
|
93
69
|
prerelease: false
|
@@ -99,8 +75,6 @@ dependencies:
|
|
99
75
|
requirements:
|
100
76
|
- - ">="
|
101
77
|
- !ruby/object:Gem::Version
|
102
|
-
segments:
|
103
|
-
- 0
|
104
78
|
version: "0"
|
105
79
|
type: :development
|
106
80
|
prerelease: false
|
@@ -128,6 +102,7 @@ files:
|
|
128
102
|
- spec/ar_base_extensions_spec.rb
|
129
103
|
- spec/controller_methods_spec.rb
|
130
104
|
- spec/spec_helper.rb
|
105
|
+
- spec/test_directories/app/models/crazy_rubinius_file.rbc
|
131
106
|
- spec/test_directories/app/models/post.rb
|
132
107
|
- spec/test_directories/app/models/post_comment.rb
|
133
108
|
- spec/too_short_spec.rb
|
@@ -146,7 +121,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
146
121
|
requirements:
|
147
122
|
- - ">="
|
148
123
|
- !ruby/object:Gem::Version
|
149
|
-
hash:
|
124
|
+
hash: -4602073981085127268
|
150
125
|
segments:
|
151
126
|
- 0
|
152
127
|
version: "0"
|
@@ -155,13 +130,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
130
|
requirements:
|
156
131
|
- - ">="
|
157
132
|
- !ruby/object:Gem::Version
|
158
|
-
segments:
|
159
|
-
- 0
|
160
133
|
version: "0"
|
161
134
|
requirements: []
|
162
135
|
|
163
136
|
rubyforge_project:
|
164
|
-
rubygems_version: 1.
|
137
|
+
rubygems_version: 1.6.2
|
165
138
|
signing_key:
|
166
139
|
specification_version: 3
|
167
140
|
summary: A URL shortener for your resources
|