ajsharp-sinatra-respond_to 0.7.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog.rdoc +4 -0
- data/Gemfile.lock +19 -14
- data/lib/sinatra/respond_to.rb +3 -3
- data/lib/sinatra/respond_to/version.rb +1 -1
- data/sinatra-respond_to.gemspec +3 -2
- data/spec/app/test_app.rb +2 -2
- data/spec/extension_spec.rb +2 -2
- metadata +82 -76
data/Changelog.rdoc
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,40 +1,45 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sinatra-respond_to (0.
|
5
|
-
sinatra (~> 1.
|
4
|
+
ajsharp-sinatra-respond_to (0.8.0)
|
5
|
+
sinatra (~> 1.3)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: http://rubygems.org/
|
9
9
|
specs:
|
10
|
-
builder (
|
11
|
-
diff-lcs (1.1.
|
12
|
-
haml (3.
|
13
|
-
rack (1.
|
14
|
-
rack-
|
10
|
+
builder (3.0.0)
|
11
|
+
diff-lcs (1.1.3)
|
12
|
+
haml (3.1.3)
|
13
|
+
rack (1.3.5)
|
14
|
+
rack-protection (1.1.4)
|
15
|
+
rack
|
16
|
+
rack-test (0.5.7)
|
15
17
|
rack (>= 1.0)
|
16
|
-
|
18
|
+
rake (0.9.2.2)
|
19
|
+
rcov (0.9.11)
|
17
20
|
rspec (2.5.0)
|
18
21
|
rspec-core (~> 2.5.0)
|
19
22
|
rspec-expectations (~> 2.5.0)
|
20
23
|
rspec-mocks (~> 2.5.0)
|
21
|
-
rspec-core (2.5.
|
24
|
+
rspec-core (2.5.2)
|
22
25
|
rspec-expectations (2.5.0)
|
23
26
|
diff-lcs (~> 1.1.2)
|
24
27
|
rspec-mocks (2.5.0)
|
25
|
-
sinatra (1.
|
26
|
-
rack (~> 1.1)
|
27
|
-
|
28
|
-
|
28
|
+
sinatra (1.3.1)
|
29
|
+
rack (~> 1.3, >= 1.3.4)
|
30
|
+
rack-protection (~> 1.1, >= 1.1.2)
|
31
|
+
tilt (~> 1.3, >= 1.3.3)
|
32
|
+
tilt (1.3.3)
|
29
33
|
|
30
34
|
PLATFORMS
|
31
35
|
ruby
|
32
36
|
|
33
37
|
DEPENDENCIES
|
38
|
+
ajsharp-sinatra-respond_to!
|
34
39
|
builder (>= 2.0)
|
35
40
|
bundler (~> 1.0.10)
|
36
41
|
haml (>= 3.0)
|
37
42
|
rack-test (~> 0.5.6)
|
43
|
+
rake
|
38
44
|
rcov (~> 0.9.8)
|
39
45
|
rspec (~> 2.5.0)
|
40
|
-
sinatra-respond_to!
|
data/lib/sinatra/respond_to.rb
CHANGED
@@ -36,7 +36,7 @@ module Sinatra
|
|
36
36
|
# Let through sinatra image urls in development
|
37
37
|
next if self.class.development? && request.path_info =~ %r{/__sinatra__/.*?.png}
|
38
38
|
|
39
|
-
unless
|
39
|
+
unless settings.static? && settings.public_folder? && (request.get? || request.head?) && static_file?(request.path_info)
|
40
40
|
if request.params.has_key? 'format'
|
41
41
|
format params['format']
|
42
42
|
else
|
@@ -46,7 +46,7 @@ module Sinatra
|
|
46
46
|
# for.
|
47
47
|
request.path_info = request.path_info.sub %r{\.([^\./]+)$}, ''
|
48
48
|
|
49
|
-
format $1 || (request.xhr? &&
|
49
|
+
format $1 || (request.xhr? && settings.assume_xhr_is_js? ? :js : settings.default_content)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
@@ -172,7 +172,7 @@ module Sinatra
|
|
172
172
|
# This is mostly just a helper so request.path_info isn't changed when
|
173
173
|
# serving files from the public directory
|
174
174
|
def static_file?(path)
|
175
|
-
public_dir = File.expand_path(
|
175
|
+
public_dir = File.expand_path(settings.public_folder)
|
176
176
|
path = File.expand_path(File.join(public_dir, unescape(path)))
|
177
177
|
|
178
178
|
path[0, public_dir.length] == public_dir && File.file?(path)
|
data/sinatra-respond_to.gemspec
CHANGED
@@ -5,14 +5,14 @@ Gem::Specification.new do |s|
|
|
5
5
|
s.name = 'ajsharp-sinatra-respond_to'
|
6
6
|
s.version = Sinatra::RespondTo::Version
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
|
-
s.authors = ['Chris Hoffman']
|
8
|
+
s.authors = ['Alex Sharp', 'Chris Hoffman']
|
9
9
|
s.email = ['cehoffman@gmail.com']
|
10
10
|
s.homepage = 'http://github.com/cehoffman/sinatra-respond_to'
|
11
11
|
s.summary = 'A respond_to style Rails block for baked-in web service support in Sinatra'
|
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.3'
|
16
16
|
|
17
17
|
s.add_development_dependency 'rspec', '~> 2.5.0'
|
18
18
|
s.add_development_dependency 'rack-test', '~> 0.5.6'
|
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.add_development_dependency 'builder', '>= 2.0'
|
21
21
|
s.add_development_dependency 'haml', '>= 3.0'
|
22
22
|
s.add_development_dependency 'bundler', '~> 1.0.10'
|
23
|
+
s.add_development_dependency 'rake'
|
23
24
|
|
24
25
|
s.files = `git ls-files`.split("\n")
|
25
26
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
data/spec/app/test_app.rb
CHANGED
@@ -8,7 +8,7 @@ class TestApp < Sinatra::Base
|
|
8
8
|
register Sinatra::RespondTo
|
9
9
|
|
10
10
|
set :views, File.join(File.dirname(__FILE__), 'views')
|
11
|
-
set :
|
11
|
+
set :public_folder, File.join(File.dirname(__FILE__), 'public')
|
12
12
|
|
13
13
|
get '/resource' do
|
14
14
|
respond_to do |wants|
|
@@ -52,4 +52,4 @@ class TestApp < Sinatra::Base
|
|
52
52
|
wants.css { sass :missing }
|
53
53
|
end
|
54
54
|
end
|
55
|
-
end
|
55
|
+
end
|
data/spec/extension_spec.rb
CHANGED
@@ -5,7 +5,7 @@ describe Sinatra::RespondTo do
|
|
5
5
|
::Sinatra::Base.mime_type(sym)
|
6
6
|
end
|
7
7
|
|
8
|
-
describe "
|
8
|
+
describe "settings" do
|
9
9
|
it "should initialize with :default_content set to :html" do
|
10
10
|
TestApp.default_content.should == :html
|
11
11
|
end
|
@@ -341,7 +341,7 @@ describe Sinatra::RespondTo do
|
|
341
341
|
TestApp.disable :static
|
342
342
|
end
|
343
343
|
|
344
|
-
def
|
344
|
+
def settings
|
345
345
|
TestApp
|
346
346
|
end
|
347
347
|
|
metadata
CHANGED
@@ -1,105 +1,112 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: ajsharp-sinatra-respond_to
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.8.0
|
4
5
|
prerelease:
|
5
|
-
version: 0.7.1
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
|
+
- Alex Sharp
|
8
9
|
- Chris Hoffman
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
13
|
+
date: 2011-11-09 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
17
16
|
name: sinatra
|
18
|
-
|
19
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: &70344797642820 !ruby/object:Gem::Requirement
|
20
18
|
none: false
|
21
|
-
requirements:
|
19
|
+
requirements:
|
22
20
|
- - ~>
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version:
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '1.3'
|
25
23
|
type: :runtime
|
26
|
-
version_requirements: *id001
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rspec
|
29
24
|
prerelease: false
|
30
|
-
|
25
|
+
version_requirements: *70344797642820
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: rspec
|
28
|
+
requirement: &70344797642320 !ruby/object:Gem::Requirement
|
31
29
|
none: false
|
32
|
-
requirements:
|
30
|
+
requirements:
|
33
31
|
- - ~>
|
34
|
-
- !ruby/object:Gem::Version
|
32
|
+
- !ruby/object:Gem::Version
|
35
33
|
version: 2.5.0
|
36
34
|
type: :development
|
37
|
-
version_requirements: *id002
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: rack-test
|
40
35
|
prerelease: false
|
41
|
-
|
36
|
+
version_requirements: *70344797642320
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rack-test
|
39
|
+
requirement: &70344797641760 !ruby/object:Gem::Requirement
|
42
40
|
none: false
|
43
|
-
requirements:
|
41
|
+
requirements:
|
44
42
|
- - ~>
|
45
|
-
- !ruby/object:Gem::Version
|
43
|
+
- !ruby/object:Gem::Version
|
46
44
|
version: 0.5.6
|
47
45
|
type: :development
|
48
|
-
version_requirements: *id003
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: rcov
|
51
46
|
prerelease: false
|
52
|
-
|
47
|
+
version_requirements: *70344797641760
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rcov
|
50
|
+
requirement: &70344797641120 !ruby/object:Gem::Requirement
|
53
51
|
none: false
|
54
|
-
requirements:
|
52
|
+
requirements:
|
55
53
|
- - ~>
|
56
|
-
- !ruby/object:Gem::Version
|
54
|
+
- !ruby/object:Gem::Version
|
57
55
|
version: 0.9.8
|
58
56
|
type: :development
|
59
|
-
version_requirements: *id004
|
60
|
-
- !ruby/object:Gem::Dependency
|
61
|
-
name: builder
|
62
57
|
prerelease: false
|
63
|
-
|
58
|
+
version_requirements: *70344797641120
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: builder
|
61
|
+
requirement: &70344797640380 !ruby/object:Gem::Requirement
|
64
62
|
none: false
|
65
|
-
requirements:
|
66
|
-
- -
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version:
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '2.0'
|
69
67
|
type: :development
|
70
|
-
version_requirements: *id005
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: haml
|
73
68
|
prerelease: false
|
74
|
-
|
69
|
+
version_requirements: *70344797640380
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: haml
|
72
|
+
requirement: &70344797637780 !ruby/object:Gem::Requirement
|
75
73
|
none: false
|
76
|
-
requirements:
|
77
|
-
- -
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
version:
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '3.0'
|
80
78
|
type: :development
|
81
|
-
version_requirements: *id006
|
82
|
-
- !ruby/object:Gem::Dependency
|
83
|
-
name: bundler
|
84
79
|
prerelease: false
|
85
|
-
|
80
|
+
version_requirements: *70344797637780
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: bundler
|
83
|
+
requirement: &70344797637160 !ruby/object:Gem::Requirement
|
86
84
|
none: false
|
87
|
-
requirements:
|
85
|
+
requirements:
|
88
86
|
- - ~>
|
89
|
-
- !ruby/object:Gem::Version
|
87
|
+
- !ruby/object:Gem::Version
|
90
88
|
version: 1.0.10
|
91
89
|
type: :development
|
92
|
-
|
90
|
+
prerelease: false
|
91
|
+
version_requirements: *70344797637160
|
92
|
+
- !ruby/object:Gem::Dependency
|
93
|
+
name: rake
|
94
|
+
requirement: &70344797636780 !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ! '>='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
type: :development
|
101
|
+
prerelease: false
|
102
|
+
version_requirements: *70344797636780
|
93
103
|
description:
|
94
|
-
email:
|
104
|
+
email:
|
95
105
|
- cehoffman@gmail.com
|
96
106
|
executables: []
|
97
|
-
|
98
107
|
extensions: []
|
99
|
-
|
100
108
|
extra_rdoc_files: []
|
101
|
-
|
102
|
-
files:
|
109
|
+
files:
|
103
110
|
- .gitignore
|
104
111
|
- .rspec
|
105
112
|
- Changelog.rdoc
|
@@ -121,35 +128,34 @@ files:
|
|
121
128
|
- spec/app/views/resource.xml.builder
|
122
129
|
- spec/extension_spec.rb
|
123
130
|
- spec/spec_helper.rb
|
124
|
-
has_rdoc: true
|
125
131
|
homepage: http://github.com/cehoffman/sinatra-respond_to
|
126
132
|
licenses: []
|
127
|
-
|
128
133
|
post_install_message:
|
129
134
|
rdoc_options: []
|
130
|
-
|
131
|
-
require_paths:
|
135
|
+
require_paths:
|
132
136
|
- lib
|
133
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
137
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
138
|
none: false
|
135
|
-
requirements:
|
136
|
-
- -
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version:
|
139
|
-
|
139
|
+
requirements:
|
140
|
+
- - ! '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
segments:
|
144
|
+
- 0
|
145
|
+
hash: 4593829362998880448
|
146
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
147
|
none: false
|
141
|
-
requirements:
|
142
|
-
- -
|
143
|
-
- !ruby/object:Gem::Version
|
148
|
+
requirements:
|
149
|
+
- - ! '>='
|
150
|
+
- !ruby/object:Gem::Version
|
144
151
|
version: 1.3.6
|
145
152
|
requirements: []
|
146
|
-
|
147
153
|
rubyforge_project:
|
148
|
-
rubygems_version: 1.
|
154
|
+
rubygems_version: 1.8.10
|
149
155
|
signing_key:
|
150
156
|
specification_version: 3
|
151
157
|
summary: A respond_to style Rails block for baked-in web service support in Sinatra
|
152
|
-
test_files:
|
158
|
+
test_files:
|
153
159
|
- spec/app/production_error_app.rb
|
154
160
|
- spec/app/public/static folder/.keep
|
155
161
|
- spec/app/public/static.txt
|