sorted_routes 0.2.0 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 35b09f5c17f247b63258358b51e7fff0f0036739
4
- data.tar.gz: 0d08709549e2bceb69cfb33054714d0679710453
3
+ metadata.gz: 4cceabcebb2396aebca7629b76f658229dc8cdd8
4
+ data.tar.gz: d20bfbdfad9510c7e79b4b4e418c43fddc7cf20a
5
5
  SHA512:
6
- metadata.gz: 58648d23232650fef2a593f2dc485c5d9e8987eed71afaa9cc1c154518712b6b571a144fc48f6d9ebf02ed231ac9de14ab119ea7b8a3d36c61faa856deea2204
7
- data.tar.gz: 8125d84fa5d43c698d854b1721016c4efe81f8912bf8b4547bbb5f641dd2b2d3c6b4055890341ac385837aa13bcfca95879ab4a4cd4933503070439eb70986b7
6
+ metadata.gz: 31c947742bcf363aa5a63b6cfe4278f79307fe5f3fc6904adbce031b902d74b52f6369108eede960cbf2ba6d328890f6e72332bb15a8dd5abdb1e44c55f3f607
7
+ data.tar.gz: 8972ed04cef702b24571c910f9236a71fe43f3ae9baa13050915ed751ef13b5fd61d90b4137f49ad1485fde30fb9b566d8065dd1b19eb452bd6b7322a9c1b180
data/README.md CHANGED
@@ -1,3 +1,35 @@
1
- # Sorted Routes
1
+ # SortedRoutes
2
2
 
3
3
  Rails routes in a searchable and sortable table in your browser.
4
+
5
+ ![](sorted_routes-example.png)
6
+
7
+ ### Installation
8
+ Add the gem to the `development:` group of a Rails Gemfile and run `bundle install`.
9
+
10
+ ```
11
+ gem 'sorted_routes', '~> 1.0'
12
+ ```
13
+ Link to RubyGems: [SortedRoutes](https://rubygems.org/gems/sorted_routes)
14
+
15
+ ### Usage
16
+
17
+ ```
18
+ rake sorted_routes
19
+ ```
20
+ A rake task generates and opens the HTML file `tmp/sorted_routes.html` in your default browser.
21
+
22
+ ### Features
23
+
24
+ **SortedRoutes** uses the DataTables jQuery plugin to create search and sort functionality.
25
+ + Each column is sortable in ascending or descending order. (Click on arrows next to column header.)
26
+ + Search box in the top-right corner allows user to select rows to view.
27
+ + Routes table can be copied, printed, or saved as a pdf by clicking on buttons in the top-left corner.
28
+
29
+ ### System Dependencies
30
+ + Launchy (included in the gem) opens the HTML file
31
+ + jQuery
32
+ + DataTables jQuery plugin is used to generate the tables.
33
+
34
+ ## Author
35
+ Created by [Scott Lenander](http://scottlenander.com/)
data/lib/sorted_routes.rb CHANGED
@@ -1,3 +1,2 @@
1
-
2
1
  require 'sorted_routes/version'
3
2
  require 'sorted_routes/railtie' if defined?(Rails)
@@ -1,3 +1,3 @@
1
1
  module SortedRoutes
2
- VERSION = '0.2.0'
2
+ VERSION = '1.0.0'
3
3
  end
@@ -7,36 +7,52 @@ task :sorted_routes => :environment do
7
7
  output_file = File.join(Rails.root, 'tmp/sorted_routes.html')
8
8
 
9
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
- <link rel='stylesheet' type='text/css' href='https://cdn.datatables.net/v/dt/jszip-2.5.0/dt-1.10.16/b-1.5.1/b-html5-1.5.1/b-print-1.5.1/cr-1.4.1/datatables.min.css'/>
15
- <script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/pdfmake.min.js'></script>
16
- <script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/vfs_fonts.js'></script>
17
- <script type='text/javascript' src='https://cdn.datatables.net/v/dt/jszip-2.5.0/dt-1.10.16/b-1.5.1/b-html5-1.5.1/b-print-1.5.1/cr-1.4.1/datatables.min.js'></script>
18
-
19
- <script type='text/javascript'>
20
- $(document).ready(function() {
21
- $('#sorted-routes').DataTable({
22
- 'pageLength': 100,
23
- 'order': [ 3, 'asc' ],
24
- 'columnDefs': [
25
- { className: 'dt-right', 'targets': [ 0 ] }
26
- ],
27
- dom: 'Bfrtip',
28
- buttons: [
29
- 'copy', 'print', 'pdf'
30
- ]
10
+ f.puts "<html>
11
+ <head>
12
+ <title>Rails Sorted Routes</title>
13
+ <meta name='viewport' content='width=device-width, initial-scale=1'>
14
+ <script src='https://code.jquery.com/jquery-1.12.4.js'></script>
15
+ <script type='text/javascript' charset='utf8' src='https://cdn.datatables.net/1.10.16/js/jquery.dataTables.js'></script>
16
+ <link rel='stylesheet' type='text/css' href='https://cdn.datatables.net/v/dt/jszip-2.5.0/dt-1.10.16/b-1.5.1/b-html5-1.5.1/b-print-1.5.1/cr-1.4.1/datatables.min.css'/>
17
+ <script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/pdfmake.min.js'></script>
18
+ <script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/vfs_fonts.js'></script>
19
+ <script type='text/javascript' src='https://cdn.datatables.net/v/dt/jszip-2.5.0/dt-1.10.16/b-1.5.1/b-html5-1.5.1/b-print-1.5.1/cr-1.4.1/datatables.min.js'></script>
20
+
21
+ <script type='text/javascript'>
22
+ $(document).ready(function() {
23
+ $('#sorted-routes').DataTable({
24
+ 'pageLength': 100,
25
+ 'order': [ 3, 'asc' ],
26
+ 'columnDefs': [
27
+ { className: 'dt-right', 'targets': [ 0 ] }
28
+ ],
29
+ dom: 'Bfrtip',
30
+ buttons: [
31
+ 'copy', 'print', 'pdf'
32
+ ]
33
+ });
31
34
  });
32
- });
33
- </script>
34
- <link rel='stylesheet' type='text/css' href='https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css'>
35
- <style type='text/css'>
36
- body { color: #01dad4; }
37
- </style></head>
38
- <body><table id='sorted-routes' class='display' width='100%'>
39
- <thead><tr><th>Name</th><th>Verb</th><th>Path</th><th>Requirements</th></tr></thead><tbody>"
35
+ </script>
36
+ <link rel='stylesheet' type='text/css' href='https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css'>
37
+ <style type='text/css'>
38
+ body {
39
+ font-family: 'Helvetica', 'Arial', sans-serif;
40
+ color: Navy;
41
+ }
42
+ </style>
43
+ </head>
44
+ <body>
45
+ <h1 style='text-align:center;'>SortedRoutes for #{Rails.application.class.parent.to_s}</h2>
46
+ <table id='sorted-routes' class='compact hover order-column row-border' width='100%'>
47
+ <thead>
48
+ <tr>
49
+ <th>Name</th>
50
+ <th>Verb</th>
51
+ <th>Path</th>
52
+ <th>Requirements</th>
53
+ </tr>
54
+ </thead>
55
+ <tbody>"
40
56
 
41
57
  Rails.application.routes.routes.map do |route|
42
58
  unless route.requirements.empty?
@@ -47,7 +63,12 @@ task :sorted_routes => :environment do
47
63
  controller = route.defaults[:controller].to_s
48
64
  action = route.defaults[:action].to_s
49
65
 
50
- f.puts "<tr><td>#{name}</td><td>#{verb}</td><td>#{path}</td><td>#{controller}&#35;#{action}</td></tr>"
66
+ f.puts "<tr>
67
+ <td style='color:Blue;'>#{name}</td>
68
+ <td style='color:SeaGreen;'>#{verb}</td>
69
+ <td style='color:Red;'>#{path}</td>
70
+ <td><span style='color:Red;'>#{controller}</span><span style='color:DarkTurquoise;'>&#35;#{action}</span></td>
71
+ </tr>"
51
72
  end
52
73
  end
53
74
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sorted_routes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Lenander