pry-rails 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: f1bf84b59262a2cae9e27ff70243ece0801883ac
4
- data.tar.gz: 561db8abcdc9a12bcc24d4ac4bbb34c15bd1f672
5
- SHA512:
6
- metadata.gz: c86ae06eb7cbeb6ecd938e8680fe6c580b43f5457137ad9d5f9fa71298a3d9dc5a1185b1a3c784bc0fb65be10ff5558122dab59da4b5537d7908a5e3741e6ebb
7
- data.tar.gz: 99719f8dbc4abc3b624ad052211b1f290a82dd506cf0846dc8715be2634a94414efe36263f1c010547a90b82820fee3a1a386b6f2425cc16b29b0351b58a622f
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NDU0YWU5MTYxNTVmOWQwNGI5YmI3MzdjYmVhYzgyMDM1NzA4Mzc3NA==
5
+ data.tar.gz: !binary |-
6
+ YjJhMmIzNDFjZTkzNWMzNTMwNzNjMzAwZDQ0ZjkzOTA2YWEzYzdhZQ==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ NTQzODNkMzFhMjUwZTJiMTk1Nzk3MDJiMjRlNzM3MWI3ODM3YTVlZDUzODNi
10
+ ZTc1NTExOTU4OGIxYzk2OWM2NGEyMzhhNGVkZTY2NjU2ZTExNzIwZTA1OWEw
11
+ M2E2M2U2NzI4MzhiMjA2ZGU2M2Q0NjU2YTA3MmNmNmM3MmJiOTg=
12
+ data.tar.gz: !binary |-
13
+ YjUyMmExZDYxYzQzOGZiY2FkYTFhZTFhN2FmYmJhYjliZjk3Mjc2MDAwOTY0
14
+ MmE2Y2YyYzBhNjBlN2YxZGEzZjAxNDQ3N2NkNzk5ZjBhYmUyZTU3YTJhZTI0
15
+ NGNmY2NhZWUzM2ZkMWM0YmQ1NTg0ZTVhMWRiYWFiYTRlMjZlZDU=
@@ -0,0 +1,34 @@
1
+ # encoding: UTF-8
2
+
3
+ PryRails::Commands.create_command "recognize-path" do
4
+ group "Rails"
5
+ description "Verify that a URL is mapped to the right controller and action"
6
+
7
+ def options(opt)
8
+ opt.banner unindent <<-USAGE
9
+ Usage: recognize-path PATH [-m|--method METHOD]
10
+
11
+ Verifies that a given PATH is mapped to the right controller and action.
12
+
13
+ recognize-path example.com
14
+ recognize-path example.com -m post
15
+ USAGE
16
+
17
+ opt.on :m, :method, "Methods", :argument => true
18
+ end
19
+
20
+ def process
21
+ method = (opts.m? ? opts[:m] : :get)
22
+ routes = Rails.application.routes
23
+
24
+ begin
25
+ info = routes.recognize_path("http://#{args.first}", :method => method)
26
+ rescue ActionController::UnknownHttpMethod
27
+ output.puts "Unknown HTTP method: #{method}"
28
+ rescue ActionController::RoutingError => e
29
+ output.puts e
30
+ end
31
+
32
+ output.puts Pry::Helpers::BaseHelpers.colorize_code(info)
33
+ end
34
+ end
@@ -1,5 +1,5 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  module PryRails
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.1"
5
5
  end
@@ -0,0 +1,51 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe "recognize-path" do
6
+ before do
7
+ FooController = Class.new(ActionController::Base)
8
+ BoomsController = Class.new(ActionController::Base)
9
+ routes = Rails.application.routes
10
+ routes.draw {
11
+ root(:to => 'foo#index', :constraints => {:host => 'example.com'})
12
+ resources :booms
13
+ }
14
+ routes.finalize!
15
+ end
16
+
17
+ after do
18
+ [:FooController, :BoomsController].each { |const|
19
+ Object.__send__(:remove_const, const)
20
+ }
21
+ end
22
+
23
+ it "prints info about controller/action that is bound to the given path" do
24
+ output = mock_pry('recognize-path example.com', 'exit-all')
25
+ output.must_match /controller.+foo/
26
+ output.must_match /action.+index/
27
+ end
28
+
29
+ it "accepts short path" do
30
+ output = mock_pry('recognize-path /booms/1/edit', 'exit-all')
31
+ output.must_match /action.+edit/
32
+ output.must_match /controller.+booms/
33
+ output.must_match /id.+1/
34
+ end
35
+
36
+ it "accepts -m switch" do
37
+ output = mock_pry('recognize-path example.com/booms -m post', 'exit-all')
38
+ output.must_match /controller.+booms/
39
+ output.must_match /action.+create/
40
+ end
41
+
42
+ it "doesn't accept unknown methods" do
43
+ output = mock_pry('recognize-path example.com/booms -m posty', 'exit-all')
44
+ output.must_match 'Unknown HTTP method: posty'
45
+ end
46
+
47
+ it "doesn't accept unknown routes" do
48
+ output = mock_pry('recognize-path bing/bang/bong', 'exit-all')
49
+ output.must_match 'No route matches "http://bing/bang/bong"'
50
+ end
51
+ end
@@ -4,7 +4,7 @@ require 'spec_helper'
4
4
 
5
5
  describe "show-models" do
6
6
  it "should print a list of models" do
7
- output = mock_pry('show-models', 'exit-all')
7
+ output = mock_pry('Pry.color = false;', 'show-models', 'exit-all')
8
8
 
9
9
  ar_models = <<MODELS
10
10
  Beer
@@ -1,4 +1,3 @@
1
- require 'minitest/spec'
2
1
  require 'minitest/autorun'
3
2
 
4
3
  require 'rr'
metadata CHANGED
@@ -1,71 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robin Wenglewski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-07 00:00:00.000000000 Z
11
+ date: 2013-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
+ prerelease: false
14
15
  name: pry
16
+ version_requirements: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ! '>='
19
+ - !ruby/object:Gem::Version
20
+ version: 0.9.10
15
21
  requirement: !ruby/object:Gem::Requirement
16
22
  requirements:
17
- - - '>='
23
+ - - ! '>='
18
24
  - !ruby/object:Gem::Version
19
25
  version: 0.9.10
20
26
  type: :runtime
27
+ - !ruby/object:Gem::Dependency
21
28
  prerelease: false
29
+ name: appraisal
22
30
  version_requirements: !ruby/object:Gem::Requirement
23
31
  requirements:
24
- - - '>='
32
+ - - ! '>='
25
33
  - !ruby/object:Gem::Version
26
- version: 0.9.10
27
- - !ruby/object:Gem::Dependency
28
- name: appraisal
34
+ version: '0'
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - '>='
37
+ - - ! '>='
32
38
  - !ruby/object:Gem::Version
33
39
  version: '0'
34
40
  type: :development
41
+ - !ruby/object:Gem::Dependency
35
42
  prerelease: false
43
+ name: minitest
36
44
  version_requirements: !ruby/object:Gem::Requirement
37
45
  requirements:
38
- - - '>='
46
+ - - ! '>='
39
47
  - !ruby/object:Gem::Version
40
48
  version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: minitest
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
- - - '>='
51
+ - - ! '>='
46
52
  - !ruby/object:Gem::Version
47
53
  version: '0'
48
54
  type: :development
55
+ - !ruby/object:Gem::Dependency
49
56
  prerelease: false
57
+ name: rr
50
58
  version_requirements: !ruby/object:Gem::Requirement
51
59
  requirements:
52
- - - '>='
60
+ - - ! '>='
53
61
  - !ruby/object:Gem::Version
54
62
  version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: rr
57
63
  requirement: !ruby/object:Gem::Requirement
58
64
  requirements:
59
- - - '>='
65
+ - - ! '>='
60
66
  - !ruby/object:Gem::Version
61
67
  version: '0'
62
68
  type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - '>='
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
69
  description:
70
70
  email:
71
71
  - robin@wenglewski.de
@@ -82,6 +82,7 @@ files:
82
82
  - Readme.md
83
83
  - lib/pry-rails.rb
84
84
  - lib/pry-rails/commands.rb
85
+ - lib/pry-rails/commands/recognize_path.rb
85
86
  - lib/pry-rails/commands/show_middleware.rb
86
87
  - lib/pry-rails/commands/show_models.rb
87
88
  - lib/pry-rails/commands/show_routes.rb
@@ -94,6 +95,7 @@ files:
94
95
  - spec/config/environment.rb
95
96
  - spec/config/routes.rb
96
97
  - spec/railtie_spec.rb
98
+ - spec/recognize_path_spec.rb
97
99
  - spec/show_middleware_spec.rb
98
100
  - spec/show_models_spec.rb
99
101
  - spec/show_routes_spec.rb
@@ -108,12 +110,12 @@ require_paths:
108
110
  - lib
109
111
  required_ruby_version: !ruby/object:Gem::Requirement
110
112
  requirements:
111
- - - '>='
113
+ - - ! '>='
112
114
  - !ruby/object:Gem::Version
113
115
  version: '0'
114
116
  required_rubygems_version: !ruby/object:Gem::Requirement
115
117
  requirements:
116
- - - '>='
118
+ - - ! '>='
117
119
  - !ruby/object:Gem::Version
118
120
  version: '0'
119
121
  requirements: []
@@ -128,8 +130,8 @@ test_files:
128
130
  - spec/config/environment.rb
129
131
  - spec/config/routes.rb
130
132
  - spec/railtie_spec.rb
133
+ - spec/recognize_path_spec.rb
131
134
  - spec/show_middleware_spec.rb
132
135
  - spec/show_models_spec.rb
133
136
  - spec/show_routes_spec.rb
134
137
  - spec/spec_helper.rb
135
- has_rdoc: