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.
@@ -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
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sinatra-respond_to (0.5.0)
5
- sinatra (~> 1.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.1)
18
- rspec-core (~> 2.0.1)
19
- rspec-expectations (~> 2.0.1)
20
- rspec-mocks (~> 2.0.1)
21
- rspec-core (2.0.1)
22
- rspec-expectations (2.0.1)
23
- diff-lcs (>= 1.1.2)
24
- rspec-mocks (2.0.1)
25
- rspec-core (~> 2.0.1)
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 (~> 1.1)
30
- tilt (1.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.0)
38
- haml (>= 2.0)
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.1)
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
- * [Ryan Schenk](http://github.com/rschenk/)
120
+ [Contributors](https://github.com/cehoffman/sinatra-respond_to/contributors)
121
121
 
122
122
  ## LICENSE:
123
123
 
data/Rakefile CHANGED
@@ -1,3 +1,4 @@
1
+ require 'rubygems'
1
2
  require 'bundler'
2
3
  Bundler::GemHelper.install_tasks
3
4
 
@@ -40,9 +40,13 @@ module Sinatra
40
40
  if request.params.has_key? 'format'
41
41
  format params['format']
42
42
  else
43
- request.path_info.sub! %r{\.([^\./]+)$}, ''
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 : $1 || options.default_content
49
+ format $1 || (request.xhr? && options.assume_xhr_is_js? ? :js : options.default_content)
46
50
  end
47
51
  end
48
52
  end
@@ -1,5 +1,5 @@
1
1
  module Sinatra
2
2
  module RespondTo
3
- Version = '0.6.0'
3
+ Version = '0.7.0'
4
4
  end
5
5
  end
@@ -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.1'
15
+ s.add_runtime_dependency 'sinatra', '~> 1.2'
16
16
 
17
- s.add_development_dependency 'rspec', '~> 2.0.1'
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', '>= 2.0'
22
- s.add_development_dependency 'bundler', '~> 1.0.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")
@@ -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: false
5
- segments:
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: 2010-11-04 00:00:00 -05:00
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
- segments:
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
- segments:
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
- segments:
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
- segments:
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.3.7
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