betterroutes 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- metadata +4 -4
- data/lib/tasks/betterroutes.rake +0 -56
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 6
|
9
|
+
version: 0.0.6
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Caedmon Judd
|
@@ -37,8 +37,8 @@ extensions: []
|
|
37
37
|
|
38
38
|
extra_rdoc_files: []
|
39
39
|
|
40
|
-
files:
|
41
|
-
|
40
|
+
files: []
|
41
|
+
|
42
42
|
has_rdoc: true
|
43
43
|
homepage:
|
44
44
|
licenses: []
|
data/lib/tasks/betterroutes.rake
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
desc 'Better Routes -- A colorized version of Rake Routes'
|
2
|
-
require 'colorize'
|
3
|
-
|
4
|
-
task :broutes => :environment do
|
5
|
-
|
6
|
-
path_length = 0
|
7
|
-
verb_length = 0
|
8
|
-
name_length = 0
|
9
|
-
ca_length = 0
|
10
|
-
exclude = ['/assets', '/rails/info/properties']
|
11
|
-
|
12
|
-
# Determine column widths
|
13
|
-
Twotp::Application.routes.routes.each do |route|
|
14
|
-
path_length = route.path.gsub('(.:format)', '').length if route.path.gsub('(.:format)', '').length > path_length
|
15
|
-
verb_length = route.verb.length if route.verb.length > verb_length
|
16
|
-
name_length = route.name.to_s.length if route.name.to_s.length > name_length
|
17
|
-
|
18
|
-
if route.defaults != nil
|
19
|
-
controller_width = route.defaults[:controller].to_s.length
|
20
|
-
action_width = route.defaults[:action].to_s.length
|
21
|
-
ca_length = controller_width + action_width if (controller_width + action_width) > ca_length
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
# Header
|
26
|
-
output = "--PATH" << ("-" * (path_length - 5))
|
27
|
-
output << "|-METHOD" << ("-" * (verb_length - 5))
|
28
|
-
output << "|-NAME" << ("-" * (name_length - 3))
|
29
|
-
output << "|-CONTROLLER / ACTION" << ("-" * (ca_length - 4))
|
30
|
-
header = output.blue
|
31
|
-
puts header
|
32
|
-
|
33
|
-
# Routes
|
34
|
-
Twotp::Application.routes.routes.each do |route|
|
35
|
-
|
36
|
-
# Exclusion list
|
37
|
-
unless exclude.include? route.path.gsub('(.:format)', '')
|
38
|
-
output = "#{route.path.gsub('(.:format)', '')}".yellow
|
39
|
-
output << " " * (path_length - route.path.gsub('(.:format)', '').length)
|
40
|
-
output << " |".blue
|
41
|
-
output << " #{route.verb}".magenta
|
42
|
-
output << " " * (verb_length - route.verb.length)
|
43
|
-
output << " | ".blue
|
44
|
-
output << "#{route.name}".white
|
45
|
-
output << " " * (name_length - route.name.to_s.length)
|
46
|
-
output << " | ".blue
|
47
|
-
output << "C: ".red
|
48
|
-
output << route.defaults[:controller].to_s.green
|
49
|
-
output << ", A: ".red
|
50
|
-
output << route.defaults[:action].to_s.green
|
51
|
-
puts output
|
52
|
-
end
|
53
|
-
end
|
54
|
-
puts header
|
55
|
-
|
56
|
-
end
|