rails-froutes 1.0.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.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +22 -0
- data/.travis.yml +9 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +91 -0
- data/Rakefile +9 -0
- data/gemfiles/rails_3_2_x.gemfile +5 -0
- data/gemfiles/rails_4_0_x.gemfile +5 -0
- data/gemfiles/rails_4_1_x.gemfile +6 -0
- data/lib/rails/froutes.rb +10 -0
- data/lib/rails/froutes/routes_inspector_patch.rb +40 -0
- data/lib/rails/froutes/version.rb +5 -0
- data/rails-froutes.gemspec +26 -0
- data/test/dispatch/routing/routes_inspector_test.rb +137 -0
- data/test/rails/application/route_inspector_test.rb +122 -0
- data/test/test_helper.rb +20 -0
- metadata +134 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a023743130e76ad41dd8d9daa394e4a61a9150bc
|
4
|
+
data.tar.gz: 5fe4e5d9cd27b76ae4e0355a9ad3cfc1757ec03a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fbdb35bd30672f71eab77b2f20a4cb9ec22b05d46636cb6462652dd51e276f657328d7940bfe4a93bf0e2676641b7b7b72a30e60777a2078caf851d2832a8598
|
7
|
+
data.tar.gz: 9049499e165e149205518e692b88e6dae9b58ba932133e403ff5bd3e1145bc31b67356445ab05d12959730650ebff4583cc9e0057579789498577528ae5dd8da
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 pinzolo
|
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,91 @@
|
|
1
|
+
# rails-froutes
|
2
|
+
|
3
|
+
[](http://travis-ci.org/pinzolo/rails-froutes)
|
4
|
+
[](https://coveralls.io/r/pinzolo/rails-froutes)
|
5
|
+
|
6
|
+
This gem fills route name displayed by `rake routes` task.
|
7
|
+
|
8
|
+
## Overview
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
# config/routes.rb
|
12
|
+
RailsApp::Application.routes.draw do
|
13
|
+
resources :blogs do
|
14
|
+
resources :posts
|
15
|
+
end
|
16
|
+
end
|
17
|
+
```
|
18
|
+
|
19
|
+
Default outputs (by `rake routes`)
|
20
|
+
|
21
|
+
```
|
22
|
+
blog_posts GET /blogs/:blog_id/posts(.:format) posts#index
|
23
|
+
POST /blogs/:blog_id/posts(.:format) posts#create
|
24
|
+
new_blog_post GET /blogs/:blog_id/posts/new(.:format) posts#new
|
25
|
+
edit_blog_post GET /blogs/:blog_id/posts/:id/edit(.:format) posts#edit
|
26
|
+
blog_post GET /blogs/:blog_id/posts/:id(.:format) posts#show
|
27
|
+
PUT /blogs/:blog_id/posts/:id(.:format) posts#update
|
28
|
+
DELETE /blogs/:blog_id/posts/:id(.:format) posts#destroy
|
29
|
+
blogs GET /blogs(.:format) blogs#index
|
30
|
+
POST /blogs(.:format) blogs#create
|
31
|
+
new_blog GET /blogs/new(.:format) blogs#new
|
32
|
+
edit_blog GET /blogs/:id/edit(.:format) blogs#edit
|
33
|
+
blog GET /blogs/:id(.:format) blogs#show
|
34
|
+
PUT /blogs/:id(.:format) blogs#update
|
35
|
+
DELETE /blogs/:id(.:format) blogs#destroy
|
36
|
+
```
|
37
|
+
|
38
|
+
Using `rails-froutes` with `FILL_NAME`.
|
39
|
+
|
40
|
+
```
|
41
|
+
blog_posts GET /blogs/:blog_id/posts(.:format) posts#index
|
42
|
+
blog_posts POST /blogs/:blog_id/posts(.:format) posts#create
|
43
|
+
new_blog_post GET /blogs/:blog_id/posts/new(.:format) posts#new
|
44
|
+
edit_blog_post GET /blogs/:blog_id/posts/:id/edit(.:format) posts#edit
|
45
|
+
blog_post GET /blogs/:blog_id/posts/:id(.:format) posts#show
|
46
|
+
blog_post PUT /blogs/:blog_id/posts/:id(.:format) posts#update
|
47
|
+
blog_post DELETE /blogs/:blog_id/posts/:id(.:format) posts#destroy
|
48
|
+
blogs GET /blogs(.:format) blogs#index
|
49
|
+
blogs POST /blogs(.:format) blogs#create
|
50
|
+
new_blog GET /blogs/new(.:format) blogs#new
|
51
|
+
edit_blog GET /blogs/:id/edit(.:format) blogs#edit
|
52
|
+
blog GET /blogs/:id(.:format) blogs#show
|
53
|
+
blog PUT /blogs/:id(.:format) blogs#update
|
54
|
+
blog DELETE /blogs/:id(.:format) blogs#destroy
|
55
|
+
```
|
56
|
+
|
57
|
+
## Installation
|
58
|
+
|
59
|
+
Add this line to your application's Gemfile:
|
60
|
+
|
61
|
+
gem 'rails-froutes'
|
62
|
+
|
63
|
+
And then execute:
|
64
|
+
|
65
|
+
$ bundle
|
66
|
+
|
67
|
+
Or install it yourself as:
|
68
|
+
|
69
|
+
$ gem install rails-froutes
|
70
|
+
|
71
|
+
## Usage
|
72
|
+
|
73
|
+
1. Install `rails-froutes` (See [Installation](#installation) section)
|
74
|
+
1. Run `rake routes FILL_NAME=yes`
|
75
|
+
|
76
|
+
## Supported versions
|
77
|
+
|
78
|
+
- Ruby: 1.9.3, 2.0.0, 2.1.2
|
79
|
+
- Rails: 3.2.x, 4.0.x, 4.1.x
|
80
|
+
|
81
|
+
## Contributing
|
82
|
+
|
83
|
+
1. Fork it ( https://github.com/pinzolo/rails-froutes/fork )
|
84
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
85
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
86
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
87
|
+
5. Create a new Pull Request
|
88
|
+
|
89
|
+
## Changelog
|
90
|
+
|
91
|
+
- v1.0.0 (2014-08-14 JST): First release
|
data/Rakefile
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'rails/froutes/routes_inspector_patch'
|
2
|
+
require 'rails/froutes/version'
|
3
|
+
|
4
|
+
if Rails::VERSION::MAJOR == 4
|
5
|
+
require 'action_dispatch/routing/inspector'
|
6
|
+
ActionDispatch::Routing::RoutesInspector.__send__(:include, Rails::Froutes::RoutesInspectorPatch)
|
7
|
+
else
|
8
|
+
require 'rails/application/route_inspector'
|
9
|
+
Rails::Application::RouteInspector.__send__(:include, Rails::Froutes::RoutesInspectorPatch)
|
10
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'active_support/concern'
|
2
|
+
require 'active_support/core_ext'
|
3
|
+
|
4
|
+
module Rails
|
5
|
+
module Froutes
|
6
|
+
module RoutesInspectorPatch
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
included do
|
10
|
+
alias_method_chain :collect_routes, :fill_name
|
11
|
+
end
|
12
|
+
|
13
|
+
def collect_routes_with_fill_name(base_routes)
|
14
|
+
routes = allowed_to_fill_route_name? ? name_filled_routes_from(base_routes) : base_routes
|
15
|
+
collect_routes_without_fill_name(routes)
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def allowed_to_fill_route_name?
|
21
|
+
fill_env = ENV['FILL_NAME'] || ENV['fill_name']
|
22
|
+
fill_env && %w(y yes true).include?(fill_env.downcase)
|
23
|
+
end
|
24
|
+
|
25
|
+
def name_filled_routes_from(routes)
|
26
|
+
routes.dup.tap do |dup_routes|
|
27
|
+
controller, name = nil
|
28
|
+
dup_routes.each do |route|
|
29
|
+
if route.name || route.defaults[:controller] != controller
|
30
|
+
name = route.name
|
31
|
+
controller = route.defaults[:controller]
|
32
|
+
else
|
33
|
+
route.instance_variable_set(:@name, name)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'rails/froutes/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'rails-froutes'
|
7
|
+
spec.version = Rails::Froutes::VERSION
|
8
|
+
spec.authors = ['pinzolo']
|
9
|
+
spec.email = ['pinzolo@gmail.com']
|
10
|
+
spec.summary = %q{Fill name on routes task}
|
11
|
+
spec.description = %q{This gem fills route name displayed by `rake routes` task.}
|
12
|
+
spec.homepage = 'https://github.com/pinzolo/rails-froutes'
|
13
|
+
spec.license = 'MIT'
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ['lib']
|
19
|
+
|
20
|
+
spec.add_dependency 'rails', '>= 3.2.0'
|
21
|
+
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
23
|
+
spec.add_development_dependency 'rake'
|
24
|
+
spec.add_development_dependency 'coveralls'
|
25
|
+
spec.add_development_dependency 'mocha'
|
26
|
+
end
|
@@ -0,0 +1,137 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
if Rails::VERSION::MAJOR == 4
|
4
|
+
module ActionDispatch
|
5
|
+
module Routing
|
6
|
+
class RoutesInspectorTest < ActiveSupport::TestCase
|
7
|
+
def setup
|
8
|
+
@set = ActionDispatch::Routing::RouteSet.new
|
9
|
+
app = ActiveSupport::OrderedOptions.new
|
10
|
+
app.config = ActiveSupport::OrderedOptions.new
|
11
|
+
app.config.assets = ActiveSupport::OrderedOptions.new
|
12
|
+
app.config.assets.prefix = '/sprockets'
|
13
|
+
Rails.stubs(:application).returns(app)
|
14
|
+
Rails.stubs(:env).returns('development')
|
15
|
+
end
|
16
|
+
|
17
|
+
def draw(options = {}, &block)
|
18
|
+
@set.draw(&block)
|
19
|
+
inspector = ActionDispatch::Routing::RoutesInspector.new(@set.routes)
|
20
|
+
inspector.format(ActionDispatch::Routing::ConsoleFormatter.new, options[:filter]).split("\n")
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_default_output_without_froutes
|
24
|
+
output = draw do
|
25
|
+
resources :articles
|
26
|
+
end
|
27
|
+
|
28
|
+
assert_equal [
|
29
|
+
' Prefix Verb URI Pattern Controller#Action',
|
30
|
+
' articles GET /articles(.:format) articles#index',
|
31
|
+
' POST /articles(.:format) articles#create',
|
32
|
+
' new_article GET /articles/new(.:format) articles#new',
|
33
|
+
'edit_article GET /articles/:id/edit(.:format) articles#edit',
|
34
|
+
' article GET /articles/:id(.:format) articles#show',
|
35
|
+
' PATCH /articles/:id(.:format) articles#update',
|
36
|
+
' PUT /articles/:id(.:format) articles#update',
|
37
|
+
' DELETE /articles/:id(.:format) articles#destroy'
|
38
|
+
], output
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_output_filled_name_with_froutes
|
42
|
+
ENV['FILL_NAME'] = 'yes'
|
43
|
+
|
44
|
+
output = draw do
|
45
|
+
resources :articles
|
46
|
+
end
|
47
|
+
|
48
|
+
assert_output(output)
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_output_filled_name_with_froutes_and_lower_fill_name_option
|
52
|
+
ENV['fill_name'] = 'yes'
|
53
|
+
|
54
|
+
output = draw do
|
55
|
+
resources :articles
|
56
|
+
end
|
57
|
+
|
58
|
+
assert_output(output)
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_output_filled_name_with_froutes_and_upper_fill_name_option_value
|
62
|
+
ENV['FILL_NAME'] = 'YES'
|
63
|
+
|
64
|
+
output = draw do
|
65
|
+
resources :articles
|
66
|
+
end
|
67
|
+
assert_output(output)
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_output_filled_name_with_froutes_and_fill_name_option_value_is_true
|
71
|
+
ENV['FILL_NAME'] = 'true'
|
72
|
+
|
73
|
+
output = draw do
|
74
|
+
resources :articles
|
75
|
+
end
|
76
|
+
assert_output(output)
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_output_filled_name_with_froutes_and_fill_name_option_value_is_y
|
80
|
+
ENV['FILL_NAME'] = 'y'
|
81
|
+
|
82
|
+
output = draw do
|
83
|
+
resources :articles
|
84
|
+
end
|
85
|
+
assert_output(output)
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_output_filled_name_with_froutes_on_nested_routes
|
89
|
+
ENV['FILL_NAME'] = 'yes'
|
90
|
+
|
91
|
+
output = draw do
|
92
|
+
resources :blogs do
|
93
|
+
resources :posts
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
assert_equal [
|
98
|
+
' Prefix Verb URI Pattern Controller#Action',
|
99
|
+
' blog_posts GET /blogs/:blog_id/posts(.:format) posts#index',
|
100
|
+
' blog_posts POST /blogs/:blog_id/posts(.:format) posts#create',
|
101
|
+
' new_blog_post GET /blogs/:blog_id/posts/new(.:format) posts#new',
|
102
|
+
'edit_blog_post GET /blogs/:blog_id/posts/:id/edit(.:format) posts#edit',
|
103
|
+
' blog_post GET /blogs/:blog_id/posts/:id(.:format) posts#show',
|
104
|
+
' blog_post PATCH /blogs/:blog_id/posts/:id(.:format) posts#update',
|
105
|
+
' blog_post PUT /blogs/:blog_id/posts/:id(.:format) posts#update',
|
106
|
+
' blog_post DELETE /blogs/:blog_id/posts/:id(.:format) posts#destroy',
|
107
|
+
' blogs GET /blogs(.:format) blogs#index',
|
108
|
+
' blogs POST /blogs(.:format) blogs#create',
|
109
|
+
' new_blog GET /blogs/new(.:format) blogs#new',
|
110
|
+
' edit_blog GET /blogs/:id/edit(.:format) blogs#edit',
|
111
|
+
' blog GET /blogs/:id(.:format) blogs#show',
|
112
|
+
' blog PATCH /blogs/:id(.:format) blogs#update',
|
113
|
+
' blog PUT /blogs/:id(.:format) blogs#update',
|
114
|
+
' blog DELETE /blogs/:id(.:format) blogs#destroy'
|
115
|
+
], output
|
116
|
+
end
|
117
|
+
|
118
|
+
private
|
119
|
+
|
120
|
+
def assert_output(output)
|
121
|
+
assert_equal [
|
122
|
+
' Prefix Verb URI Pattern Controller#Action',
|
123
|
+
' articles GET /articles(.:format) articles#index',
|
124
|
+
' articles POST /articles(.:format) articles#create',
|
125
|
+
' new_article GET /articles/new(.:format) articles#new',
|
126
|
+
'edit_article GET /articles/:id/edit(.:format) articles#edit',
|
127
|
+
' article GET /articles/:id(.:format) articles#show',
|
128
|
+
' article PATCH /articles/:id(.:format) articles#update',
|
129
|
+
' article PUT /articles/:id(.:format) articles#update',
|
130
|
+
' article DELETE /articles/:id(.:format) articles#destroy'
|
131
|
+
], output
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
@@ -0,0 +1,122 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
if Rails::VERSION::MAJOR != 4
|
4
|
+
module Rails
|
5
|
+
class Application
|
6
|
+
class RouteInspectorTest < Test::Unit::TestCase
|
7
|
+
def setup
|
8
|
+
@set = ActionDispatch::Routing::RouteSet.new
|
9
|
+
@inspector = Rails::Application::RouteInspector.new
|
10
|
+
app = ActiveSupport::OrderedOptions.new
|
11
|
+
app.config = ActiveSupport::OrderedOptions.new
|
12
|
+
app.config.assets = ActiveSupport::OrderedOptions.new
|
13
|
+
app.config.assets.prefix = '/sprockets'
|
14
|
+
Rails.stubs(:application).returns(app)
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_default_output_without_froutes
|
18
|
+
@set.draw do
|
19
|
+
resources :articles
|
20
|
+
end
|
21
|
+
output = @inspector.format @set.routes
|
22
|
+
expected = [
|
23
|
+
' articles GET /articles(.:format) articles#index',
|
24
|
+
' POST /articles(.:format) articles#create',
|
25
|
+
' new_article GET /articles/new(.:format) articles#new',
|
26
|
+
'edit_article GET /articles/:id/edit(.:format) articles#edit',
|
27
|
+
' article GET /articles/:id(.:format) articles#show',
|
28
|
+
' PUT /articles/:id(.:format) articles#update',
|
29
|
+
' DELETE /articles/:id(.:format) articles#destroy' ]
|
30
|
+
assert_equal expected, output
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_output_filled_name_with_froutes
|
34
|
+
ENV['FILL_NAME'] = 'yes'
|
35
|
+
@set.draw do
|
36
|
+
resources :articles
|
37
|
+
end
|
38
|
+
output = @inspector.format @set.routes
|
39
|
+
assert_output(output)
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_output_filled_name_with_froutes_and_lower_fill_name_option
|
43
|
+
ENV['fill_name'] = 'yes'
|
44
|
+
@set.draw do
|
45
|
+
resources :articles
|
46
|
+
end
|
47
|
+
output = @inspector.format @set.routes
|
48
|
+
assert_output(output)
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_output_filled_name_with_froutes_and_upper_fill_name_option_value
|
52
|
+
ENV['FILL_NAME'] = 'YES'
|
53
|
+
@set.draw do
|
54
|
+
resources :articles
|
55
|
+
end
|
56
|
+
output = @inspector.format @set.routes
|
57
|
+
assert_output(output)
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_output_filled_name_with_froutes_and_fill_name_option_value_is_true
|
61
|
+
ENV['FILL_NAME'] = 'true'
|
62
|
+
@set.draw do
|
63
|
+
resources :articles
|
64
|
+
end
|
65
|
+
output = @inspector.format @set.routes
|
66
|
+
assert_output(output)
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_output_filled_name_with_froutes_and_fill_name_option_value_is_y
|
70
|
+
ENV['FILL_NAME'] = 'y'
|
71
|
+
@set.draw do
|
72
|
+
resources :articles
|
73
|
+
end
|
74
|
+
output = @inspector.format @set.routes
|
75
|
+
assert_output(output)
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_output_filled_name_with_froutes_on_nested_routes
|
79
|
+
ENV['FILL_NAME'] = 'yes'
|
80
|
+
|
81
|
+
@set.draw do
|
82
|
+
resources :blogs do
|
83
|
+
resources :posts
|
84
|
+
end
|
85
|
+
end
|
86
|
+
output = @inspector.format @set.routes
|
87
|
+
assert_equal [
|
88
|
+
' blog_posts GET /blogs/:blog_id/posts(.:format) posts#index',
|
89
|
+
' blog_posts POST /blogs/:blog_id/posts(.:format) posts#create',
|
90
|
+
' new_blog_post GET /blogs/:blog_id/posts/new(.:format) posts#new',
|
91
|
+
'edit_blog_post GET /blogs/:blog_id/posts/:id/edit(.:format) posts#edit',
|
92
|
+
' blog_post GET /blogs/:blog_id/posts/:id(.:format) posts#show',
|
93
|
+
' blog_post PUT /blogs/:blog_id/posts/:id(.:format) posts#update',
|
94
|
+
' blog_post DELETE /blogs/:blog_id/posts/:id(.:format) posts#destroy',
|
95
|
+
' blogs GET /blogs(.:format) blogs#index',
|
96
|
+
' blogs POST /blogs(.:format) blogs#create',
|
97
|
+
' new_blog GET /blogs/new(.:format) blogs#new',
|
98
|
+
' edit_blog GET /blogs/:id/edit(.:format) blogs#edit',
|
99
|
+
' blog GET /blogs/:id(.:format) blogs#show',
|
100
|
+
' blog PUT /blogs/:id(.:format) blogs#update',
|
101
|
+
' blog DELETE /blogs/:id(.:format) blogs#destroy'
|
102
|
+
], output
|
103
|
+
end
|
104
|
+
|
105
|
+
private
|
106
|
+
|
107
|
+
def assert_output(output)
|
108
|
+
expected = [
|
109
|
+
' articles GET /articles(.:format) articles#index',
|
110
|
+
' articles POST /articles(.:format) articles#create',
|
111
|
+
' new_article GET /articles/new(.:format) articles#new',
|
112
|
+
'edit_article GET /articles/:id/edit(.:format) articles#edit',
|
113
|
+
' article GET /articles/:id(.:format) articles#show',
|
114
|
+
' article PUT /articles/:id(.:format) articles#update',
|
115
|
+
' article DELETE /articles/:id(.:format) articles#destroy' ]
|
116
|
+
assert_equal expected, output
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'coveralls'
|
2
|
+
require 'simplecov'
|
3
|
+
SimpleCov.formatter = Coveralls::SimpleCov::Formatter
|
4
|
+
SimpleCov.start do
|
5
|
+
add_filter '/test/'
|
6
|
+
add_filter '/bundle/'
|
7
|
+
end
|
8
|
+
|
9
|
+
require 'rails'
|
10
|
+
if Rails::VERSION::MAJOR == 4
|
11
|
+
require 'active_support/testing/autorun'
|
12
|
+
else
|
13
|
+
require 'test/unit'
|
14
|
+
end
|
15
|
+
require 'mocha/setup'
|
16
|
+
require 'rails/froutes'
|
17
|
+
|
18
|
+
def enable_fill_name
|
19
|
+
ENV['FILL_NAME'] = 'yes'
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails-froutes
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- pinzolo
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.2.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.2.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.6'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.6'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
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: coveralls
|
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: mocha
|
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
|
+
description: This gem fills route name displayed by `rake routes` task.
|
84
|
+
email:
|
85
|
+
- pinzolo@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".coveralls.yml"
|
91
|
+
- ".gitignore"
|
92
|
+
- ".travis.yml"
|
93
|
+
- Gemfile
|
94
|
+
- LICENSE.txt
|
95
|
+
- README.md
|
96
|
+
- Rakefile
|
97
|
+
- gemfiles/rails_3_2_x.gemfile
|
98
|
+
- gemfiles/rails_4_0_x.gemfile
|
99
|
+
- gemfiles/rails_4_1_x.gemfile
|
100
|
+
- lib/rails/froutes.rb
|
101
|
+
- lib/rails/froutes/routes_inspector_patch.rb
|
102
|
+
- lib/rails/froutes/version.rb
|
103
|
+
- rails-froutes.gemspec
|
104
|
+
- test/dispatch/routing/routes_inspector_test.rb
|
105
|
+
- test/rails/application/route_inspector_test.rb
|
106
|
+
- test/test_helper.rb
|
107
|
+
homepage: https://github.com/pinzolo/rails-froutes
|
108
|
+
licenses:
|
109
|
+
- MIT
|
110
|
+
metadata: {}
|
111
|
+
post_install_message:
|
112
|
+
rdoc_options: []
|
113
|
+
require_paths:
|
114
|
+
- lib
|
115
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
requirements: []
|
126
|
+
rubyforge_project:
|
127
|
+
rubygems_version: 2.2.2
|
128
|
+
signing_key:
|
129
|
+
specification_version: 4
|
130
|
+
summary: Fill name on routes task
|
131
|
+
test_files:
|
132
|
+
- test/dispatch/routing/routes_inspector_test.rb
|
133
|
+
- test/rails/application/route_inspector_test.rb
|
134
|
+
- test/test_helper.rb
|