betterroutes 0.1.0 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/tasks/betterroutes.rake +61 -0
- metadata +5 -4
@@ -0,0 +1,61 @@
|
|
1
|
+
desc 'Better Routes -- A colorized version of Rake Routes'
|
2
|
+
require 'colorize'
|
3
|
+
|
4
|
+
namespace :betterroutes do
|
5
|
+
desc "Better Routes"
|
6
|
+
task :broutes => :environment do
|
7
|
+
|
8
|
+
puts "Task called successfully!"
|
9
|
+
|
10
|
+
#path_length = 0
|
11
|
+
#verb_length = 0
|
12
|
+
#name_length = 0
|
13
|
+
#ca_length = 0
|
14
|
+
#exclude = ['/assets', '/rails/info/properties']
|
15
|
+
#
|
16
|
+
## Determine column widths
|
17
|
+
#Twotp::Application.routes.routes.each do |route|
|
18
|
+
# path_length = route.path.gsub('(.:format)', '').length if route.path.gsub('(.:format)', '').length > path_length
|
19
|
+
# verb_length = route.verb.length if route.verb.length > verb_length
|
20
|
+
# name_length = route.name.to_s.length if route.name.to_s.length > name_length
|
21
|
+
#
|
22
|
+
# if route.defaults != nil
|
23
|
+
# controller_width = route.defaults[:controller].to_s.length
|
24
|
+
# action_width = route.defaults[:action].to_s.length
|
25
|
+
# ca_length = controller_width + action_width if (controller_width + action_width) > ca_length
|
26
|
+
# end
|
27
|
+
#end
|
28
|
+
#
|
29
|
+
## Header
|
30
|
+
#output = "--PATH" << ("-" * (path_length - 5))
|
31
|
+
#output << "|-METHOD" << ("-" * (verb_length - 5))
|
32
|
+
#output << "|-NAME" << ("-" * (name_length - 3))
|
33
|
+
#output << "|-CONTROLLER / ACTION" << ("-" * (ca_length - 4))
|
34
|
+
#header = output.blue
|
35
|
+
#puts header
|
36
|
+
#
|
37
|
+
## Routes
|
38
|
+
#Twotp::Application.routes.routes.each do |route|
|
39
|
+
#
|
40
|
+
# # Exclusion list
|
41
|
+
# unless exclude.include? route.path.gsub('(.:format)', '')
|
42
|
+
# output = "#{route.path.gsub('(.:format)', '')}".yellow
|
43
|
+
# output << " " * (path_length - route.path.gsub('(.:format)', '').length)
|
44
|
+
# output << " |".blue
|
45
|
+
# output << " #{route.verb}".magenta
|
46
|
+
# output << " " * (verb_length - route.verb.length)
|
47
|
+
# output << " | ".blue
|
48
|
+
# output << "#{route.name}".white
|
49
|
+
# output << " " * (name_length - route.name.to_s.length)
|
50
|
+
# output << " | ".blue
|
51
|
+
# output << "C: ".red
|
52
|
+
# output << route.defaults[:controller].to_s.green
|
53
|
+
# output << ", A: ".red
|
54
|
+
# output << route.defaults[:action].to_s.green
|
55
|
+
# puts output
|
56
|
+
# end
|
57
|
+
#end
|
58
|
+
#puts header
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: betterroutes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-10-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: colorize
|
@@ -32,7 +32,8 @@ email: caedmon@statebuilt.com
|
|
32
32
|
executables: []
|
33
33
|
extensions: []
|
34
34
|
extra_rdoc_files: []
|
35
|
-
files:
|
35
|
+
files:
|
36
|
+
- lib/tasks/betterroutes.rake
|
36
37
|
homepage:
|
37
38
|
licenses: []
|
38
39
|
post_install_message:
|
@@ -56,5 +57,5 @@ rubyforge_project:
|
|
56
57
|
rubygems_version: 1.8.24
|
57
58
|
signing_key:
|
58
59
|
specification_version: 3
|
59
|
-
summary: Better Rake routes listing in full color
|
60
|
+
summary: TESTING -- DO NOT USE -- Better Rake routes listing in full color
|
60
61
|
test_files: []
|