rack-config 0.9.0
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.
- data/README +34 -0
- data/Rakefile +6 -0
- data/lib/rack/config.rb +13 -0
- data/test/config_test.rb +17 -0
- metadata +64 -0
data/README
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
Rack::Config is smaller than this README.
|
2
|
+
|
3
|
+
Use when more than one middleware component needs to access shared
|
4
|
+
configuration.
|
5
|
+
|
6
|
+
Example:
|
7
|
+
|
8
|
+
use Rack::Config do |env|
|
9
|
+
env['couch.users'] = 'http://localhost:5984/users'
|
10
|
+
end
|
11
|
+
use MyAuthMiddleware # needs users
|
12
|
+
run MyApp # also needs users
|
13
|
+
|
14
|
+
|
15
|
+
Copyright (c) 2008 Jon Crosby http://joncrosby.me
|
16
|
+
|
17
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
18
|
+
a copy of this software and associated documentation files (the
|
19
|
+
'Software'), to deal in the Software without restriction, including
|
20
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
21
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
22
|
+
permit persons to whom the Software is furnished to do so, subject to
|
23
|
+
the following conditions:
|
24
|
+
|
25
|
+
The above copyright notice and this permission notice shall be
|
26
|
+
included in all copies or substantial portions of the Software.
|
27
|
+
|
28
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
29
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
30
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
31
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
32
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
33
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
34
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
data/lib/rack/config.rb
ADDED
data/test/config_test.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
$:.unshift File.dirname(__FILE__) + '/../lib'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rack'
|
4
|
+
require 'config'
|
5
|
+
require 'test/unit'
|
6
|
+
class RackConfigTest < Test::Unit::TestCase
|
7
|
+
def test_should_accept_block_that_modifies_environment
|
8
|
+
app = Rack::Builder.new do
|
9
|
+
use Rack::Config do |env|
|
10
|
+
env['greeting'] = 'hello'
|
11
|
+
end
|
12
|
+
run lambda {|env| [200, {}, [env['greeting'] || '']]}
|
13
|
+
end
|
14
|
+
response = Rack::MockRequest.new(app).get('/')
|
15
|
+
assert_equal 'hello', response.body
|
16
|
+
end
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rack-config
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jon Crosby
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-11-27 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rack
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ~>
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0.4"
|
24
|
+
version:
|
25
|
+
description: Shared configuration for cooperative middleware.
|
26
|
+
email: jon@joncrosby.me
|
27
|
+
executables: []
|
28
|
+
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files: []
|
32
|
+
|
33
|
+
files:
|
34
|
+
- Rakefile
|
35
|
+
- README
|
36
|
+
- lib/rack/config.rb
|
37
|
+
has_rdoc: false
|
38
|
+
homepage: http://github.com/jcrosby/rack-config
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options: []
|
41
|
+
|
42
|
+
require_paths:
|
43
|
+
- lib
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: "0"
|
49
|
+
version:
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: "0"
|
55
|
+
version:
|
56
|
+
requirements: []
|
57
|
+
|
58
|
+
rubyforge_project: rack-config
|
59
|
+
rubygems_version: 1.3.1
|
60
|
+
signing_key:
|
61
|
+
specification_version: 2
|
62
|
+
summary: Shared configuration for cooperative middleware.
|
63
|
+
test_files:
|
64
|
+
- test/config_test.rb
|