rack-static-if-present 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +3 -3
- data/Rakefile +9 -0
- data/config.ru +1 -1
- data/lib/rack-static-if-present/version.rb +1 -1
- data/rack-static-if-present.gemspec +1 -1
- data/test/cgi/test +9 -0
- data/test/spec_rack-static-if-present.rb +60 -0
- metadata +43 -60
- data/test/test_rack-static-if-present.rb +0 -7
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f08d4963c1ca67529b9fd48f5d10f0a11993229c
|
4
|
+
data.tar.gz: a2fec8713c2bad8010da0dc93cef5d13146b465d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2f8ff2f1ef2020a6662ab68514f07b40a8b8eadbe8e5872e9f95f479d69f40d645c883a5704a346a924960fb99bbdfe79659de259d005a0f1885c0d1910743c6
|
7
|
+
data.tar.gz: e1ccdfaad44a24f44fe38b82b211ad7b644b9a966484e4ddf0e0e64406e265852867df53de98827019446601ea82566cef1440204fd10e64e5beab16a115c77e
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rack-static-if-present
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.0.0
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
@@ -1,2 +1,11 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
desc "Run all the fast tests"
|
5
|
+
task :test do
|
6
|
+
opts = ENV['TEST'] || '-a'
|
7
|
+
specopts = ENV['TESTOPTS'] ||
|
8
|
+
"-q -t '^(?!Rack::Adapter|Rack::Session::Memcache|Rack::Server)'"
|
9
|
+
|
10
|
+
sh "bacon -I./lib:./test -w #{opts} #{specopts}"
|
11
|
+
end
|
data/config.ru
CHANGED
data/test/cgi/test
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__)) + '/../lib/rack-static-if-present'
|
2
|
+
require 'rack/mock'
|
3
|
+
require 'ruby-debug'
|
4
|
+
class DummyApp
|
5
|
+
def call(env)
|
6
|
+
[200, {}, ["Hello World"]]
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
describe Rack::StaticIfPresent do
|
11
|
+
root = File.expand_path(File.dirname(__FILE__))
|
12
|
+
|
13
|
+
OPTIONS = {:urls => ["/cgi"], :root => root}
|
14
|
+
HASH_OPTIONS = {:urls => {"/cgi/sekret" => 'cgi/test'}, :root => root}
|
15
|
+
|
16
|
+
@request = Rack::MockRequest.new(Rack::StaticIfPresent.new(DummyApp.new, OPTIONS))
|
17
|
+
@hash_request = Rack::MockRequest.new(Rack::StaticIfPresent.new(DummyApp.new, HASH_OPTIONS))
|
18
|
+
|
19
|
+
it "serves files" do
|
20
|
+
res = @request.get("/cgi/test")
|
21
|
+
res.should.be.ok
|
22
|
+
res.body.should =~ /ruby/
|
23
|
+
end
|
24
|
+
|
25
|
+
# This is the part that is different than Rack:Static
|
26
|
+
# Rack::Static's spec:
|
27
|
+
# it "404s if url root is known but it can't find the file" do
|
28
|
+
it "calls down the chain if url root is known but it can't find the file" do
|
29
|
+
res = @request.get("/cgi/foo")
|
30
|
+
# res.should.be.not_found
|
31
|
+
res.body.should == "Hello World"
|
32
|
+
end
|
33
|
+
|
34
|
+
it "calls down the chain if url root is not known" do
|
35
|
+
res = @request.get("/something/else")
|
36
|
+
res.should.be.ok
|
37
|
+
res.body.should == "Hello World"
|
38
|
+
end
|
39
|
+
|
40
|
+
it "serves hidden files" do
|
41
|
+
res = @hash_request.get("/cgi/sekret")
|
42
|
+
res.should.be.ok
|
43
|
+
res.body.should =~ /ruby/
|
44
|
+
end
|
45
|
+
|
46
|
+
it "calls down the chain if the URI is not specified" do
|
47
|
+
res = @hash_request.get("/something/else")
|
48
|
+
res.should.be.ok
|
49
|
+
res.body.should == "Hello World"
|
50
|
+
end
|
51
|
+
|
52
|
+
it "supports serving fixed cache-control" do
|
53
|
+
opts = OPTIONS.merge(:cache_control => 'public')
|
54
|
+
request = Rack::MockRequest.new(Rack::StaticIfPresent.new(DummyApp.new, opts))
|
55
|
+
res = request.get("/cgi/test")
|
56
|
+
res.should.be.ok
|
57
|
+
res.headers['Cache-Control'].should == 'public'
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
metadata
CHANGED
@@ -1,49 +1,41 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-static-if-present
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease: false
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 2
|
9
|
-
- 0
|
10
|
-
version: 0.2.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.1
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Sam Schenkman-Moore
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2013-08-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
22
14
|
name: rack
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 1
|
30
|
-
segments:
|
31
|
-
- 1
|
32
|
-
version: "1"
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>'
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1'
|
33
20
|
type: :runtime
|
34
|
-
|
35
|
-
|
36
|
-
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>'
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1'
|
27
|
+
description: Not much to explain. Not a lot of code, but wanted it packaged up for
|
28
|
+
easy use/deployment.
|
29
|
+
email:
|
37
30
|
- samsm@samsm.com
|
38
31
|
executables: []
|
39
|
-
|
40
32
|
extensions: []
|
41
|
-
|
42
33
|
extra_rdoc_files: []
|
43
|
-
|
44
|
-
files:
|
34
|
+
files:
|
45
35
|
- .document
|
46
36
|
- .gitignore
|
37
|
+
- .ruby-gemset
|
38
|
+
- .ruby-version
|
47
39
|
- Gemfile
|
48
40
|
- Gemfile.lock
|
49
41
|
- LICENSE
|
@@ -53,42 +45,33 @@ files:
|
|
53
45
|
- lib/rack-static-if-present.rb
|
54
46
|
- lib/rack-static-if-present/version.rb
|
55
47
|
- rack-static-if-present.gemspec
|
48
|
+
- test/cgi/test
|
56
49
|
- test/helper.rb
|
57
|
-
- test/
|
58
|
-
has_rdoc: true
|
50
|
+
- test/spec_rack-static-if-present.rb
|
59
51
|
homepage: http://github.com/samsm/rack-static-if-present
|
60
52
|
licenses: []
|
61
|
-
|
53
|
+
metadata: {}
|
62
54
|
post_install_message:
|
63
55
|
rdoc_options: []
|
64
|
-
|
65
|
-
require_paths:
|
56
|
+
require_paths:
|
66
57
|
- lib
|
67
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
none: false
|
78
|
-
requirements:
|
79
|
-
- - ">="
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
hash: 3
|
82
|
-
segments:
|
83
|
-
- 0
|
84
|
-
version: "0"
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - '>='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
85
68
|
requirements: []
|
86
|
-
|
87
69
|
rubyforge_project: rack-static-if-present
|
88
|
-
rubygems_version:
|
70
|
+
rubygems_version: 2.0.6
|
89
71
|
signing_key:
|
90
|
-
specification_version:
|
72
|
+
specification_version: 4
|
91
73
|
summary: Like Rack::Static. Except only if there is a static file to serve.
|
92
|
-
test_files:
|
74
|
+
test_files:
|
75
|
+
- test/cgi/test
|
93
76
|
- test/helper.rb
|
94
|
-
- test/
|
77
|
+
- test/spec_rack-static-if-present.rb
|