pry 0.9.8pre2-i386-mingw32 → 0.9.8pre3-i386-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +8 -6
- data/lib/pry.rb +5 -4
- data/lib/pry/command.rb +396 -0
- data/lib/pry/command_set.rb +112 -95
- data/lib/pry/default_commands/documentation.rb +153 -82
- data/lib/pry/default_commands/easter_eggs.rb +25 -1
- data/lib/pry/default_commands/input.rb +4 -30
- data/lib/pry/default_commands/introspection.rb +69 -66
- data/lib/pry/default_commands/ls.rb +91 -94
- data/lib/pry/default_commands/shell.rb +1 -1
- data/lib/pry/helpers/base_helpers.rb +7 -2
- data/lib/pry/helpers/command_helpers.rb +29 -4
- data/lib/pry/helpers/options_helpers.rb +6 -40
- data/lib/pry/helpers/text.rb +1 -1
- data/lib/pry/method.rb +42 -4
- data/lib/pry/pry_class.rb +16 -6
- data/lib/pry/pry_instance.rb +15 -7
- data/lib/pry/version.rb +1 -1
- data/lib/pry/wrapped_module.rb +1 -1
- data/pry.gemspec +11 -11
- data/test/helper.rb +8 -12
- data/test/test_command.rb +317 -0
- data/test/test_command_set.rb +152 -18
- data/test/test_completion.rb +1 -1
- data/test/test_default_commands.rb +1 -2
- data/test/test_default_commands/test_introspection.rb +6 -6
- data/test/test_default_commands/test_ls.rb +1 -1
- data/test/test_default_commands/test_shell.rb +4 -2
- data/test/test_hooks.rb +16 -0
- data/test/test_method.rb +50 -0
- data/test/test_pry.rb +37 -39
- data/test/test_syntax_checking.rb +1 -1
- metadata +80 -75
- data/lib/pry/command_context.rb +0 -53
- data/lib/pry/command_processor.rb +0 -194
- data/test/test_command_processor.rb +0 -176
@@ -74,7 +74,7 @@ class Pry
|
|
74
74
|
opt.on :t, :type, "The specific file type for syntax higlighting (e.g ruby, python)", true, :as => Symbol
|
75
75
|
opt.on :f, :flood, "Do not use a pager to view text longer than one screen."
|
76
76
|
opt.on :h, :help, "This message." do
|
77
|
-
output.puts opt
|
77
|
+
output.puts opt.help
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
@@ -91,14 +91,19 @@ class Pry
|
|
91
91
|
27
|
92
92
|
end
|
93
93
|
|
94
|
+
# have fun on the Windows platform.
|
95
|
+
def windows?
|
96
|
+
RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
|
97
|
+
end
|
98
|
+
|
94
99
|
# are we on Jruby platform?
|
95
100
|
def jruby?
|
96
|
-
|
101
|
+
RbConfig::CONFIG['ruby_install_name'] == 'jruby'
|
97
102
|
end
|
98
103
|
|
99
104
|
# are we on rbx platform?
|
100
105
|
def rbx?
|
101
|
-
|
106
|
+
RbConfig::CONFIG['ruby_install_name'] == 'rbx'
|
102
107
|
end
|
103
108
|
|
104
109
|
# a simple pager for systems without `less`. A la windows.
|
@@ -25,7 +25,7 @@ class Pry
|
|
25
25
|
file = Tempfile.new(['pry', '.rb'])
|
26
26
|
yield file
|
27
27
|
ensure
|
28
|
-
file.close
|
28
|
+
file.close(true)
|
29
29
|
end
|
30
30
|
|
31
31
|
def get_method_or_raise(name, target, opts={}, omit_help=false)
|
@@ -160,6 +160,7 @@ class Pry
|
|
160
160
|
end
|
161
161
|
|
162
162
|
def invoke_editor(file, line)
|
163
|
+
raise CommandError, "Please set Pry.config.editor or export $EDITOR" unless Pry.config.editor
|
163
164
|
if Pry.config.editor.respond_to?(:call)
|
164
165
|
editor_invocation = Pry.config.editor.call(file, line)
|
165
166
|
else
|
@@ -179,14 +180,16 @@ class Pry
|
|
179
180
|
# Note we dont want to use Pry.config.system here as that
|
180
181
|
# may be invoked non-interactively (i.e via Open4), whereas we want to
|
181
182
|
# ensure the editor is always interactive
|
182
|
-
system(editor_invocation)
|
183
|
+
system(editor_invocation) or raise CommandError, "`#{editor_invocation}` gave exit status: #{$?.exitstatus}"
|
183
184
|
end
|
184
185
|
end
|
185
186
|
|
186
187
|
# Return the syntax for a given editor for starting the editor
|
187
188
|
# and moving to a particular line within that file
|
188
189
|
def start_line_syntax_for_editor(file_name, line_number)
|
189
|
-
|
190
|
+
if windows?
|
191
|
+
file_name = file_name.gsub(/\//, '\\')
|
192
|
+
end
|
190
193
|
|
191
194
|
# special case for 1st line
|
192
195
|
return file_name if line_number <= 1
|
@@ -201,7 +204,7 @@ class Pry
|
|
201
204
|
when /^jedit/
|
202
205
|
"#{file_name} +line:#{line_number}"
|
203
206
|
else
|
204
|
-
if
|
207
|
+
if windows?
|
205
208
|
"#{file_name}"
|
206
209
|
else
|
207
210
|
"+#{line_number} #{file_name}"
|
@@ -250,6 +253,28 @@ class Pry
|
|
250
253
|
text.gsub(/^#{margin}/, '')
|
251
254
|
end
|
252
255
|
|
256
|
+
def one_index_number(line_number)
|
257
|
+
if line_number > 0
|
258
|
+
line_number - 1
|
259
|
+
else
|
260
|
+
line_number
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
# convert a 1-index range to a 0-indexed one
|
265
|
+
def one_index_range(range)
|
266
|
+
Range.new(one_index_number(range.begin), one_index_number(range.end))
|
267
|
+
end
|
268
|
+
|
269
|
+
def one_index_range_or_number(range_or_number)
|
270
|
+
case range_or_number
|
271
|
+
when Range
|
272
|
+
one_index_range(range_or_number)
|
273
|
+
else
|
274
|
+
one_index_number(range_or_number)
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
253
278
|
def absolute_index_number(line_number, array_length)
|
254
279
|
if line_number >= 0
|
255
280
|
line_number
|
@@ -3,54 +3,20 @@ class Pry
|
|
3
3
|
module OptionsHelpers
|
4
4
|
module_function
|
5
5
|
|
6
|
-
#
|
7
|
-
|
8
|
-
# @param [Array] args The options are stripped out by Slop.
|
9
|
-
# @param [*Symbol] extras Extra features you want returned.
|
10
|
-
# @param [&Block] used to add custom arguments to Slop.
|
11
|
-
#
|
12
|
-
# @option [Extra] :method_object Returns a method object.
|
13
|
-
#
|
14
|
-
# @return Slop::Options iff you don't pass any extras.
|
15
|
-
# @return [Array] If you do pass extras, an array is returned where the first argument is the
|
16
|
-
# Slop::Options object, and the remainder are the extras you requested in order.
|
17
|
-
#
|
18
|
-
def parse_options!(args, *extras, &block)
|
19
|
-
opts = Slop.parse!(args) do |opt|
|
20
|
-
extras.each{ |extra| send(:"add_#{extra}_options", opt) }
|
21
|
-
|
22
|
-
yield opt
|
23
|
-
|
24
|
-
opt.on :h, :help, "This message" do
|
25
|
-
output.puts opt.to_s
|
26
|
-
throw :command_done
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
if extras.empty?
|
31
|
-
opts
|
32
|
-
else
|
33
|
-
[opts] + extras.map{ |extra| send(:"process_#{extra}_options", args, opts) }
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
# Add the method object options to an unused Slop instance.
|
38
|
-
def add_method_object_options(opt)
|
6
|
+
# Add method options to the Slop instance
|
7
|
+
def method_options(opt)
|
39
8
|
@method_target = target
|
40
9
|
opt.on :M, "instance-methods", "Operate on instance methods."
|
41
10
|
opt.on :m, :methods, "Operate on methods."
|
42
|
-
opt.on :s, :super, "Select the 'super' method. Can be repeated to traverse the ancestors."
|
11
|
+
opt.on :s, :super, "Select the 'super' method. Can be repeated to traverse the ancestors.", :as => :count
|
43
12
|
opt.on :c, :context, "Select object context to run under.", true do |context|
|
44
13
|
@method_target = Pry.binding_for(target.eval(context))
|
45
14
|
end
|
46
15
|
end
|
47
16
|
|
48
|
-
#
|
49
|
-
def
|
50
|
-
|
51
|
-
opts.options[:super].force_argument_value opts.options[:super].count if opts.present?(:super)
|
52
|
-
|
53
|
-
get_method_or_raise(args.empty? ? nil : args.join(" "), @method_target,
|
17
|
+
# Get the method object parsed by the slop instance
|
18
|
+
def method_object
|
19
|
+
@method_object ||= get_method_or_raise(args.empty? ? nil : args.join(" "), @method_target,
|
54
20
|
:super => opts[:super],
|
55
21
|
:instance => opts.present?(:'instance-methods') && !opts.present?(:'methods'),
|
56
22
|
:methods => opts.present?(:'methods') && !opts.present?(:'instance-methods')
|
data/lib/pry/helpers/text.rb
CHANGED
data/lib/pry/method.rb
CHANGED
@@ -49,11 +49,43 @@ class Pry
|
|
49
49
|
if [:__script__, nil, :__binding__, :__binding_impl__].include?(meth_name)
|
50
50
|
nil
|
51
51
|
else
|
52
|
-
begin
|
53
|
-
|
54
|
-
|
55
|
-
|
52
|
+
method = begin
|
53
|
+
new(b.eval("method(#{meth_name.to_s.inspect})"))
|
54
|
+
rescue NameError, NoMethodError
|
55
|
+
Disowned.new(b.eval('self'), meth_name.to_s)
|
56
|
+
end
|
57
|
+
|
58
|
+
# it's possible in some cases that the method we find by this approach is a sub-method of
|
59
|
+
# the one we're currently in, consider:
|
60
|
+
#
|
61
|
+
# class A; def b; binding.pry; end; end
|
62
|
+
# class B < A; def b; super; end; end
|
63
|
+
#
|
64
|
+
# Given that we can normally find the source_range of methods, and that we know which
|
65
|
+
# __FILE__ and __LINE__ the binding is at, we can hope to disambiguate these cases.
|
66
|
+
#
|
67
|
+
# This obviously won't work if the source is unavaiable for some reason, or if both
|
68
|
+
# methods have the same __FILE__ and __LINE__, or if we're in rbx where b.eval('__LINE__')
|
69
|
+
# is broken.
|
70
|
+
#
|
71
|
+
guess = method
|
72
|
+
|
73
|
+
while guess
|
74
|
+
# needs rescue if this is a Disowned method or a C method or something...
|
75
|
+
# TODO: Fix up the exception handling so we don't need a bare rescue
|
76
|
+
if (guess.source_file && guess.source_range rescue false) &&
|
77
|
+
File.expand_path(guess.source_file) == File.expand_path(b.eval('__FILE__')) &&
|
78
|
+
guess.source_range.include?(b.eval('__LINE__'))
|
79
|
+
return guess
|
80
|
+
else
|
81
|
+
guess = guess.super
|
82
|
+
end
|
56
83
|
end
|
84
|
+
|
85
|
+
# Uhoh... none of the methods in the chain had the right __FILE__ and __LINE__
|
86
|
+
# This may be caused by rbx https://github.com/rubinius/rubinius/issues/953,
|
87
|
+
# or other unknown circumstances (TODO: we should warn the user when this happens)
|
88
|
+
method
|
57
89
|
end
|
58
90
|
end
|
59
91
|
|
@@ -256,6 +288,12 @@ class Pry
|
|
256
288
|
source_location.nil? ? nil : source_location.last
|
257
289
|
end
|
258
290
|
|
291
|
+
# @return [Range, nil] The range of lines in `source_file` which contain
|
292
|
+
# the method's definition, or `nil` if that information is unavailable.
|
293
|
+
def source_range
|
294
|
+
source_location.nil? ? nil : (source_line)...(source_line + source.lines.count)
|
295
|
+
end
|
296
|
+
|
259
297
|
# @return [Symbol] The visibility of the method. May be `:public`,
|
260
298
|
# `:protected`, or `:private`.
|
261
299
|
def visibility
|
data/lib/pry/pry_class.rb
CHANGED
@@ -116,7 +116,12 @@ class Pry
|
|
116
116
|
pry_instance.backtrace = caller.tap(&:shift)
|
117
117
|
|
118
118
|
# yield the binding_stack to the hook for modification
|
119
|
-
Pry.config.hooks.exec_hook(
|
119
|
+
Pry.config.hooks.exec_hook(
|
120
|
+
:when_started,
|
121
|
+
binding_stack = [target],
|
122
|
+
options,
|
123
|
+
pry_instance
|
124
|
+
)
|
120
125
|
|
121
126
|
head, *tail = binding_stack
|
122
127
|
pry_instance.binding_stack.push(*tail)
|
@@ -192,10 +197,15 @@ class Pry
|
|
192
197
|
end
|
193
198
|
|
194
199
|
def self.default_editor_for_platform
|
195
|
-
if
|
196
|
-
|
200
|
+
return ENV['VISUAL'] if ENV['VISUAL'] and not ENV['VISUAL'].empty?
|
201
|
+
return ENV['EDITOR'] if ENV['EDITOR'] and not ENV['EDITOR'].empty?
|
202
|
+
|
203
|
+
if Helpers::BaseHelpers.windows?
|
204
|
+
'notepad'
|
197
205
|
else
|
198
|
-
|
206
|
+
%w(editor nano vi).detect do |editor|
|
207
|
+
system("which #{editor} > /dev/null 2>&1")
|
208
|
+
end
|
199
209
|
end
|
200
210
|
end
|
201
211
|
|
@@ -210,12 +220,12 @@ class Pry
|
|
210
220
|
config.exception_whitelist = DEFAULT_EXCEPTION_WHITELIST
|
211
221
|
config.hooks = DEFAULT_HOOKS
|
212
222
|
config.input_stack = []
|
213
|
-
config.color =
|
223
|
+
config.color = Helpers::BaseHelpers.use_ansi_codes?
|
214
224
|
config.pager = true
|
215
225
|
config.system = DEFAULT_SYSTEM
|
216
226
|
config.editor = default_editor_for_platform
|
217
227
|
config.should_load_rc = true
|
218
|
-
config.should_trap_interrupts =
|
228
|
+
config.should_trap_interrupts = Helpers::BaseHelpers.jruby?
|
219
229
|
config.disable_auto_reload = false
|
220
230
|
config.command_prefix = ""
|
221
231
|
config.auto_indent = true
|
data/lib/pry/pry_instance.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require "pry/command_processor.rb"
|
2
1
|
require "pry/indent"
|
3
2
|
|
4
3
|
class Pry
|
@@ -37,7 +36,6 @@ class Pry
|
|
37
36
|
def initialize(options={})
|
38
37
|
refresh(options)
|
39
38
|
|
40
|
-
@command_processor = CommandProcessor.new(self)
|
41
39
|
@binding_stack = []
|
42
40
|
@indent = Pry::Indent.new
|
43
41
|
end
|
@@ -59,7 +57,7 @@ class Pry
|
|
59
57
|
end
|
60
58
|
|
61
59
|
defaults.merge!(options).each do |key, value|
|
62
|
-
send
|
60
|
+
send("#{key}=", value) if respond_to?("#{key}=")
|
63
61
|
end
|
64
62
|
|
65
63
|
true
|
@@ -353,7 +351,12 @@ class Pry
|
|
353
351
|
# @param [Binding] target The target of the Pry session.
|
354
352
|
# @return [Boolean] `true` if `val` is a command, `false` otherwise
|
355
353
|
def process_command(val, eval_string, target)
|
356
|
-
result =
|
354
|
+
result = commands.process_line(val, {
|
355
|
+
:target => target,
|
356
|
+
:output => output,
|
357
|
+
:eval_string => eval_string,
|
358
|
+
:pry_instance => self
|
359
|
+
})
|
357
360
|
|
358
361
|
# set a temporary (just so we can inject the value we want into eval_string)
|
359
362
|
Thread.current[:__pry_cmd_result__] = result
|
@@ -378,12 +381,17 @@ class Pry
|
|
378
381
|
# @param [String] val The command (and its params) to execute.
|
379
382
|
# @param [String] eval_string The current input buffer.
|
380
383
|
# @param [Binding] target The binding to use..
|
381
|
-
# @return [Pry::
|
384
|
+
# @return [Pry::Command::VOID_VALUE]
|
382
385
|
# @example
|
383
386
|
# pry_instance.run_command("ls -m")
|
384
387
|
def run_command(val, eval_string = "", target = binding_stack.last)
|
385
|
-
|
386
|
-
|
388
|
+
commands.process_line(val,
|
389
|
+
:eval_string => eval_string,
|
390
|
+
:target => target,
|
391
|
+
:pry_instance => self,
|
392
|
+
:output => output
|
393
|
+
)
|
394
|
+
Pry::Command::VOID_VALUE
|
387
395
|
end
|
388
396
|
|
389
397
|
# Set the last result of an eval.
|
data/lib/pry/version.rb
CHANGED
data/lib/pry/wrapped_module.rb
CHANGED
@@ -54,7 +54,7 @@ class Pry
|
|
54
54
|
def singleton_instance
|
55
55
|
raise ArgumentError, "tried to get instance of non singleton class" unless singleton_class?
|
56
56
|
|
57
|
-
if
|
57
|
+
if Helpers::BaseHelpers.jruby?
|
58
58
|
wrapped.to_java.attached
|
59
59
|
else
|
60
60
|
@singleton_instance ||= ObjectSpace.each_object(wrapped).detect{ |x| (class << x; self; end) == wrapped }
|
data/pry.gemspec
CHANGED
@@ -2,43 +2,43 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "pry"
|
5
|
-
s.version = "0.9.
|
5
|
+
s.version = "0.9.8pre3"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["John Mair (banisterfiend)"]
|
9
|
-
s.date = "
|
9
|
+
s.date = "2012-01-05"
|
10
10
|
s.description = "An IRB alternative and runtime developer console"
|
11
11
|
s.email = "jrmair@gmail.com"
|
12
12
|
s.executables = ["pry"]
|
13
|
-
s.files = [".document", ".gemtest", ".gitignore", ".travis.yml", ".yardopts", "CHANGELOG", "CONTRIBUTORS", "Gemfile", "LICENSE", "README.markdown", "Rakefile", "TODO", "bin/pry", "examples/example_basic.rb", "examples/example_command_override.rb", "examples/example_commands.rb", "examples/example_hooks.rb", "examples/example_image_edit.rb", "examples/example_input.rb", "examples/example_input2.rb", "examples/example_output.rb", "examples/example_print.rb", "examples/example_prompt.rb", "examples/helper.rb", "lib/pry.rb", "lib/pry/cli.rb", "lib/pry/
|
13
|
+
s.files = [".document", ".gemtest", ".gitignore", ".travis.yml", ".yardopts", "CHANGELOG", "CONTRIBUTORS", "Gemfile", "LICENSE", "README.markdown", "Rakefile", "TODO", "bin/pry", "examples/example_basic.rb", "examples/example_command_override.rb", "examples/example_commands.rb", "examples/example_hooks.rb", "examples/example_image_edit.rb", "examples/example_input.rb", "examples/example_input2.rb", "examples/example_output.rb", "examples/example_print.rb", "examples/example_prompt.rb", "examples/helper.rb", "lib/pry.rb", "lib/pry/cli.rb", "lib/pry/command.rb", "lib/pry/command_set.rb", "lib/pry/commands.rb", "lib/pry/completion.rb", "lib/pry/config.rb", "lib/pry/core_extensions.rb", "lib/pry/custom_completions.rb", "lib/pry/default_commands/basic.rb", "lib/pry/default_commands/context.rb", "lib/pry/default_commands/documentation.rb", "lib/pry/default_commands/easter_eggs.rb", "lib/pry/default_commands/gems.rb", "lib/pry/default_commands/input.rb", "lib/pry/default_commands/introspection.rb", "lib/pry/default_commands/ls.rb", "lib/pry/default_commands/shell.rb", "lib/pry/extended_commands/experimental.rb", "lib/pry/extended_commands/user_command_api.rb", "lib/pry/helpers.rb", "lib/pry/helpers/base_helpers.rb", "lib/pry/helpers/command_helpers.rb", "lib/pry/helpers/options_helpers.rb", "lib/pry/helpers/text.rb", "lib/pry/history.rb", "lib/pry/history_array.rb", "lib/pry/hooks.rb", "lib/pry/indent.rb", "lib/pry/method.rb", "lib/pry/plugins.rb", "lib/pry/pry_class.rb", "lib/pry/pry_instance.rb", "lib/pry/rbx_method.rb", "lib/pry/rbx_path.rb", "lib/pry/version.rb", "lib/pry/wrapped_module.rb", "man/pry.1", "man/pry.1.html", "man/pry.1.ronn", "pry.gemspec", "test/helper.rb", "test/test_cli.rb", "test/test_command.rb", "test/test_command_helpers.rb", "test/test_command_set.rb", "test/test_completion.rb", "test/test_default_commands.rb", "test/test_default_commands/test_context.rb", "test/test_default_commands/test_documentation.rb", "test/test_default_commands/test_gems.rb", "test/test_default_commands/test_input.rb", "test/test_default_commands/test_introspection.rb", "test/test_default_commands/test_ls.rb", "test/test_default_commands/test_shell.rb", "test/test_exception_whitelist.rb", "test/test_history_array.rb", "test/test_hooks.rb", "test/test_indent.rb", "test/test_input_stack.rb", "test/test_method.rb", "test/test_pry.rb", "test/test_pry_history.rb", "test/test_pry_output.rb", "test/test_special_locals.rb", "test/test_syntax_checking.rb", "test/test_wrapped_module.rb", "test/testrc", "test/testrcbad", "wiki/Customizing-pry.md", "wiki/Home.md"]
|
14
14
|
s.homepage = "http://pry.github.com"
|
15
15
|
s.require_paths = ["lib"]
|
16
|
-
s.rubygems_version = "1.8.
|
16
|
+
s.rubygems_version = "1.8.11"
|
17
17
|
s.summary = "An IRB alternative and runtime developer console"
|
18
|
-
s.test_files = ["test/helper.rb", "test/test_cli.rb", "test/
|
18
|
+
s.test_files = ["test/helper.rb", "test/test_cli.rb", "test/test_command.rb", "test/test_command_helpers.rb", "test/test_command_set.rb", "test/test_completion.rb", "test/test_default_commands.rb", "test/test_default_commands/test_context.rb", "test/test_default_commands/test_documentation.rb", "test/test_default_commands/test_gems.rb", "test/test_default_commands/test_input.rb", "test/test_default_commands/test_introspection.rb", "test/test_default_commands/test_ls.rb", "test/test_default_commands/test_shell.rb", "test/test_exception_whitelist.rb", "test/test_history_array.rb", "test/test_hooks.rb", "test/test_indent.rb", "test/test_input_stack.rb", "test/test_method.rb", "test/test_pry.rb", "test/test_pry_history.rb", "test/test_pry_output.rb", "test/test_special_locals.rb", "test/test_syntax_checking.rb", "test/test_wrapped_module.rb", "test/testrc", "test/testrcbad"]
|
19
19
|
|
20
20
|
if s.respond_to? :specification_version then
|
21
21
|
s.specification_version = 3
|
22
22
|
|
23
23
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
24
|
-
s.add_runtime_dependency(%q<coderay>, ["~> 0.
|
24
|
+
s.add_runtime_dependency(%q<coderay>, ["~> 1.0.5"])
|
25
25
|
s.add_runtime_dependency(%q<slop>, ["< 3", ">= 2.4.1"])
|
26
|
-
s.add_runtime_dependency(%q<method_source>, ["~> 0.
|
26
|
+
s.add_runtime_dependency(%q<method_source>, ["~> 0.7"])
|
27
27
|
s.add_development_dependency(%q<bacon>, ["~> 1.1"])
|
28
28
|
s.add_development_dependency(%q<open4>, ["~> 1.3"])
|
29
29
|
s.add_development_dependency(%q<rake>, ["~> 0.9"])
|
30
30
|
else
|
31
|
-
s.add_dependency(%q<coderay>, ["~> 0.
|
31
|
+
s.add_dependency(%q<coderay>, ["~> 1.0.5"])
|
32
32
|
s.add_dependency(%q<slop>, ["< 3", ">= 2.4.1"])
|
33
|
-
s.add_dependency(%q<method_source>, ["~> 0.
|
33
|
+
s.add_dependency(%q<method_source>, ["~> 0.7"])
|
34
34
|
s.add_dependency(%q<bacon>, ["~> 1.1"])
|
35
35
|
s.add_dependency(%q<open4>, ["~> 1.3"])
|
36
36
|
s.add_dependency(%q<rake>, ["~> 0.9"])
|
37
37
|
end
|
38
38
|
else
|
39
|
-
s.add_dependency(%q<coderay>, ["~> 0.
|
39
|
+
s.add_dependency(%q<coderay>, ["~> 1.0.5"])
|
40
40
|
s.add_dependency(%q<slop>, ["< 3", ">= 2.4.1"])
|
41
|
-
s.add_dependency(%q<method_source>, ["~> 0.
|
41
|
+
s.add_dependency(%q<method_source>, ["~> 0.7"])
|
42
42
|
s.add_dependency(%q<bacon>, ["~> 1.1"])
|
43
43
|
s.add_dependency(%q<open4>, ["~> 1.3"])
|
44
44
|
s.add_dependency(%q<rake>, ["~> 0.9"])
|
data/test/helper.rb
CHANGED
@@ -49,16 +49,6 @@ class MockPryException
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
# are we on Jruby platform?
|
53
|
-
def jruby?
|
54
|
-
defined?(RUBY_ENGINE) && RUBY_ENGINE =~ /jruby/
|
55
|
-
end
|
56
|
-
|
57
|
-
# are we on rbx platform?
|
58
|
-
def rbx?
|
59
|
-
defined?(RUBY_ENGINE) && RUBY_ENGINE =~ /rbx/
|
60
|
-
end
|
61
|
-
|
62
52
|
Pry.reset_defaults
|
63
53
|
|
64
54
|
# this is to test exception code (cat --ex)
|
@@ -108,6 +98,12 @@ def mock_pry(*args)
|
|
108
98
|
output.string
|
109
99
|
end
|
110
100
|
|
101
|
+
def mock_command(cmd, args=[], opts={})
|
102
|
+
output = StringIO.new
|
103
|
+
ret = cmd.new(opts.merge(:output => output)).call_safely(*args)
|
104
|
+
Struct.new(:output, :return).new(output.string, ret)
|
105
|
+
end
|
106
|
+
|
111
107
|
def redirect_global_pry_input(new_io)
|
112
108
|
old_io = Pry.input
|
113
109
|
Pry.input = new_io
|
@@ -167,7 +163,7 @@ def temp_file
|
|
167
163
|
file = Tempfile.new('pry')
|
168
164
|
yield file
|
169
165
|
ensure
|
170
|
-
file.close
|
166
|
+
file.close(true)
|
171
167
|
end
|
172
168
|
|
173
169
|
|
@@ -183,7 +179,7 @@ end
|
|
183
179
|
|
184
180
|
# to help with tracking down bugs that cause an infinite loop in the test suite
|
185
181
|
if ENV["SET_TRACE_FUNC"]
|
186
|
-
require 'set_trace' if
|
182
|
+
require 'set_trace' if Pry::Helpers::BaseHelpers.rbx?
|
187
183
|
set_trace_func proc { |event, file, line, id, binding, classname|
|
188
184
|
STDERR.printf "%8s %s:%-2d %10s %8s\n", event, file, line, id, classname
|
189
185
|
}
|