pry-rails 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a0305d55aec048e6be191698ab148bab078139b2
4
- data.tar.gz: 58c8deaa37ed83f87251cd03ba954249a38a24a7
3
+ metadata.gz: c671c16b7d08553c1f6fee102cf727ab242b85db
4
+ data.tar.gz: 145bdfbb1201b49b634730007777505fd0b59d98
5
5
  SHA512:
6
- metadata.gz: 8af889acb91bb091cd9f8c375720d070418f7f2a5596dede8df28bd23a6977c2c284c9f966b40f067eefcdd7ee640ca2ef7e2c787b001c3e98ad726a813ad24b
7
- data.tar.gz: 46707372f135a2c289f0d2c097d3062de5410cf6c18e1dc97c0afc1266ece9a79652b04e29730df8dfdf141f7f12d17375526cad90c5bb0363fd510453c45f68
6
+ metadata.gz: 5bacc83f74d5977b4309f0d847ea54217faa19175d9151488d3e21194a83845bd5785513ef623e3b5264000fdd337507e639d0b00bc1446d99e08f727e5dd3f6
7
+ data.tar.gz: 2cb4328f489e6ba818f9e5143770fde36b3f0c5996dc43f316fd6721c2546efb5c0d567fa4c62535a0b6b8d91faf8962e384f93157ec07c96fbb7bc693e9584b
@@ -2,7 +2,6 @@ class PryRails::FindRoute < Pry::ClassCommand
2
2
  match 'find-route'
3
3
  group 'Rails'
4
4
  description 'See which URLs match a given Controller.'
5
- command_options argument_required: true
6
5
  banner <<-BANNER
7
6
  Usage: find-route <controller>
8
7
 
@@ -11,13 +10,15 @@ class PryRails::FindRoute < Pry::ClassCommand
11
10
  find-route MyController#show #=> The URL that matches the MyController show action
12
11
  find-route MyController #=> All the URLs that hit MyController
13
12
  find-route Admin #=> All the URLs that hit the Admin namespace
13
+ find-route Com #=> All the URLS whose controller regex matches /Comm/, e.g CommentsController
14
14
  BANNER
15
15
 
16
16
  def process(controller)
17
- if single_action?(controller)
18
- single_action(controller)
17
+ controller_string = controller.to_s
18
+ if single_action?(controller_string)
19
+ single_action(controller_string)
19
20
  else
20
- all_actions(controller)
21
+ all_actions(controller_string)
21
22
  end
22
23
  end
23
24
 
@@ -29,7 +30,7 @@ class PryRails::FindRoute < Pry::ClassCommand
29
30
 
30
31
  def all_actions(controller)
31
32
  show_routes do |route|
32
- route.defaults[:controller].to_s.starts_with?(normalize_controller_name(controller))
33
+ route.defaults[:controller].to_s =~ /#{normalize_controller_name(controller)}/
33
34
  end
34
35
  end
35
36
 
@@ -51,11 +52,11 @@ class PryRails::FindRoute < Pry::ClassCommand
51
52
  if all_routes.any?
52
53
  grouped_routes = all_routes.group_by { |route| route.defaults[:controller] }
53
54
  result = grouped_routes.each_with_object("") do |(controller, routes), result|
54
- result << "Routes for " + text.bold(controller.camelize + "Controller") + "\n"
55
+ result << "Routes for " + text.bold(controller.to_s.camelize + "Controller") + "\n"
55
56
  result << "--\n"
56
57
  routes.each do |route|
57
58
  spec = route.path.is_a?(String) ? route.path : route.path.spec
58
- result << "#{route.defaults[:action]} #{text.bold(verb_for(route))} #{spec}" + "\n"
59
+ result << "#{route.defaults[:action]} #{text.bold(verb_for(route))} #{spec} #{route_helper(route.name)}" + "\n"
59
60
  end
60
61
  result << "\n"
61
62
  end
@@ -65,6 +66,10 @@ class PryRails::FindRoute < Pry::ClassCommand
65
66
  end
66
67
  end
67
68
 
69
+ def route_helper(name)
70
+ name && "[#{name}]"
71
+ end
72
+
68
73
  def verb_for(route)
69
74
  %w(GET PUT POST PATCH DELETE).find { |v| route.verb === v }
70
75
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  module PryRails
4
- VERSION = "0.3.3"
4
+ VERSION = "0.3.4"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robin Wenglewski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-08 00:00:00.000000000 Z
11
+ date: 2015-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -117,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  version: '0'
118
118
  requirements: []
119
119
  rubyforge_project:
120
- rubygems_version: 2.4.4
120
+ rubygems_version: 2.4.5
121
121
  signing_key:
122
122
  specification_version: 4
123
123
  summary: Use Pry as your rails console