vain_routes 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.rdoc +37 -0
- data/Rakefile +21 -0
- data/VERSION +1 -0
- data/app/controllers/vain_routes/routes_controller.rb +28 -0
- data/app/views/layouts/vain_routes/base.html.erb +29 -0
- data/app/views/vain_routes/routes/_route.html.erb +18 -0
- data/app/views/vain_routes/routes/index.html.erb +36 -0
- data/config/routes.rb +4 -0
- data/doc/screenshot.png +0 -0
- data/lib/vain_routes/engine.rb +11 -0
- data/lib/vain_routes.rb +1 -0
- data/public/vain_routes/data_tables/css/demo_page.css +93 -0
- data/public/vain_routes/data_tables/css/demo_table.css +538 -0
- data/public/vain_routes/data_tables/css/demo_table_jui.css +521 -0
- data/public/vain_routes/data_tables/images/Sorting icons.psd +0 -0
- data/public/vain_routes/data_tables/images/back_disabled.jpg +0 -0
- data/public/vain_routes/data_tables/images/back_enabled.jpg +0 -0
- data/public/vain_routes/data_tables/images/favicon.ico +0 -0
- data/public/vain_routes/data_tables/images/forward_disabled.jpg +0 -0
- data/public/vain_routes/data_tables/images/forward_enabled.jpg +0 -0
- data/public/vain_routes/data_tables/images/sort_asc.png +0 -0
- data/public/vain_routes/data_tables/images/sort_asc_disabled.png +0 -0
- data/public/vain_routes/data_tables/images/sort_both.png +0 -0
- data/public/vain_routes/data_tables/images/sort_desc.png +0 -0
- data/public/vain_routes/data_tables/images/sort_desc_disabled.png +0 -0
- data/public/vain_routes/data_tables/js/jquery.dataTables.js +6862 -0
- data/public/vain_routes/data_tables/js/jquery.dataTables.min.js +143 -0
- data/public/vain_routes/data_tables/js/jquery.dataTables.min.js.gz +0 -0
- data/public/vain_routes/data_tables/js/jquery.js +16 -0
- data/public/vain_routes/images/Sorting icons.psd +0 -0
- data/public/vain_routes/images/back_disabled.jpg +0 -0
- data/public/vain_routes/images/back_enabled.jpg +0 -0
- data/public/vain_routes/images/favicon.ico +0 -0
- data/public/vain_routes/images/forward_disabled.jpg +0 -0
- data/public/vain_routes/images/forward_enabled.jpg +0 -0
- data/public/vain_routes/images/oak_background_texture.jpg +0 -0
- data/public/vain_routes/images/sort_asc.png +0 -0
- data/public/vain_routes/images/sort_asc_disabled.png +0 -0
- data/public/vain_routes/images/sort_both.png +0 -0
- data/public/vain_routes/images/sort_desc.png +0 -0
- data/public/vain_routes/images/sort_desc_disabled.png +0 -0
- data/public/vain_routes/stylesheets/base.css +49 -0
- data/public/vain_routes/stylesheets/data_table_jui.css +523 -0
- data/public/vain_routes/stylesheets/jui-pepper-grinder/images/ui-bg_diagonal-maze_20_6e4f1c_10x10.png +0 -0
- data/public/vain_routes/stylesheets/jui-pepper-grinder/images/ui-bg_diagonal-maze_40_000000_10x10.png +0 -0
- data/public/vain_routes/stylesheets/jui-pepper-grinder/images/ui-bg_fine-grain_10_eceadf_60x60.png +0 -0
- data/public/vain_routes/stylesheets/jui-pepper-grinder/images/ui-bg_fine-grain_10_f8f7f6_60x60.png +0 -0
- data/public/vain_routes/stylesheets/jui-pepper-grinder/images/ui-bg_fine-grain_15_eceadf_60x60.png +0 -0
- data/public/vain_routes/stylesheets/jui-pepper-grinder/images/ui-bg_fine-grain_15_f7f3de_60x60.png +0 -0
- data/public/vain_routes/stylesheets/jui-pepper-grinder/images/ui-bg_fine-grain_15_ffffff_60x60.png +0 -0
- data/public/vain_routes/stylesheets/jui-pepper-grinder/images/ui-bg_fine-grain_65_654b24_60x60.png +0 -0
- data/public/vain_routes/stylesheets/jui-pepper-grinder/images/ui-bg_fine-grain_68_b83400_60x60.png +0 -0
- data/public/vain_routes/stylesheets/jui-pepper-grinder/images/ui-icons_222222_256x240.png +0 -0
- data/public/vain_routes/stylesheets/jui-pepper-grinder/images/ui-icons_3572ac_256x240.png +0 -0
- data/public/vain_routes/stylesheets/jui-pepper-grinder/images/ui-icons_8c291d_256x240.png +0 -0
- data/public/vain_routes/stylesheets/jui-pepper-grinder/images/ui-icons_b83400_256x240.png +0 -0
- data/public/vain_routes/stylesheets/jui-pepper-grinder/images/ui-icons_fbdb93_256x240.png +0 -0
- data/public/vain_routes/stylesheets/jui-pepper-grinder/images/ui-icons_ffffff_256x240.png +0 -0
- data/public/vain_routes/stylesheets/jui-pepper-grinder/jquery-ui-1.8.11.custom.css +573 -0
- data/public/vain_routes/stylesheets/jui-redmond/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/public/vain_routes/stylesheets/jui-redmond/images/ui-bg_flat_55_fbec88_40x100.png +0 -0
- data/public/vain_routes/stylesheets/jui-redmond/images/ui-bg_glass_75_d0e5f5_1x400.png +0 -0
- data/public/vain_routes/stylesheets/jui-redmond/images/ui-bg_glass_85_dfeffc_1x400.png +0 -0
- data/public/vain_routes/stylesheets/jui-redmond/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/public/vain_routes/stylesheets/jui-redmond/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +0 -0
- data/public/vain_routes/stylesheets/jui-redmond/images/ui-bg_inset-hard_100_f5f8f9_1x100.png +0 -0
- data/public/vain_routes/stylesheets/jui-redmond/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
- data/public/vain_routes/stylesheets/jui-redmond/images/ui-icons_217bc0_256x240.png +0 -0
- data/public/vain_routes/stylesheets/jui-redmond/images/ui-icons_2e83ff_256x240.png +0 -0
- data/public/vain_routes/stylesheets/jui-redmond/images/ui-icons_469bdd_256x240.png +0 -0
- data/public/vain_routes/stylesheets/jui-redmond/images/ui-icons_6da8d5_256x240.png +0 -0
- data/public/vain_routes/stylesheets/jui-redmond/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/public/vain_routes/stylesheets/jui-redmond/images/ui-icons_d8e7f3_256x240.png +0 -0
- data/public/vain_routes/stylesheets/jui-redmond/images/ui-icons_f9bd01_256x240.png +0 -0
- data/public/vain_routes/stylesheets/jui-redmond/jquery-ui-1.8.11.custom.css +573 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +9 -0
- data/spec/vain_routes_spec.rb +7 -0
- metadata +159 -0
data/.document
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2010 Ryan D. Stawarz
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
= vain_routes
|
2
|
+
|
3
|
+
You didn't invest all that time into creating your beautiful restful routes only to have them displayed in a
|
4
|
+
console window, did you?
|
5
|
+
|
6
|
+
Introducing 'Vain Routes' - a rails engine that enables you to view your routes directly from your browser, sort them, and even filter them! While the command line may helpful, it isn't as pretty as this!
|
7
|
+
|
8
|
+
http://github.com/rstawarz/vain_routes/raw/master/doc/screenshot.png
|
9
|
+
|
10
|
+
=Install
|
11
|
+
Simply install the gem:
|
12
|
+
gem install 'vain_routes'
|
13
|
+
|
14
|
+
=Configure
|
15
|
+
Add vain_routes to your Gemfile:
|
16
|
+
group :development do
|
17
|
+
gem 'vain_routes'
|
18
|
+
end
|
19
|
+
=Fire it up!
|
20
|
+
From the command line, fire up your server
|
21
|
+
rails server
|
22
|
+
And open your browser to:
|
23
|
+
http://localhost:3000/vain/routes
|
24
|
+
|
25
|
+
|
26
|
+
== Feeback & Requests
|
27
|
+
|
28
|
+
Please give it a try, and let me know if you have any requests on how I can make those routes look even better!
|
29
|
+
|
30
|
+
If you like it (or not), please shoot me a note via email (ryan at stawarz dot com) or twitter (@rstawarz[http://www.twitter.com/rstawarz]).
|
31
|
+
|
32
|
+
== Thanks
|
33
|
+
Special thanks to {Matt Hamm}[http://www.flickr.com/photos/matthamm/2690294056/in/photostream/] for sharing the background image on flickr.
|
34
|
+
|
35
|
+
== Copyright
|
36
|
+
|
37
|
+
Copyright (c) 2010 Ryan Stawarz. It is free software governed by the MIT License - see the terms specified in the LICENSE file for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "vain_routes"
|
8
|
+
gem.summary = %Q{Vain Routes enables you to view your routes from a web page.}
|
9
|
+
gem.description = %Q{Vain routes is a Rails engine that enables you to view your routes in a filterable online view.}
|
10
|
+
gem.email = "ryan at stawarz dot com"
|
11
|
+
gem.homepage = "http://github.com/rstawarz/vain_routes"
|
12
|
+
gem.authors = ["Ryan Stawarz"]
|
13
|
+
#gem.add_development_dependency "rspec", ">= 1.2.9"
|
14
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
|
+
end
|
16
|
+
Jeweler::GemcutterTasks.new
|
17
|
+
rescue LoadError
|
18
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
19
|
+
end
|
20
|
+
|
21
|
+
#require 'spec/rake/spectask'
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module VainRoutes
|
2
|
+
class RoutesController < ApplicationController
|
3
|
+
layout 'vain_routes/base'
|
4
|
+
unloadable
|
5
|
+
|
6
|
+
def index
|
7
|
+
@routes = Rails.application.routes.routes
|
8
|
+
end
|
9
|
+
|
10
|
+
def filter_routes(routes)
|
11
|
+
routes.reject! { |r| r.path.to_s =~ %r{/rails/info/properties} } # Skip the route if it's internal info route
|
12
|
+
end
|
13
|
+
|
14
|
+
# def view_html_routes
|
15
|
+
# system("#{platform_specific_open_command} #{@out_file}")
|
16
|
+
# end
|
17
|
+
|
18
|
+
# def generate_html_routes!(routes)
|
19
|
+
# routes = filter_routes(routes)
|
20
|
+
|
21
|
+
# template = File.open(File.join(@view_path, 'routes.html.erb'), "r"){|f| f.read }
|
22
|
+
# rendered_routes = ERB.new(template).result(binding)
|
23
|
+
|
24
|
+
# File.open(@out_file, 'w') {|f| f.write(rendered_routes) }
|
25
|
+
# end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<!DOCTYPE HTML>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Vain Routes</title>
|
5
|
+
<link rel="stylesheet" href="/vain_routes/stylesheets/jui-redmond/jquery-ui-1.8.11.custom.css" type="text/css" media="screen" title="no title" charset="utf-8">
|
6
|
+
|
7
|
+
<%= stylesheet_link_tag '/vain_routes/stylesheets/base.css', '/vain_routes/stylesheets/data_table_jui' %>
|
8
|
+
|
9
|
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
|
10
|
+
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js"></script>
|
11
|
+
<script type="text/javascript" language="javascript" src="/vain_routes/data_tables/js/jquery.dataTables.js"></script>
|
12
|
+
|
13
|
+
<%= csrf_meta_tag %>
|
14
|
+
</head>
|
15
|
+
<body>
|
16
|
+
<div class="main-content">
|
17
|
+
<div class="header"></div>
|
18
|
+
<div class="content">
|
19
|
+
<% [:error, :warning, :notice].each do |sym| %>
|
20
|
+
<% if flash[sym] %>
|
21
|
+
<p class="flash <%=sym.to_s%>"><%= flash[sym] %></p>
|
22
|
+
<% end %>
|
23
|
+
<% end %>
|
24
|
+
<%= yield %>
|
25
|
+
</div>
|
26
|
+
<div class="footer"></div>
|
27
|
+
</div>
|
28
|
+
</body>
|
29
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<tr class="<%=cycle('route-odd', 'route-even')%> <%=route.verb%> ">
|
2
|
+
<td><%=route_counter+1%></td>
|
3
|
+
<td><%= (route.verb || :any).to_s.upcase%></td>
|
4
|
+
<td class="wrapword"><%= route.path %></td>
|
5
|
+
<td class="wrapword">
|
6
|
+
<%=route.requirements[:controller]%>
|
7
|
+
</td>
|
8
|
+
<td class="wrapword">
|
9
|
+
<%=route.requirements[:action]%>
|
10
|
+
</td>
|
11
|
+
<!--
|
12
|
+
<ul>
|
13
|
+
<li>Controller: <%=route.requirements[:controller]%></li>
|
14
|
+
<li>Action: <%=route.requirements[:action]%></li>
|
15
|
+
</ul>
|
16
|
+
<%= route.requirements.inspect %>,<%= route.conditions.inspect %>
|
17
|
+
-->
|
18
|
+
</tr>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
|
2
|
+
<script type="text/javascript" charset="utf-8">
|
3
|
+
$(document).ready(function() {
|
4
|
+
$('#vainroutes').dataTable({
|
5
|
+
"bPaginate": false,
|
6
|
+
"bLengthChange": false,
|
7
|
+
"bFilter": true,
|
8
|
+
"bJQueryUI": true,
|
9
|
+
"bSort": true,
|
10
|
+
"bInfo": false,
|
11
|
+
"bAutoWidth": false });
|
12
|
+
} );
|
13
|
+
</script>
|
14
|
+
<div class="routes">
|
15
|
+
<table id="vainroutes" class="display">
|
16
|
+
<colgroup>
|
17
|
+
<col class="order"/>
|
18
|
+
<col class="verb"/>
|
19
|
+
<col class="path"/>
|
20
|
+
<col class="controller"/>
|
21
|
+
<col class="action"/>
|
22
|
+
</colgroup>
|
23
|
+
<thead>
|
24
|
+
<tr>
|
25
|
+
<th >Order</th>
|
26
|
+
<th>Verb</th>
|
27
|
+
<th>Path</th>
|
28
|
+
<th>Controller</th>
|
29
|
+
<th>Action</th>
|
30
|
+
</tr>
|
31
|
+
</thead>
|
32
|
+
<tbody>
|
33
|
+
<%= render :partial => "route", :collection => @routes %>
|
34
|
+
</tbody>
|
35
|
+
</table>
|
36
|
+
</div>
|
data/config/routes.rb
ADDED
data/doc/screenshot.png
ADDED
Binary file
|
@@ -0,0 +1,11 @@
|
|
1
|
+
#require "vain_routes"
|
2
|
+
#require "rails"
|
3
|
+
|
4
|
+
module VainRoutes
|
5
|
+
class Engine < Rails::Engine
|
6
|
+
initializer "static assets" do |app|
|
7
|
+
app.middleware.use ::ActionDispatch::Static, "#{root}/public"
|
8
|
+
#app.middleware.insert_before(::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/vain_routes.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'vain_routes/engine' if defined?(Rails) && Rails::VERSION::MAJOR == 3
|
@@ -0,0 +1,93 @@
|
|
1
|
+
|
2
|
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
3
|
+
* General page setup
|
4
|
+
*/
|
5
|
+
#dt_example {
|
6
|
+
font: 80%/1.45em "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
|
7
|
+
margin: 0;
|
8
|
+
padding: 0;
|
9
|
+
color: #333;
|
10
|
+
background-color: #fff;
|
11
|
+
}
|
12
|
+
|
13
|
+
|
14
|
+
#dt_example #container {
|
15
|
+
width: 800px;
|
16
|
+
margin: 30px auto;
|
17
|
+
padding: 0;
|
18
|
+
}
|
19
|
+
|
20
|
+
|
21
|
+
#dt_example #footer {
|
22
|
+
margin: 50px auto 0 auto;
|
23
|
+
padding: 0;
|
24
|
+
}
|
25
|
+
|
26
|
+
#dt_example #demo {
|
27
|
+
margin: 30px auto 0 auto;
|
28
|
+
}
|
29
|
+
|
30
|
+
#dt_example .demo_jui {
|
31
|
+
margin: 30px auto 0 auto;
|
32
|
+
}
|
33
|
+
|
34
|
+
#dt_example .big {
|
35
|
+
font-size: 1.3em;
|
36
|
+
font-weight: bold;
|
37
|
+
line-height: 1.6em;
|
38
|
+
color: #4E6CA3;
|
39
|
+
}
|
40
|
+
|
41
|
+
#dt_example .spacer {
|
42
|
+
height: 20px;
|
43
|
+
clear: both;
|
44
|
+
}
|
45
|
+
|
46
|
+
#dt_example .clear {
|
47
|
+
clear: both;
|
48
|
+
}
|
49
|
+
|
50
|
+
#dt_example pre {
|
51
|
+
padding: 15px;
|
52
|
+
background-color: #F5F5F5;
|
53
|
+
border: 1px solid #CCCCCC;
|
54
|
+
}
|
55
|
+
|
56
|
+
#dt_example h1 {
|
57
|
+
margin-top: 2em;
|
58
|
+
font-size: 1.3em;
|
59
|
+
font-weight: normal;
|
60
|
+
line-height: 1.6em;
|
61
|
+
color: #4E6CA3;
|
62
|
+
border-bottom: 1px solid #B0BED9;
|
63
|
+
clear: both;
|
64
|
+
}
|
65
|
+
|
66
|
+
#dt_example h2 {
|
67
|
+
font-size: 1.2em;
|
68
|
+
font-weight: normal;
|
69
|
+
line-height: 1.6em;
|
70
|
+
color: #4E6CA3;
|
71
|
+
clear: both;
|
72
|
+
}
|
73
|
+
|
74
|
+
#dt_example a {
|
75
|
+
color: #0063DC;
|
76
|
+
text-decoration: none;
|
77
|
+
}
|
78
|
+
|
79
|
+
#dt_example a:hover {
|
80
|
+
text-decoration: underline;
|
81
|
+
}
|
82
|
+
|
83
|
+
#dt_example ul {
|
84
|
+
color: #4E6CA3;
|
85
|
+
}
|
86
|
+
|
87
|
+
.css_right {
|
88
|
+
float: right;
|
89
|
+
}
|
90
|
+
|
91
|
+
.css_left {
|
92
|
+
float: left;
|
93
|
+
}
|