sorted_routes 0.1.5

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 648be5c6e71021f652844fe9aaec522cb76680b9
4
+ data.tar.gz: c6de1955bb3d2b11e07d5103f2f3193cf3e0dd21
5
+ SHA512:
6
+ metadata.gz: b8b17cfa5361bb72da9616312dc59bc59f2f41b80a847343c8682af3d1056e4c40e25751bf79bc6ece154b31bbaf2866e44dcd4c2e269cf547f692858c782172
7
+ data.tar.gz: 4d7783defae53280ba7e3af85028630632afdb5a48852f9ec309287affacc535b868858df09b58e7364da5d96a5c34031b60e5590099e7c1ce83d121ae99b076
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 ScottL
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 all
13
+ 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 THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # Sorted Routes
2
+
3
+ Rails routes in a searchable and sortable table in your browser.
@@ -0,0 +1,12 @@
1
+ require 'sorted_routes'
2
+ require 'rails'
3
+
4
+ module SortedRoutes
5
+ class Railtie < Rails::Railtie
6
+ railtie_name :sorted_routes
7
+
8
+ rake_tasks do
9
+ Dir[File.join(File.dirname(__FILE__),'tasks/*.rake')].each { |f| load f }
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,3 @@
1
+ module SortedRoutes
2
+ VERSION = '0.1.5'
3
+ end
@@ -0,0 +1,3 @@
1
+
2
+ require 'sorted_routes/version'
3
+ require 'sorted_routes/railtie' if defined?(Rails)
@@ -0,0 +1,45 @@
1
+ require 'launchy'
2
+ require 'rake'
3
+
4
+ desc 'sorted_routes rake task'
5
+
6
+ task :sorted_routes => :environment do
7
+ output_file = File.join(Rails.root, 'tmp/sorted_routes.html')
8
+
9
+ File.open(output_file, 'w') do |f|
10
+ f.puts "<html><head><title>Rails Sorted Routes</title>
11
+ <meta name='viewport' content='width=device-width, initial-scale=1'>
12
+ <script src='https://code.jquery.com/jquery-1.12.4.js'></script>
13
+ <script type='text/javascript' charset='utf8' src='https://cdn.datatables.net/1.10.16/js/jquery.dataTables.js'></script>
14
+ <script type='text/javascript'>
15
+ $(document).ready(function() {
16
+ $('#sorted-routes').DataTable();
17
+ });
18
+ </script>
19
+ <link rel='stylesheet' type='text/css' href='https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css'>
20
+ <style type='text/css'>
21
+ body { background-color: #333; color: #01dad4; }
22
+ </style></head>
23
+ <body><table id='sorted-routes' class='display' width='100%'>
24
+ <thead><tr><th>Name</th><th>Verb</th><th>Path</th><th>Requirements</th></tr></thead><tbody>"
25
+
26
+ Rails.application.routes.routes.map do |route|
27
+ unless route.requirements.empty?
28
+
29
+ name = route.name.to_s
30
+ verb = route.verb.inspect.gsub(/^.{2}|.{2}$/, "").to_s
31
+ path = route.path.spec.to_s
32
+ controller = route.defaults[:controller].to_s
33
+ action = route.defaults[:action].to_s
34
+
35
+ f.puts "<tr><td>#{name}</td><td>#{verb}</td><td>#{path}</td><td>#{controller}&#35;#{action}</td></tr>"
36
+ end
37
+ end
38
+
39
+ f.puts '</tbody></table>
40
+ </body></html>'
41
+
42
+ puts "Generated routes to file://#{output_file}."
43
+ Launchy.open("file://#{output_file}")
44
+ end
45
+ end
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sorted_routes
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.5
5
+ platform: ruby
6
+ authors:
7
+ - Scott Lenander
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-03-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: launchy
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.4'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.4'
27
+ description: Displays rails routes in a sortable and searchable table in your browser.
28
+ email: sjlteacher@gmail.com
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - LICENSE
34
+ - README.md
35
+ - lib/sorted_routes.rb
36
+ - lib/sorted_routes/railtie.rb
37
+ - lib/sorted_routes/version.rb
38
+ - lib/tasks/sorted_routes.rake
39
+ homepage: https://github.com/SJl149/sorted-routes
40
+ licenses:
41
+ - MIT
42
+ metadata: {}
43
+ post_install_message:
44
+ rdoc_options: []
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ requirements: []
58
+ rubyforge_project:
59
+ rubygems_version: 2.6.11
60
+ signing_key:
61
+ specification_version: 4
62
+ summary: Sort out your routes!
63
+ test_files: []