strong_routes 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +65 -0
- data/Rakefile +11 -0
- data/lib/strong_routes.rb +17 -0
- data/lib/strong_routes/allow.rb +44 -0
- data/lib/strong_routes/config.rb +51 -0
- data/lib/strong_routes/rails/railtie.rb +23 -0
- data/lib/strong_routes/rails/route_mapper.rb +45 -0
- data/lib/strong_routes/route_matcher.rb +11 -0
- data/lib/strong_routes/version.rb +3 -0
- data/spec/spec_helper.rb +26 -0
- data/spec/strong_routes/allow_spec.rb +92 -0
- data/spec/strong_routes/config_spec.rb +29 -0
- data/spec/strong_routes/rails/route_mapper_spec.rb +37 -0
- data/spec/strong_routes/route_matcher_spec.rb +35 -0
- data/spec/strong_routes_spec.rb +11 -0
- data/strong_routes.gemspec +29 -0
- metadata +169 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 42f14c0ba0507ea6159188aa77ea3ef1c1dcfb19
|
4
|
+
data.tar.gz: 1b70c4df7176535de76d78c4f620c501668f2801
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 78655f85f60188e5bd9074b2f06d778144e5a001e3b19add068b61afff1f1da5a4316c49515fdb2cc56422bdbb4c5259ce0fbf5d07b50c1ae6423c966a4e72bc
|
7
|
+
data.tar.gz: 29fbc16ece04910b136feeeac04354621e9bbcb69a024c6fe78e30f9bb181ab49737ad6e9c14d524a67618adf991992557673a9c4d8d50296582a4cdb10c9695
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Adam Hutchison
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
# Strong Routes
|
2
|
+
|
3
|
+
Strong Routes is a simple Rack middleware to reject requests to unknown routes before allocating connections or any resources.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'strong_routes'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install strong_routes
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
### Rails Apps
|
22
|
+
|
23
|
+
In Rails apps, using strong routes is as simple as adding it to your Gemfile. The middleware is automatically added to the middleware stack. Any routes defined by the application are automatically allowed by default.
|
24
|
+
|
25
|
+
### Rack Apps
|
26
|
+
|
27
|
+
In Rack apps, load the `StrongRoutes::Allow` middleware into your middleware stack:
|
28
|
+
|
29
|
+
```Ruby
|
30
|
+
app.insert_before StrongRoutes::Allow, ResourceLoadingMiddleware
|
31
|
+
```
|
32
|
+
|
33
|
+
In (non-Rails) Rack apps, allowed routes are empty default. Allowed routes are specified using the `allowed_routes` config option:
|
34
|
+
|
35
|
+
```Ruby
|
36
|
+
StrongRoutes.config.allowed_routes = [ '/', '/posts' ]
|
37
|
+
```
|
38
|
+
|
39
|
+
Routes can be specified as strings or regular expressions:
|
40
|
+
|
41
|
+
```Ruby
|
42
|
+
StrongRoutes.config.allowed_routes = [ /\A\//i, /\A\/posts/i ]
|
43
|
+
```
|
44
|
+
|
45
|
+
### Response
|
46
|
+
|
47
|
+
Any routes that aren't allowed will return a 404 by default:
|
48
|
+
|
49
|
+
```
|
50
|
+
[ 404, { "Content-Type" => "text/html", "Content-Length" => "18" }, [ "Resource Not Found" ] ]
|
51
|
+
```
|
52
|
+
|
53
|
+
The message that is returned can be specified using the `message` config option:
|
54
|
+
|
55
|
+
```Ruby
|
56
|
+
StrongRoutes.config.message = File.read(Rails.root.join('public/404.html'))
|
57
|
+
```
|
58
|
+
|
59
|
+
## Contributing
|
60
|
+
|
61
|
+
1. Fork it ( http://github.com/<my-github-username>/strong_routes/fork )
|
62
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
63
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
64
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
65
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rack/request'
|
2
|
+
|
3
|
+
require 'strong_routes/allow'
|
4
|
+
require 'strong_routes/config'
|
5
|
+
require 'strong_routes/route_matcher'
|
6
|
+
require 'strong_routes/version'
|
7
|
+
|
8
|
+
module StrongRoutes
|
9
|
+
def self.config
|
10
|
+
@config ||= Config.new
|
11
|
+
end
|
12
|
+
|
13
|
+
# Initialize the config
|
14
|
+
config
|
15
|
+
end
|
16
|
+
|
17
|
+
require 'strong_routes/rails/railtie' if defined?(Rails)
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module StrongRoutes
|
2
|
+
class Allow
|
3
|
+
def initialize(app, options = {})
|
4
|
+
@app = app
|
5
|
+
@options = ::StrongRoutes.config.merge(options)
|
6
|
+
end
|
7
|
+
|
8
|
+
def call(env)
|
9
|
+
return @app.call(env) unless enabled?
|
10
|
+
|
11
|
+
request = ::Rack::Request.new(env)
|
12
|
+
|
13
|
+
if allowed?(request)
|
14
|
+
@app.call(env)
|
15
|
+
else
|
16
|
+
[ 404, { "Content-Type" => "text/html", "Content-Length" => @options.message.length }, [ @options.message ] ]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def allowed_routes
|
23
|
+
@allowed_routes ||= begin
|
24
|
+
routes = [ @options[:allowed_routes] ]
|
25
|
+
routes.flatten!
|
26
|
+
routes.compact!
|
27
|
+
routes.uniq!
|
28
|
+
routes
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def allowed?(request)
|
33
|
+
route_matchers.any? { |route_matcher| route_matcher =~ request.path_info }
|
34
|
+
end
|
35
|
+
|
36
|
+
def enabled?
|
37
|
+
@options[:enabled]
|
38
|
+
end
|
39
|
+
|
40
|
+
def route_matchers
|
41
|
+
@route_matchers ||= allowed_routes.map { |allowed_route| ::StrongRoutes::RouteMatcher.new(allowed_route) }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module StrongRoutes
|
2
|
+
module Accessorable
|
3
|
+
# Creates an accessor that simply sets and reads a key in the hash:
|
4
|
+
#
|
5
|
+
# class Config < Hash
|
6
|
+
# hash_accessor :app
|
7
|
+
# end
|
8
|
+
#
|
9
|
+
# config = Config.new
|
10
|
+
# config.app = Foo
|
11
|
+
# config[:app] #=> Foo
|
12
|
+
#
|
13
|
+
# config[:app] = Bar
|
14
|
+
# config.app #=> Bar
|
15
|
+
#
|
16
|
+
def hash_accessor(*names) #:nodoc:
|
17
|
+
names.each do |name|
|
18
|
+
class_eval <<-METHOD, __FILE__, __LINE__ + 1
|
19
|
+
def #{name}
|
20
|
+
self[:#{name}]
|
21
|
+
end
|
22
|
+
|
23
|
+
def #{name}=(value)
|
24
|
+
self[:#{name}] = value
|
25
|
+
end
|
26
|
+
|
27
|
+
def #{name}?
|
28
|
+
self[:#{name}].nil?
|
29
|
+
end
|
30
|
+
METHOD
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class Config < Hash
|
36
|
+
extend Accessorable
|
37
|
+
|
38
|
+
hash_accessor :allowed_routes,
|
39
|
+
:enabled,
|
40
|
+
:insert_after,
|
41
|
+
:insert_before,
|
42
|
+
:message
|
43
|
+
|
44
|
+
def initialize(*)
|
45
|
+
super
|
46
|
+
|
47
|
+
self[:enabled] = true if self[:enabled].nil?
|
48
|
+
self[:message] = "Resource Not Found" if self[:message].nil?
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'strong_routes/rails/route_mapper'
|
2
|
+
|
3
|
+
module StrongRoutes
|
4
|
+
module Rails
|
5
|
+
class Railtie < ::Rails::Railtie
|
6
|
+
config.strong_routes = ::StrongRoutes.config
|
7
|
+
|
8
|
+
initializer 'strong_routes.initialize' do |app|
|
9
|
+
config.allowed_routes ||= []
|
10
|
+
config.allowed_routes += ::StrongRoutes::Rails::RouteMapper.map(app.routes)
|
11
|
+
|
12
|
+
case
|
13
|
+
when config.strong_routes.insert_before? then
|
14
|
+
app.config.middleware.insert_before(config.strong_routes.insert_before, ::StrongRoutes::Allow)
|
15
|
+
when config.strong_routes.insert_after? then
|
16
|
+
app.config.middleware.insert_after(config.strong_routes.insert_after, ::StrongRoutes::Allow)
|
17
|
+
else
|
18
|
+
app.config.middleware.insert_before(::Rails::Rack::Logger, ::StrongRoutes::Allow)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'action_dispatch/routing/inspector'
|
2
|
+
|
3
|
+
module StrongRoutes
|
4
|
+
module Rails
|
5
|
+
class RouteMapper
|
6
|
+
attr_reader :route_set
|
7
|
+
|
8
|
+
def self.map(route_set)
|
9
|
+
route_mapper = self.new(route_set)
|
10
|
+
route_mapper.map
|
11
|
+
end
|
12
|
+
|
13
|
+
def initialize(route_set)
|
14
|
+
@route_set = route_set
|
15
|
+
end
|
16
|
+
|
17
|
+
# Map the route set to a collection of the top level segments.
|
18
|
+
def map
|
19
|
+
map = matches.map { |match_data| match_data[:path] }
|
20
|
+
map.compact!
|
21
|
+
map.uniq!
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
# All we need for the allowed routes is the first segment (i.e. 'users'
|
27
|
+
# from '/users/:user_id/posts(/:format)'). Convert the path strings into
|
28
|
+
# match data objects.
|
29
|
+
def matches
|
30
|
+
matches = paths.map { |path| path.match(/\A\/(?<path>[\w-]+)\/*.*\Z/) }
|
31
|
+
matches.compact!
|
32
|
+
matches.uniq!
|
33
|
+
matches
|
34
|
+
end
|
35
|
+
|
36
|
+
# Extract the route paths from the route objects so we have a simple
|
37
|
+
# string to interact with.
|
38
|
+
def paths
|
39
|
+
paths = route_set.routes.map { |route| ::ActionDispatch::Routing::RouteWrapper.new(route).path }
|
40
|
+
paths.uniq!
|
41
|
+
paths
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
# Start SimpleCov
|
4
|
+
require 'simplecov'
|
5
|
+
SimpleCov.start do
|
6
|
+
add_filter "/spec"
|
7
|
+
end
|
8
|
+
|
9
|
+
# Load gems with Bundler
|
10
|
+
require 'bundler'
|
11
|
+
::Bundler.require(:default, :development, :test)
|
12
|
+
|
13
|
+
require 'minitest/spec'
|
14
|
+
require 'minitest/autorun'
|
15
|
+
require 'minitest/pride'
|
16
|
+
|
17
|
+
include ::Rack::Test::Methods
|
18
|
+
|
19
|
+
class MiniTest::Spec < MiniTest::Unit::TestCase
|
20
|
+
class << self
|
21
|
+
alias_method :setup, :before
|
22
|
+
alias_method :teardown, :after
|
23
|
+
alias_method :should, :it
|
24
|
+
alias_method :context, :describe
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
def middleware
|
4
|
+
::StrongRoutes::Allow
|
5
|
+
end
|
6
|
+
|
7
|
+
describe ::StrongRoutes::Allow do
|
8
|
+
let(:app) { middleware.new(env) }
|
9
|
+
let(:env) { lambda { |env| [ 200, { "Content-Type" => "text/plain" }, [ "Good" ] ] } }
|
10
|
+
|
11
|
+
context "without allowed routes set" do
|
12
|
+
it "does not allow access to /users" do
|
13
|
+
get "/users"
|
14
|
+
last_response.wont_be :ok?
|
15
|
+
end
|
16
|
+
|
17
|
+
it "does not allow access to /users/profile" do
|
18
|
+
get "/users/profile"
|
19
|
+
last_response.wont_be :ok?
|
20
|
+
end
|
21
|
+
|
22
|
+
it "does not allow access to /users/profile/anything" do
|
23
|
+
get "/users/profile/anything"
|
24
|
+
last_response.wont_be :ok?
|
25
|
+
end
|
26
|
+
|
27
|
+
it "does not allow access to /users/profile/anything?stuff=12" do
|
28
|
+
get "/users/profile/anything?stuff=12"
|
29
|
+
last_response.wont_be :ok?
|
30
|
+
end
|
31
|
+
|
32
|
+
it "does not allow empty path" do
|
33
|
+
get "/"
|
34
|
+
last_response.wont_be :ok?
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context "with allowed routes set" do
|
39
|
+
let(:users_path) { [ /\/users/i ] }
|
40
|
+
|
41
|
+
before do
|
42
|
+
::StrongRoutes.config.allowed_routes = users_path
|
43
|
+
end
|
44
|
+
|
45
|
+
after do
|
46
|
+
::StrongRoutes.config.allowed_routes = nil
|
47
|
+
end
|
48
|
+
|
49
|
+
it "allows access to /users" do
|
50
|
+
get "/users"
|
51
|
+
last_response.must_be :ok?
|
52
|
+
end
|
53
|
+
|
54
|
+
it "does not allow access to /user" do
|
55
|
+
get "/user"
|
56
|
+
last_response.wont_be :ok?
|
57
|
+
end
|
58
|
+
|
59
|
+
it "allows access to /users/profile/anything?stuff=12" do
|
60
|
+
get "/users/profile/anything?stuff=12"
|
61
|
+
last_response.must_be :ok?
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
context "enabled option is false" do
|
66
|
+
let(:app) { middleware.new(env, { :enabled => false }) }
|
67
|
+
|
68
|
+
it "passes request to the next app" do
|
69
|
+
get "/users/profile/anything?stuff=12"
|
70
|
+
last_response.must_be :ok?
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
context "allowed_routes passed to initializer" do
|
75
|
+
let(:app) { middleware.new(env, { :allowed_routes => [ :users ] }) }
|
76
|
+
|
77
|
+
it "allows /users with :users" do
|
78
|
+
get "/users"
|
79
|
+
last_response.must_be :ok?
|
80
|
+
end
|
81
|
+
|
82
|
+
it "does not allow /user :user" do
|
83
|
+
get "/user"
|
84
|
+
last_response.wont_be :ok?
|
85
|
+
end
|
86
|
+
|
87
|
+
it "allows access to /users/profile/anything?stuff=12 with :users" do
|
88
|
+
get "/users/profile/anything?stuff=12"
|
89
|
+
last_response.must_be :ok?
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ::StrongRoutes::Config do
|
4
|
+
subject { ::StrongRoutes::Config.new }
|
5
|
+
|
6
|
+
describe "API" do
|
7
|
+
it "supports :allowed_routes" do
|
8
|
+
subject.respond_to?(:allowed_routes).must_equal true
|
9
|
+
end
|
10
|
+
|
11
|
+
it "supports :enabled" do
|
12
|
+
subject.respond_to?(:enabled).must_equal true
|
13
|
+
end
|
14
|
+
|
15
|
+
it "supports :insert_after" do
|
16
|
+
subject.respond_to?(:insert_after).must_equal true
|
17
|
+
end
|
18
|
+
|
19
|
+
it "supports :insert_before" do
|
20
|
+
subject.respond_to?(:insert_before).must_equal true
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "#enabled" do
|
25
|
+
it "is enabled by default" do
|
26
|
+
subject.must_be :enabled
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
require 'action_dispatch'
|
4
|
+
require 'strong_routes/rails/route_mapper'
|
5
|
+
|
6
|
+
describe ::StrongRoutes::Rails::RouteMapper do
|
7
|
+
let(:paths) { [ 'users', 'posts', 'user_posts', 'bar', 'trading-post' ] }
|
8
|
+
let(:route_set) {
|
9
|
+
route_set = ActionDispatch::Routing::RouteSet.new
|
10
|
+
route_set.draw do
|
11
|
+
resources :users, :only => :index do
|
12
|
+
resources :posts
|
13
|
+
end
|
14
|
+
|
15
|
+
resources :posts, :only => :show
|
16
|
+
resources :user_posts, :only => :show
|
17
|
+
|
18
|
+
get 'bar/sandwich', :to => 'users#index'
|
19
|
+
get 'trading-post', :to => 'posts#show'
|
20
|
+
end
|
21
|
+
route_set
|
22
|
+
}
|
23
|
+
|
24
|
+
describe ".map" do
|
25
|
+
it "maps routes to path strings" do
|
26
|
+
::StrongRoutes::Rails::RouteMapper.map(route_set).must_equal paths
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "#map" do
|
31
|
+
subject { ::StrongRoutes::Rails::RouteMapper.new(route_set) }
|
32
|
+
|
33
|
+
it "maps routes to path strings" do
|
34
|
+
subject.map.must_equal paths
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ::StrongRoutes::RouteMatcher do
|
4
|
+
describe "initialize" do
|
5
|
+
context "when given a regex" do
|
6
|
+
let(:matcher) { /foo/ }
|
7
|
+
|
8
|
+
subject { ::StrongRoutes::RouteMatcher.new(matcher) }
|
9
|
+
|
10
|
+
it "uses the regex as the matcher" do
|
11
|
+
subject.must_equal matcher
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context "when not given a symbol" do
|
16
|
+
let(:matcher) { /\A\/foo/i }
|
17
|
+
|
18
|
+
subject { ::StrongRoutes::RouteMatcher.new(:foo) }
|
19
|
+
|
20
|
+
it "creates a new matcher" do
|
21
|
+
subject.must_equal matcher
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context "when not given a string" do
|
26
|
+
let(:matcher) { /\A\/foo/i }
|
27
|
+
|
28
|
+
subject { ::StrongRoutes::RouteMatcher.new('foo') }
|
29
|
+
|
30
|
+
it "creates a new matcher" do
|
31
|
+
subject.must_equal matcher
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'strong_routes/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "strong_routes"
|
8
|
+
spec.version = StrongRoutes::VERSION
|
9
|
+
spec.authors = ["Adam Hutchison"]
|
10
|
+
spec.email = ["liveh2o@gmail.com"]
|
11
|
+
spec.summary = %q{Middleware to reject/allow requests before allocating a database connection or any resources}
|
12
|
+
spec.description = spec.summary
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "rack"
|
22
|
+
|
23
|
+
spec.add_development_dependency "actionpack"
|
24
|
+
spec.add_development_dependency "bundler"
|
25
|
+
spec.add_development_dependency "pry-nav"
|
26
|
+
spec.add_development_dependency "rake"
|
27
|
+
spec.add_development_dependency "rack-test"
|
28
|
+
spec.add_development_dependency "simplecov"
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,169 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: strong_routes
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Adam Hutchison
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-02-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rack
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: actionpack
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry-nav
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rack-test
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simplecov
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: Middleware to reject/allow requests before allocating a database connection
|
112
|
+
or any resources
|
113
|
+
email:
|
114
|
+
- liveh2o@gmail.com
|
115
|
+
executables: []
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files: []
|
118
|
+
files:
|
119
|
+
- .gitignore
|
120
|
+
- Gemfile
|
121
|
+
- LICENSE.txt
|
122
|
+
- README.md
|
123
|
+
- Rakefile
|
124
|
+
- lib/strong_routes.rb
|
125
|
+
- lib/strong_routes/allow.rb
|
126
|
+
- lib/strong_routes/config.rb
|
127
|
+
- lib/strong_routes/rails/railtie.rb
|
128
|
+
- lib/strong_routes/rails/route_mapper.rb
|
129
|
+
- lib/strong_routes/route_matcher.rb
|
130
|
+
- lib/strong_routes/version.rb
|
131
|
+
- spec/spec_helper.rb
|
132
|
+
- spec/strong_routes/allow_spec.rb
|
133
|
+
- spec/strong_routes/config_spec.rb
|
134
|
+
- spec/strong_routes/rails/route_mapper_spec.rb
|
135
|
+
- spec/strong_routes/route_matcher_spec.rb
|
136
|
+
- spec/strong_routes_spec.rb
|
137
|
+
- strong_routes.gemspec
|
138
|
+
homepage: ''
|
139
|
+
licenses:
|
140
|
+
- MIT
|
141
|
+
metadata: {}
|
142
|
+
post_install_message:
|
143
|
+
rdoc_options: []
|
144
|
+
require_paths:
|
145
|
+
- lib
|
146
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - '>='
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '0'
|
151
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - '>='
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0'
|
156
|
+
requirements: []
|
157
|
+
rubyforge_project:
|
158
|
+
rubygems_version: 2.2.2
|
159
|
+
signing_key:
|
160
|
+
specification_version: 4
|
161
|
+
summary: Middleware to reject/allow requests before allocating a database connection
|
162
|
+
or any resources
|
163
|
+
test_files:
|
164
|
+
- spec/spec_helper.rb
|
165
|
+
- spec/strong_routes/allow_spec.rb
|
166
|
+
- spec/strong_routes/config_spec.rb
|
167
|
+
- spec/strong_routes/rails/route_mapper_spec.rb
|
168
|
+
- spec/strong_routes/route_matcher_spec.rb
|
169
|
+
- spec/strong_routes_spec.rb
|