pry 0.9.7.4-i386-mswin32 → 0.9.8-i386-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. data/.gitignore +2 -3
  2. data/CHANGELOG +43 -0
  3. data/README.markdown +3 -1
  4. data/Rakefile +51 -32
  5. data/bin/pry +2 -80
  6. data/lib/pry.rb +33 -26
  7. data/lib/pry/cli.rb +152 -0
  8. data/lib/pry/code.rb +351 -0
  9. data/lib/pry/command.rb +422 -0
  10. data/lib/pry/command_set.rb +259 -129
  11. data/lib/pry/commands.rb +0 -1
  12. data/lib/pry/config.rb +43 -9
  13. data/lib/pry/default_commands/context.rb +109 -92
  14. data/lib/pry/default_commands/documentation.rb +174 -63
  15. data/lib/pry/default_commands/easter_eggs.rb +26 -2
  16. data/lib/pry/default_commands/gems.rb +65 -37
  17. data/lib/pry/default_commands/input.rb +175 -243
  18. data/lib/pry/default_commands/introspection.rb +173 -112
  19. data/lib/pry/default_commands/ls.rb +96 -114
  20. data/lib/pry/default_commands/shell.rb +175 -70
  21. data/lib/pry/helpers/base_helpers.rb +7 -2
  22. data/lib/pry/helpers/command_helpers.rb +71 -77
  23. data/lib/pry/helpers/options_helpers.rb +10 -41
  24. data/lib/pry/helpers/text.rb +24 -4
  25. data/lib/pry/history.rb +55 -17
  26. data/lib/pry/history_array.rb +2 -0
  27. data/lib/pry/hooks.rb +252 -0
  28. data/lib/pry/indent.rb +9 -5
  29. data/lib/pry/method.rb +149 -50
  30. data/lib/pry/plugins.rb +12 -4
  31. data/lib/pry/pry_class.rb +69 -26
  32. data/lib/pry/pry_instance.rb +187 -115
  33. data/lib/pry/version.rb +1 -1
  34. data/lib/pry/wrapped_module.rb +73 -0
  35. data/man/pry.1 +195 -0
  36. data/man/pry.1.html +204 -0
  37. data/man/pry.1.ronn +141 -0
  38. data/pry.gemspec +29 -32
  39. data/test/helper.rb +32 -36
  40. data/test/test_cli.rb +78 -0
  41. data/test/test_code.rb +201 -0
  42. data/test/test_command.rb +327 -0
  43. data/test/test_command_integration.rb +512 -0
  44. data/test/test_command_set.rb +338 -12
  45. data/test/test_completion.rb +1 -1
  46. data/test/test_default_commands.rb +1 -2
  47. data/test/test_default_commands/test_context.rb +27 -5
  48. data/test/test_default_commands/test_documentation.rb +20 -8
  49. data/test/test_default_commands/test_input.rb +84 -45
  50. data/test/test_default_commands/test_introspection.rb +74 -17
  51. data/test/test_default_commands/test_ls.rb +9 -36
  52. data/test/test_default_commands/test_shell.rb +240 -13
  53. data/test/test_hooks.rb +490 -0
  54. data/test/test_indent.rb +2 -0
  55. data/test/test_method.rb +60 -0
  56. data/test/test_pry.rb +29 -904
  57. data/test/test_pry_defaults.rb +380 -0
  58. data/test/test_pry_history.rb +24 -24
  59. data/test/test_syntax_checking.rb +63 -0
  60. data/test/test_wrapped_module.rb +71 -0
  61. metadata +50 -39
  62. data/lib/pry/command_context.rb +0 -53
  63. data/lib/pry/command_processor.rb +0 -181
  64. data/lib/pry/extended_commands/user_command_api.rb +0 -65
  65. data/test/test_command_processor.rb +0 -176
@@ -0,0 +1,63 @@
1
+ require 'helper'
2
+ describe Pry do
3
+
4
+ [
5
+ ["p = '", "'"],
6
+ ["def", "a", "(); end"],
7
+ ["p = <<FOO", "lots", "and", "lots of", "foo", "FOO"],
8
+ ["[", ":lets,", "'list',", "[/nested/", "], things ]"],
9
+ ["abc =~ /hello", "/"],
10
+ ["issue = %W/", "343/"],
11
+ ["pouts(<<HI, 'foo", "bar", "HI", "baz')"],
12
+ ].each do |foo|
13
+ it "should not raise an error on broken lines: #{foo.join("\\n")}" do
14
+ output = StringIO.new
15
+ redirect_pry_io(InputTester.new(*foo), output) do
16
+ Pry.start
17
+ end
18
+
19
+ output.string.should.not =~ /SyntaxError/
20
+ end
21
+ end
22
+
23
+ [
24
+ ["end"],
25
+ ["puts )("],
26
+ ["1 1"],
27
+ ["puts :"],
28
+ # in this case the syntax error is "expecting ')'".
29
+ (Pry::Helpers::BaseHelpers.rbx? ? nil : ["def", "method(1"])
30
+ ].compact.each do |foo|
31
+ it "should raise an error on invalid syntax like #{foo.inspect}" do
32
+ output = StringIO.new
33
+ redirect_pry_io(InputTester.new(*foo), output) do
34
+ Pry.start
35
+ end
36
+ output.string.should =~ /SyntaxError/
37
+ end
38
+ end
39
+
40
+ it "should not intefere with syntax errors explicitly raised" do
41
+ output = StringIO.new
42
+ redirect_pry_io(InputTester.new(%q{raise SyntaxError, "unexpected $end"}), output) do
43
+ Pry.start
44
+ end
45
+ output.string.should =~ /SyntaxError/
46
+ end
47
+
48
+ it "should allow trailing , to continue the line" do
49
+ pry = Pry.new
50
+
51
+ pry.complete_expression?("puts 1, 2,").should == false
52
+ end
53
+
54
+ it "should complete an expression that contains a line ending with a ," do
55
+ pry = Pry.new
56
+ pry.complete_expression?("puts 1, 2,\n3").should == true
57
+ end
58
+
59
+ it "should not clobber _ex_ on a SyntaxError in the repl" do
60
+
61
+ mock_pry("raise RuntimeError, 'foo';", "puts foo)", "_ex_.is_a?(RuntimeError)").should =~ /^RuntimeError.*\nSyntaxError.*\n=> true/m
62
+ end
63
+ end
@@ -0,0 +1,71 @@
1
+ require 'helper'
2
+
3
+ describe Pry::WrappedModule do
4
+
5
+ describe "#initialize" do
6
+ it "should raise an exception when a non-module is passed" do
7
+ lambda{ Pry::WrappedModule.new(nil) }.should.raise ArgumentError
8
+ end
9
+ end
10
+
11
+ describe ".method_prefix" do
12
+ before do
13
+ Foo = Class.new
14
+ @foo = Foo.new
15
+ end
16
+
17
+ after do
18
+ Object.remove_const(:Foo)
19
+ end
20
+
21
+ it "should return Foo# for normal classes" do
22
+ Pry::WrappedModule.new(Foo).method_prefix.should == "Foo#"
23
+ end
24
+
25
+ it "should return Bar# for modules" do
26
+ Pry::WrappedModule.new(Kernel).method_prefix.should == "Kernel#"
27
+ end
28
+
29
+ it "should return Foo. for singleton classes of classes" do
30
+ Pry::WrappedModule.new(class << Foo; self; end).method_prefix.should == "Foo."
31
+ end
32
+
33
+ describe "of singleton classes of objects" do
34
+ Pry::WrappedModule.new(class << @foo; self; end).method_prefix.should == "self."
35
+ end
36
+
37
+ describe "of anonymous classes should not be empty" do
38
+ Pry::WrappedModule.new(Class.new).method_prefix.should =~ /#<Class:.*>#/
39
+ end
40
+
41
+ describe "of singleton classes of anonymous classes should not be empty" do
42
+ Pry::WrappedModule.new(class << Class.new; self; end).method_prefix.should =~ /#<Class:.*>./
43
+ end
44
+ end
45
+
46
+ describe ".singleton_class?" do
47
+ it "should be true for singleton classes" do
48
+ Pry::WrappedModule.new(class << ""; self; end).singleton_class?.should == true
49
+ end
50
+
51
+ it "should be false for normal classes" do
52
+ Pry::WrappedModule.new(Class.new).singleton_class?.should == false
53
+ end
54
+
55
+ it "should be false for modules" do
56
+ Pry::WrappedModule.new(Module.new).singleton_class?.should == false
57
+ end
58
+ end
59
+
60
+ describe ".singleton_instance" do
61
+ it "should raise an exception when called on a non-singleton-class" do
62
+ lambda{ Pry::WrappedModule.new(Class).singleton_instance }.should.raise ArgumentError
63
+ end
64
+
65
+ it "should return the attached object" do
66
+ Pry::WrappedModule.new(class << "hi"; self; end).singleton_instance.should == "hi"
67
+ Pry::WrappedModule.new(class << Object; self; end).singleton_instance.should.equal?(Object)
68
+ end
69
+ end
70
+ end
71
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.7.4
4
+ version: 0.9.8
5
5
  prerelease:
6
6
  platform: i386-mswin32
7
7
  authors:
@@ -9,77 +9,69 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-05 00:00:00.000000000 Z
12
+ date: 2012-01-25 00:00:00.000000000 Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: ruby_parser
16
- requirement: &70358292170640 !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: 2.3.1
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: *70358292170640
25
14
  - !ruby/object:Gem::Dependency
26
15
  name: coderay
27
- requirement: &70358292170040 !ruby/object:Gem::Requirement
16
+ requirement: &70335748746720 !ruby/object:Gem::Requirement
28
17
  none: false
29
18
  requirements:
30
19
  - - ~>
31
20
  - !ruby/object:Gem::Version
32
- version: 0.9.8
21
+ version: 1.0.5
33
22
  type: :runtime
34
23
  prerelease: false
35
- version_requirements: *70358292170040
24
+ version_requirements: *70335748746720
36
25
  - !ruby/object:Gem::Dependency
37
26
  name: slop
38
- requirement: &70358292169500 !ruby/object:Gem::Requirement
27
+ requirement: &70335748746220 !ruby/object:Gem::Requirement
39
28
  none: false
40
29
  requirements:
41
- - - ~>
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: 2.4.3
33
+ - - <
42
34
  - !ruby/object:Gem::Version
43
- version: 2.1.0
35
+ version: '3'
44
36
  type: :runtime
45
37
  prerelease: false
46
- version_requirements: *70358292169500
38
+ version_requirements: *70335748746220
47
39
  - !ruby/object:Gem::Dependency
48
40
  name: method_source
49
- requirement: &70358292168680 !ruby/object:Gem::Requirement
41
+ requirement: &70335748789540 !ruby/object:Gem::Requirement
50
42
  none: false
51
43
  requirements:
52
44
  - - ~>
53
45
  - !ruby/object:Gem::Version
54
- version: 0.6.7
46
+ version: '0.7'
55
47
  type: :runtime
56
48
  prerelease: false
57
- version_requirements: *70358292168680
49
+ version_requirements: *70335748789540
58
50
  - !ruby/object:Gem::Dependency
59
51
  name: bacon
60
- requirement: &70358292167840 !ruby/object:Gem::Requirement
52
+ requirement: &70335748789060 !ruby/object:Gem::Requirement
61
53
  none: false
62
54
  requirements:
63
55
  - - ~>
64
56
  - !ruby/object:Gem::Version
65
- version: 1.1.0
57
+ version: '1.1'
66
58
  type: :development
67
59
  prerelease: false
68
- version_requirements: *70358292167840
60
+ version_requirements: *70335748789060
69
61
  - !ruby/object:Gem::Dependency
70
62
  name: open4
71
- requirement: &70358292166340 !ruby/object:Gem::Requirement
63
+ requirement: &70335748788520 !ruby/object:Gem::Requirement
72
64
  none: false
73
65
  requirements:
74
66
  - - ~>
75
67
  - !ruby/object:Gem::Version
76
- version: 1.0.1
68
+ version: '1.3'
77
69
  type: :development
78
70
  prerelease: false
79
- version_requirements: *70358292166340
71
+ version_requirements: *70335748788520
80
72
  - !ruby/object:Gem::Dependency
81
73
  name: rake
82
- requirement: &70358292165400 !ruby/object:Gem::Requirement
74
+ requirement: &70335748788060 !ruby/object:Gem::Requirement
83
75
  none: false
84
76
  requirements:
85
77
  - - ~>
@@ -87,18 +79,18 @@ dependencies:
87
79
  version: '0.9'
88
80
  type: :development
89
81
  prerelease: false
90
- version_requirements: *70358292165400
82
+ version_requirements: *70335748788060
91
83
  - !ruby/object:Gem::Dependency
92
84
  name: win32console
93
- requirement: &70358292164780 !ruby/object:Gem::Requirement
85
+ requirement: &70335748787600 !ruby/object:Gem::Requirement
94
86
  none: false
95
87
  requirements:
96
88
  - - ~>
97
89
  - !ruby/object:Gem::Version
98
- version: 1.3.0
90
+ version: '1.3'
99
91
  type: :runtime
100
92
  prerelease: false
101
- version_requirements: *70358292164780
93
+ version_requirements: *70335748787600
102
94
  description: An IRB alternative and runtime developer console
103
95
  email: jrmair@gmail.com
104
96
  executables:
@@ -131,8 +123,9 @@ files:
131
123
  - examples/example_prompt.rb
132
124
  - examples/helper.rb
133
125
  - lib/pry.rb
134
- - lib/pry/command_context.rb
135
- - lib/pry/command_processor.rb
126
+ - lib/pry/cli.rb
127
+ - lib/pry/code.rb
128
+ - lib/pry/command.rb
136
129
  - lib/pry/command_set.rb
137
130
  - lib/pry/commands.rb
138
131
  - lib/pry/completion.rb
@@ -149,7 +142,6 @@ files:
149
142
  - lib/pry/default_commands/ls.rb
150
143
  - lib/pry/default_commands/shell.rb
151
144
  - lib/pry/extended_commands/experimental.rb
152
- - lib/pry/extended_commands/user_command_api.rb
153
145
  - lib/pry/helpers.rb
154
146
  - lib/pry/helpers/base_helpers.rb
155
147
  - lib/pry/helpers/command_helpers.rb
@@ -157,6 +149,7 @@ files:
157
149
  - lib/pry/helpers/text.rb
158
150
  - lib/pry/history.rb
159
151
  - lib/pry/history_array.rb
152
+ - lib/pry/hooks.rb
160
153
  - lib/pry/indent.rb
161
154
  - lib/pry/method.rb
162
155
  - lib/pry/plugins.rb
@@ -165,10 +158,17 @@ files:
165
158
  - lib/pry/rbx_method.rb
166
159
  - lib/pry/rbx_path.rb
167
160
  - lib/pry/version.rb
161
+ - lib/pry/wrapped_module.rb
162
+ - man/pry.1
163
+ - man/pry.1.html
164
+ - man/pry.1.ronn
168
165
  - pry.gemspec
169
166
  - test/helper.rb
167
+ - test/test_cli.rb
168
+ - test/test_code.rb
169
+ - test/test_command.rb
170
170
  - test/test_command_helpers.rb
171
- - test/test_command_processor.rb
171
+ - test/test_command_integration.rb
172
172
  - test/test_command_set.rb
173
173
  - test/test_completion.rb
174
174
  - test/test_default_commands.rb
@@ -181,13 +181,17 @@ files:
181
181
  - test/test_default_commands/test_shell.rb
182
182
  - test/test_exception_whitelist.rb
183
183
  - test/test_history_array.rb
184
+ - test/test_hooks.rb
184
185
  - test/test_indent.rb
185
186
  - test/test_input_stack.rb
186
187
  - test/test_method.rb
187
188
  - test/test_pry.rb
189
+ - test/test_pry_defaults.rb
188
190
  - test/test_pry_history.rb
189
191
  - test/test_pry_output.rb
190
192
  - test/test_special_locals.rb
193
+ - test/test_syntax_checking.rb
194
+ - test/test_wrapped_module.rb
191
195
  - test/testrc
192
196
  - test/testrcbad
193
197
  - wiki/Customizing-pry.md
@@ -218,8 +222,11 @@ specification_version: 3
218
222
  summary: An IRB alternative and runtime developer console
219
223
  test_files:
220
224
  - test/helper.rb
225
+ - test/test_cli.rb
226
+ - test/test_code.rb
227
+ - test/test_command.rb
221
228
  - test/test_command_helpers.rb
222
- - test/test_command_processor.rb
229
+ - test/test_command_integration.rb
223
230
  - test/test_command_set.rb
224
231
  - test/test_completion.rb
225
232
  - test/test_default_commands.rb
@@ -232,12 +239,16 @@ test_files:
232
239
  - test/test_default_commands/test_shell.rb
233
240
  - test/test_exception_whitelist.rb
234
241
  - test/test_history_array.rb
242
+ - test/test_hooks.rb
235
243
  - test/test_indent.rb
236
244
  - test/test_input_stack.rb
237
245
  - test/test_method.rb
238
246
  - test/test_pry.rb
247
+ - test/test_pry_defaults.rb
239
248
  - test/test_pry_history.rb
240
249
  - test/test_pry_output.rb
241
250
  - test/test_special_locals.rb
251
+ - test/test_syntax_checking.rb
252
+ - test/test_wrapped_module.rb
242
253
  - test/testrc
243
254
  - test/testrcbad
@@ -1,53 +0,0 @@
1
- class Pry
2
- # Command contexts are the objects runing each command.
3
- # Helper modules can be mixed into this class.
4
- class CommandContext
5
-
6
- # represents a void return value for a command
7
- VOID_VALUE = Object.new
8
-
9
- # give it a nice inspect
10
- def VOID_VALUE.inspect() "void" end
11
-
12
- attr_accessor :command_name
13
- attr_accessor :output
14
- attr_accessor :target
15
- attr_accessor :target_self
16
- attr_accessor :captures
17
- attr_accessor :eval_string
18
- attr_accessor :arg_string
19
- attr_accessor :opts
20
- attr_accessor :command_set
21
- attr_accessor :command_processor
22
- attr_accessor :_pry_
23
-
24
- # Run a command from another command.
25
- # @param [String] command_string The string that invokes the command
26
- # @param [Array] args Further arguments to pass to the command
27
- # @example
28
- # run "show-input"
29
- # @example
30
- # run ".ls"
31
- # @example
32
- # run "amend-line", "5", 'puts "hello world"'
33
- def run(command_string, *args)
34
- complete_string = "#{command_string} #{args.join(" ")}"
35
- command_processor.process_commands(complete_string, eval_string, target)
36
- end
37
-
38
- def commands
39
- command_set.commands
40
- end
41
-
42
- def text
43
- Pry::Helpers::Text
44
- end
45
-
46
- def void
47
- VOID_VALUE
48
- end
49
-
50
- include Pry::Helpers::BaseHelpers
51
- include Pry::Helpers::CommandHelpers
52
- end
53
- end
@@ -1,181 +0,0 @@
1
- require 'forwardable'
2
-
3
- class Pry
4
- class CommandProcessor
5
-
6
- # Wraps the return result of process_commands, indicates if the
7
- # result IS a command and what kind of command (e.g void)
8
- class Result
9
- attr_reader :retval
10
-
11
- def initialize(is_command, keep_retval = false, retval = nil)
12
- @is_command, @keep_retval, @retval = is_command, keep_retval, retval
13
- end
14
-
15
- # Is the result a command?
16
- # @return [Boolean]
17
- def command?
18
- @is_command
19
- end
20
-
21
- # Is the result a command and if it is, is it a void command?
22
- # (one that does not return a value)
23
- # @return [Boolean]
24
- def void_command?
25
- (command? && !keep_retval?) || retval == CommandContext::VOID_VALUE
26
- end
27
-
28
- # Is the return value kept for this command? (i.e :keep_retval => true)
29
- # @return [Boolean]
30
- def keep_retval?
31
- @keep_retval
32
- end
33
- end
34
-
35
- extend Forwardable
36
-
37
- attr_accessor :pry_instance
38
-
39
- def initialize(pry_instance)
40
- @pry_instance = pry_instance
41
- end
42
-
43
- def_delegators :@pry_instance, :commands, :output
44
-
45
- # Is the string a valid command?
46
- # @param [String] val The string passed in from the Pry prompt.
47
- # @param [Binding] target The context where the string should be
48
- # interpolated in.
49
- # @return [Boolean] Whether the string is a valid command.
50
- def valid_command?(val, target=binding)
51
- !!(command_matched(val, target)[0])
52
- end
53
-
54
- # Convert the object to a form that can be interpolated into a
55
- # Regexp cleanly.
56
- # @return [String] The string to interpolate into a Regexp
57
- def convert_to_regex(obj)
58
- case obj
59
- when String
60
- Regexp.escape(obj)
61
- else
62
- obj
63
- end
64
- end
65
-
66
- # Revaluate the string (str) and perform interpolation.
67
- # @param [String] str The string to reevaluate with interpolation.
68
- # @param [Binding] target The context where the string should be
69
- # interpolated in.
70
- # @return [String] The reevaluated string with interpolations
71
- # applied (if any).
72
- def interpolate_string(str, target)
73
- dumped_str = str.dump
74
- dumped_str.gsub!(/\\\#\{/, '#{')
75
- target.eval(dumped_str)
76
- end
77
-
78
- # Determine whether a Pry command was matched and return command data
79
- # and argument string.
80
- # This method should not need to be invoked directly.
81
- # @param [String] val The line of input.
82
- # @param [Binding] target The binding to perform string
83
- # interpolation against.
84
- # @return [Array] The command data and arg string pair
85
- def command_matched(val, target)
86
- _, cmd_data = commands.commands.find do |name, data|
87
- prefix = convert_to_regex(Pry.config.command_prefix)
88
- prefix = "(?:#{prefix})?" unless data.options[:use_prefix]
89
-
90
- command_regex = /^#{prefix}#{convert_to_regex(name)}(?!\S)/
91
-
92
- if command_regex =~ val
93
- if data.options[:interpolate]
94
- val.replace(interpolate_string(val, target))
95
- command_regex =~ val # re-match with the interpolated string
96
- end
97
- true
98
- end
99
- end
100
-
101
- [cmd_data, (Regexp.last_match ? Regexp.last_match.captures : nil), (Regexp.last_match ? Regexp.last_match.end(0) : nil)]
102
- end
103
-
104
- # Process Pry commands. Pry commands are not Ruby methods and are evaluated
105
- # prior to Ruby expressions.
106
- # Commands can be modified/configured by the user: see `Pry::Commands`
107
- # This method should not need to be invoked directly - it is called
108
- # by `Pry#r`.
109
- # @param [String] val The current line of input.
110
- # @param [String] eval_string The cumulative lines of input for
111
- # multi-line input.
112
- # @param [Binding] target The receiver of the commands.
113
- # @return [Pry::CommandProcessor::Result] A wrapper object
114
- # containing info about the result of the command processing
115
- # (indicating whether it is a command and if it is what kind of
116
- # command it is.
117
- def process_commands(val, eval_string, target)
118
-
119
- command, captures, pos = command_matched(val, target)
120
-
121
- # no command was matched, so return to caller
122
- return Result.new(false) if !command
123
-
124
- arg_string = val[pos..-1]
125
-
126
- # remove the one leading space if it exists
127
- arg_string.slice!(0) if arg_string.start_with?(" ")
128
-
129
- if arg_string
130
- args = command.options[:shellwords] ? Shellwords.shellwords(arg_string) : arg_string.split(" ")
131
- else
132
- args = []
133
- end
134
-
135
- options = {
136
- :val => val,
137
- :arg_string => arg_string,
138
- :eval_string => eval_string,
139
- :commands => commands.commands,
140
- :captures => captures
141
- }
142
-
143
- ret = execute_command(target, command.name, options, *(captures + args))
144
-
145
- Result.new(true, command.options[:keep_retval], ret)
146
- end
147
-
148
- # Execute a Pry command.
149
- # This method should not need to be invoked directly.
150
- # @param [Binding] target The target of the Pry session.
151
- # @param [String] command The name of the command to be run.
152
- # @param [Hash] options The options to set on the Commands object.
153
- # @param [Array] args The command arguments.
154
- # @return [Object] The value returned by the command
155
- def execute_command(target, command, options, *args)
156
- context = CommandContext.new
157
-
158
- # set some useful methods to be used by the action blocks
159
- context.opts = options
160
- context.target = target
161
- context.target_self = target.eval('self')
162
- context.output = output
163
- context.captures = options[:captures]
164
- context.eval_string = options[:eval_string]
165
- context.arg_string = options[:arg_string]
166
- context.command_set = commands
167
- context._pry_ = @pry_instance
168
-
169
- context.command_processor = self
170
-
171
- ret = nil
172
- catch(:command_done) do
173
- ret = commands.run_command(context, command, *args)
174
- end
175
-
176
- options[:val].replace("")
177
-
178
- ret
179
- end
180
- end
181
- end