sinatra-respond_to 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog.rdoc +10 -0
- data/Gemfile.lock +16 -19
- data/README.md +1 -1
- data/Rakefile +1 -0
- data/lib/sinatra/respond_to.rb +6 -2
- data/lib/sinatra/respond_to/version.rb +1 -1
- data/sinatra-respond_to.gemspec +4 -4
- data/spec/extension_spec.rb +10 -3
- metadata +8 -43
data/Changelog.rdoc
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
=== 0.7.0 / 2011-03-20
|
2
|
+
|
3
|
+
* Compatibility with Sinatra 1.2
|
4
|
+
* Allows xhr requests to use content type of extension if given
|
5
|
+
|
6
|
+
=== 0.6.0 / 2010-11-04
|
7
|
+
|
8
|
+
* Remove default charset settings because Sinatra 1.1 includes this
|
9
|
+
* Correct problem when Content-Type starts out as nil
|
10
|
+
|
1
11
|
=== 0.5.0 / 2010-08-22
|
2
12
|
|
3
13
|
* Requires Sinatra 1.x
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sinatra-respond_to (0.
|
5
|
-
sinatra (~> 1.
|
4
|
+
sinatra-respond_to (0.7.0)
|
5
|
+
sinatra (~> 1.2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: http://rubygems.org/
|
@@ -14,30 +14,27 @@ GEM
|
|
14
14
|
rack-test (0.5.6)
|
15
15
|
rack (>= 1.0)
|
16
16
|
rcov (0.9.9)
|
17
|
-
rspec (2.0
|
18
|
-
rspec-core (~> 2.0
|
19
|
-
rspec-expectations (~> 2.0
|
20
|
-
rspec-mocks (~> 2.0
|
21
|
-
rspec-core (2.
|
22
|
-
rspec-expectations (2.0
|
23
|
-
diff-lcs (
|
24
|
-
rspec-mocks (2.0
|
25
|
-
|
26
|
-
rspec-expectations (~> 2.0.1)
|
27
|
-
sinatra (1.1.0)
|
17
|
+
rspec (2.5.0)
|
18
|
+
rspec-core (~> 2.5.0)
|
19
|
+
rspec-expectations (~> 2.5.0)
|
20
|
+
rspec-mocks (~> 2.5.0)
|
21
|
+
rspec-core (2.5.1)
|
22
|
+
rspec-expectations (2.5.0)
|
23
|
+
diff-lcs (~> 1.1.2)
|
24
|
+
rspec-mocks (2.5.0)
|
25
|
+
sinatra (1.2.1)
|
28
26
|
rack (~> 1.1)
|
29
|
-
tilt (
|
30
|
-
tilt (1.
|
27
|
+
tilt (< 2.0, >= 1.2.2)
|
28
|
+
tilt (1.2.2)
|
31
29
|
|
32
30
|
PLATFORMS
|
33
31
|
ruby
|
34
32
|
|
35
33
|
DEPENDENCIES
|
36
34
|
builder (>= 2.0)
|
37
|
-
bundler (~> 1.0.
|
38
|
-
haml (>=
|
35
|
+
bundler (~> 1.0.10)
|
36
|
+
haml (>= 3.0)
|
39
37
|
rack-test (~> 0.5.6)
|
40
38
|
rcov (~> 0.9.8)
|
41
|
-
rspec (~> 2.0
|
42
|
-
sinatra (~> 1.1)
|
39
|
+
rspec (~> 2.5.0)
|
43
40
|
sinatra-respond_to!
|
data/README.md
CHANGED
@@ -117,7 +117,7 @@ This task will install any missing dependencies, run the tests/specs, and genera
|
|
117
117
|
|
118
118
|
## Contributors
|
119
119
|
|
120
|
-
|
120
|
+
[Contributors](https://github.com/cehoffman/sinatra-respond_to/contributors)
|
121
121
|
|
122
122
|
## LICENSE:
|
123
123
|
|
data/Rakefile
CHANGED
data/lib/sinatra/respond_to.rb
CHANGED
@@ -40,9 +40,13 @@ module Sinatra
|
|
40
40
|
if request.params.has_key? 'format'
|
41
41
|
format params['format']
|
42
42
|
else
|
43
|
-
|
43
|
+
# Sinatra relies on a side-effect from path_info= to
|
44
|
+
# determine its routes. A direct string change (e.g., sub!)
|
45
|
+
# would bypass that -- and fail to have the effect we're looking
|
46
|
+
# for.
|
47
|
+
request.path_info = request.path_info.sub %r{\.([^\./]+)$}, ''
|
44
48
|
|
45
|
-
format request.xhr? && options.assume_xhr_is_js? ? :js :
|
49
|
+
format $1 || (request.xhr? && options.assume_xhr_is_js? ? :js : options.default_content)
|
46
50
|
end
|
47
51
|
end
|
48
52
|
end
|
data/sinatra-respond_to.gemspec
CHANGED
@@ -12,14 +12,14 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.required_rubygems_version = '>= 1.3.6'
|
14
14
|
|
15
|
-
s.add_runtime_dependency 'sinatra', '~> 1.
|
15
|
+
s.add_runtime_dependency 'sinatra', '~> 1.2'
|
16
16
|
|
17
|
-
s.add_development_dependency 'rspec', '~> 2.0
|
17
|
+
s.add_development_dependency 'rspec', '~> 2.5.0'
|
18
18
|
s.add_development_dependency 'rack-test', '~> 0.5.6'
|
19
19
|
s.add_development_dependency 'rcov', '~> 0.9.8'
|
20
20
|
s.add_development_dependency 'builder', '>= 2.0'
|
21
|
-
s.add_development_dependency 'haml', '>=
|
22
|
-
s.add_development_dependency 'bundler', '~> 1.0.
|
21
|
+
s.add_development_dependency 'haml', '>= 3.0'
|
22
|
+
s.add_development_dependency 'bundler', '~> 1.0.10'
|
23
23
|
|
24
24
|
s.files = `git ls-files`.split("\n")
|
25
25
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
data/spec/extension_spec.rb
CHANGED
@@ -34,6 +34,14 @@ describe Sinatra::RespondTo do
|
|
34
34
|
# Put back the option, no side effects here
|
35
35
|
TestApp.enable :assume_xhr_is_js
|
36
36
|
end
|
37
|
+
|
38
|
+
it "should not set the content type to application/javascript for an XMLHttpRequest to an explicit extension" do
|
39
|
+
header 'X_REQUESTED_WITH', 'XMLHttpRequest'
|
40
|
+
|
41
|
+
get '/resource.json'
|
42
|
+
|
43
|
+
last_response['Content-Type'].should =~ %r{#{mime_type(:json)}}
|
44
|
+
end
|
37
45
|
end
|
38
46
|
|
39
47
|
describe "extension routing" do
|
@@ -41,7 +49,7 @@ describe Sinatra::RespondTo do
|
|
41
49
|
get "/resource?format=xml"
|
42
50
|
last_response.body.should =~ %r{\s*<root>Some XML</root>\s*}
|
43
51
|
end
|
44
|
-
|
52
|
+
|
45
53
|
it "breaks routes expecting an extension" do
|
46
54
|
# In test_app.rb the route is defined as get '/style.css' instead of get '/style'
|
47
55
|
get "/style.css"
|
@@ -312,8 +320,7 @@ describe Sinatra::RespondTo do
|
|
312
320
|
end
|
313
321
|
|
314
322
|
it "should not return nil when only content_type sets headers" do
|
315
|
-
settings = mock('settings')
|
316
|
-
settings.should_receive(:default_encoding).and_return('utf-8')
|
323
|
+
settings = mock('settings').as_null_object
|
317
324
|
stub!(:settings).and_return(settings)
|
318
325
|
|
319
326
|
content_type :xhtml
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-respond_to
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 6
|
8
|
-
- 0
|
9
|
-
version: 0.6.0
|
4
|
+
prerelease:
|
5
|
+
version: 0.7.0
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Chris Hoffman
|
@@ -14,7 +10,7 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date:
|
13
|
+
date: 2011-03-20 00:00:00 -05:00
|
18
14
|
default_executable:
|
19
15
|
dependencies:
|
20
16
|
- !ruby/object:Gem::Dependency
|
@@ -25,10 +21,7 @@ dependencies:
|
|
25
21
|
requirements:
|
26
22
|
- - ~>
|
27
23
|
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
- 1
|
30
|
-
- 1
|
31
|
-
version: "1.1"
|
24
|
+
version: "1.2"
|
32
25
|
type: :runtime
|
33
26
|
version_requirements: *id001
|
34
27
|
- !ruby/object:Gem::Dependency
|
@@ -39,11 +32,7 @@ dependencies:
|
|
39
32
|
requirements:
|
40
33
|
- - ~>
|
41
34
|
- !ruby/object:Gem::Version
|
42
|
-
|
43
|
-
- 2
|
44
|
-
- 0
|
45
|
-
- 1
|
46
|
-
version: 2.0.1
|
35
|
+
version: 2.5.0
|
47
36
|
type: :development
|
48
37
|
version_requirements: *id002
|
49
38
|
- !ruby/object:Gem::Dependency
|
@@ -54,10 +43,6 @@ dependencies:
|
|
54
43
|
requirements:
|
55
44
|
- - ~>
|
56
45
|
- !ruby/object:Gem::Version
|
57
|
-
segments:
|
58
|
-
- 0
|
59
|
-
- 5
|
60
|
-
- 6
|
61
46
|
version: 0.5.6
|
62
47
|
type: :development
|
63
48
|
version_requirements: *id003
|
@@ -69,10 +54,6 @@ dependencies:
|
|
69
54
|
requirements:
|
70
55
|
- - ~>
|
71
56
|
- !ruby/object:Gem::Version
|
72
|
-
segments:
|
73
|
-
- 0
|
74
|
-
- 9
|
75
|
-
- 8
|
76
57
|
version: 0.9.8
|
77
58
|
type: :development
|
78
59
|
version_requirements: *id004
|
@@ -84,9 +65,6 @@ dependencies:
|
|
84
65
|
requirements:
|
85
66
|
- - ">="
|
86
67
|
- !ruby/object:Gem::Version
|
87
|
-
segments:
|
88
|
-
- 2
|
89
|
-
- 0
|
90
68
|
version: "2.0"
|
91
69
|
type: :development
|
92
70
|
version_requirements: *id005
|
@@ -98,10 +76,7 @@ dependencies:
|
|
98
76
|
requirements:
|
99
77
|
- - ">="
|
100
78
|
- !ruby/object:Gem::Version
|
101
|
-
|
102
|
-
- 2
|
103
|
-
- 0
|
104
|
-
version: "2.0"
|
79
|
+
version: "3.0"
|
105
80
|
type: :development
|
106
81
|
version_requirements: *id006
|
107
82
|
- !ruby/object:Gem::Dependency
|
@@ -112,11 +87,7 @@ dependencies:
|
|
112
87
|
requirements:
|
113
88
|
- - ~>
|
114
89
|
- !ruby/object:Gem::Version
|
115
|
-
|
116
|
-
- 1
|
117
|
-
- 0
|
118
|
-
- 0
|
119
|
-
version: 1.0.0
|
90
|
+
version: 1.0.10
|
120
91
|
type: :development
|
121
92
|
version_requirements: *id007
|
122
93
|
description:
|
@@ -164,23 +135,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
164
135
|
requirements:
|
165
136
|
- - ">="
|
166
137
|
- !ruby/object:Gem::Version
|
167
|
-
segments:
|
168
|
-
- 0
|
169
138
|
version: "0"
|
170
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
140
|
none: false
|
172
141
|
requirements:
|
173
142
|
- - ">="
|
174
143
|
- !ruby/object:Gem::Version
|
175
|
-
segments:
|
176
|
-
- 1
|
177
|
-
- 3
|
178
|
-
- 6
|
179
144
|
version: 1.3.6
|
180
145
|
requirements: []
|
181
146
|
|
182
147
|
rubyforge_project:
|
183
|
-
rubygems_version: 1.
|
148
|
+
rubygems_version: 1.6.2
|
184
149
|
signing_key:
|
185
150
|
specification_version: 3
|
186
151
|
summary: A respond_to style Rails block for baked-in web service support in Sinatra
|