pry 0.9.3pre1-i386-mingw32 → 0.9.4-i386-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +53 -0
- data/CONTRIBUTORS +13 -0
- data/README.markdown +4 -2
- data/Rakefile +17 -3
- data/TODO +22 -0
- data/lib/pry.rb +102 -24
- data/lib/pry/command_context.rb +12 -0
- data/lib/pry/command_processor.rb +50 -19
- data/lib/pry/command_set.rb +17 -7
- data/lib/pry/completion.rb +6 -6
- data/lib/pry/config.rb +6 -2
- data/lib/pry/default_commands/basic.rb +8 -4
- data/lib/pry/default_commands/context.rb +84 -36
- data/lib/pry/default_commands/documentation.rb +50 -30
- data/lib/pry/default_commands/easter_eggs.rb +5 -0
- data/lib/pry/default_commands/input.rb +20 -16
- data/lib/pry/default_commands/introspection.rb +61 -77
- data/lib/pry/default_commands/ls.rb +22 -14
- data/lib/pry/default_commands/shell.rb +32 -17
- data/lib/pry/extended_commands/user_command_api.rb +32 -1
- data/lib/pry/helpers/base_helpers.rb +21 -9
- data/lib/pry/helpers/command_helpers.rb +99 -17
- data/lib/pry/helpers/text.rb +12 -11
- data/lib/pry/history.rb +61 -0
- data/lib/pry/plugins.rb +19 -8
- data/lib/pry/pry_class.rb +49 -60
- data/lib/pry/pry_instance.rb +122 -119
- data/lib/pry/version.rb +1 -1
- data/pry.gemspec +15 -14
- data/test/helper.rb +31 -0
- data/test/test_command_processor.rb +8 -87
- data/test/test_command_set.rb +40 -2
- data/test/test_completion.rb +26 -0
- data/test/test_default_commands/test_context.rb +185 -1
- data/test/test_default_commands/test_documentation.rb +10 -0
- data/test/test_default_commands/test_input.rb +39 -13
- data/test/test_default_commands/test_introspection.rb +11 -1
- data/test/test_default_commands/test_shell.rb +18 -0
- data/test/test_pry.rb +217 -47
- data/test/test_pry_history.rb +84 -0
- data/test/test_pry_output.rb +44 -0
- data/test/test_special_locals.rb +35 -0
- metadata +83 -77
data/lib/pry/pry_instance.rb
CHANGED
@@ -10,10 +10,15 @@ class Pry
|
|
10
10
|
attr_accessor :hooks
|
11
11
|
attr_accessor :custom_completions
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
attr_accessor :
|
13
|
+
attr_accessor :binding_stack
|
14
|
+
|
15
|
+
attr_accessor :last_result
|
16
|
+
attr_accessor :last_exception
|
17
|
+
attr_accessor :last_file
|
18
|
+
attr_accessor :last_dir
|
19
|
+
|
20
|
+
attr_reader :input_array
|
21
|
+
attr_reader :output_array
|
17
22
|
|
18
23
|
# Create a new `Pry` object.
|
19
24
|
# @param [Hash] options The optional configuration parameters.
|
@@ -28,6 +33,7 @@ class Pry
|
|
28
33
|
refresh(options)
|
29
34
|
|
30
35
|
@command_processor = CommandProcessor.new(self)
|
36
|
+
@binding_stack = []
|
31
37
|
end
|
32
38
|
|
33
39
|
# Refresh the Pry instance settings from the Pry class.
|
@@ -73,6 +79,18 @@ class Pry
|
|
73
79
|
end
|
74
80
|
end
|
75
81
|
|
82
|
+
# Injects a local variable into the provided binding.
|
83
|
+
# @param [String] name The name of the local to inject.
|
84
|
+
# @param [Object] value The value to set the local to.
|
85
|
+
# @param [Binding] b The binding to set the local on.
|
86
|
+
# @return [Object] The value the local was set to.
|
87
|
+
def inject_local(name, value, b)
|
88
|
+
Thread.current[:__pry_local__] = value
|
89
|
+
b.eval("#{name} = Thread.current[:__pry_local__]")
|
90
|
+
ensure
|
91
|
+
Thread.current[:__pry_local__] = nil
|
92
|
+
end
|
93
|
+
|
76
94
|
# @return [Integer] The maximum amount of objects remembered by the inp and
|
77
95
|
# out arrays. Defaults to 100.
|
78
96
|
def memory_size
|
@@ -84,32 +102,6 @@ class Pry
|
|
84
102
|
@output_array = Pry::HistoryArray.new(size)
|
85
103
|
end
|
86
104
|
|
87
|
-
# Get nesting data.
|
88
|
-
# This method should not need to be accessed directly.
|
89
|
-
# @return [Array] The unparsed nesting information.
|
90
|
-
def nesting
|
91
|
-
self.class.nesting
|
92
|
-
end
|
93
|
-
|
94
|
-
# Set nesting data.
|
95
|
-
# This method should not need to be accessed directly.
|
96
|
-
# @param v nesting data.
|
97
|
-
def nesting=(v)
|
98
|
-
self.class.nesting = v
|
99
|
-
end
|
100
|
-
|
101
|
-
# @return [Boolean] Whether top-level session has ended.
|
102
|
-
def finished_top_level_session?
|
103
|
-
nesting.empty?
|
104
|
-
end
|
105
|
-
|
106
|
-
# Return parent of current Pry session.
|
107
|
-
# @return [Pry] The parent of the current Pry session.
|
108
|
-
def parent
|
109
|
-
idx = Pry.sessions.index(self)
|
110
|
-
Pry.sessions[idx - 1] if idx && idx > 0
|
111
|
-
end
|
112
|
-
|
113
105
|
# Execute the hook `hook_name`, if it is defined.
|
114
106
|
# @param [Symbol] hook_name The hook to execute
|
115
107
|
# @param [Array] args The arguments to pass to the hook.
|
@@ -117,41 +109,53 @@ class Pry
|
|
117
109
|
hooks[hook_name].call(*args, &block) if hooks[hook_name]
|
118
110
|
end
|
119
111
|
|
112
|
+
# Make sure special locals exist at start of session
|
113
|
+
def initialize_special_locals(target)
|
114
|
+
inject_local("_in_", @input_array, target)
|
115
|
+
inject_local("_out_", @output_array, target)
|
116
|
+
inject_local("_pry_", self, target)
|
117
|
+
inject_local("_ex_", nil, target)
|
118
|
+
inject_local("_file_", nil, target)
|
119
|
+
inject_local("_dir_", nil, target)
|
120
|
+
|
121
|
+
# without this line we get 1 test failure, ask Mon_Ouie
|
122
|
+
set_last_result(nil, target)
|
123
|
+
inject_local("_", nil, target)
|
124
|
+
end
|
125
|
+
private :initialize_special_locals
|
126
|
+
|
127
|
+
def inject_special_locals(target)
|
128
|
+
inject_local("_in_", @input_array, target)
|
129
|
+
inject_local("_out_", @output_array, target)
|
130
|
+
inject_local("_pry_", self, target)
|
131
|
+
inject_local("_ex_", self.last_exception, target)
|
132
|
+
inject_local("_file_", self.last_file, target)
|
133
|
+
inject_local("_dir_", self.last_dir, target)
|
134
|
+
inject_local("_", self.last_result, target)
|
135
|
+
end
|
136
|
+
|
120
137
|
# Initialize the repl session.
|
121
138
|
# @param [Binding] target The target binding for the session.
|
122
139
|
def repl_prologue(target)
|
123
|
-
exec_hook :before_session, output, target
|
124
|
-
|
140
|
+
exec_hook :before_session, output, target, self
|
141
|
+
initialize_special_locals(target)
|
125
142
|
|
126
|
-
# Make sure special locals exist
|
127
|
-
target.eval("inp = ::Pry.active_instance.instance_eval { @input_array }")
|
128
|
-
target.eval("out = ::Pry.active_instance.instance_eval { @output_array }")
|
129
|
-
|
130
|
-
set_active_instance(target)
|
131
143
|
@input_array << nil # add empty input so inp and out match
|
132
|
-
set_last_result(Pry.last_result, target)
|
133
144
|
|
134
|
-
|
145
|
+
Pry.active_sessions += 1
|
146
|
+
binding_stack.push target
|
135
147
|
end
|
136
148
|
|
137
149
|
# Clean-up after the repl session.
|
138
150
|
# @param [Binding] target The target binding for the session.
|
139
151
|
# @return [Object] The return value of the repl session (if one exists).
|
140
|
-
def repl_epilogue(target,
|
141
|
-
|
142
|
-
exec_hook :after_session, output, target
|
143
|
-
|
144
|
-
# If break_data is an array, then the last element is the return value
|
145
|
-
break_level, return_value = Array(break_data)
|
146
|
-
|
147
|
-
# keep throwing until we reach the desired nesting level
|
148
|
-
if nesting_level != break_level
|
149
|
-
throw :breakout, break_data
|
150
|
-
end
|
151
|
-
|
152
|
-
save_history if Pry.config.history.should_save && finished_top_level_session?
|
152
|
+
def repl_epilogue(target, break_data)
|
153
|
+
exec_hook :after_session, output, target, self
|
153
154
|
|
154
|
-
|
155
|
+
Pry.active_sessions -= 1
|
156
|
+
binding_stack.pop
|
157
|
+
Pry.save_history if Pry.config.history.should_save && Pry.active_sessions == 0
|
158
|
+
break_data
|
155
159
|
end
|
156
160
|
|
157
161
|
# Start a read-eval-print-loop.
|
@@ -168,18 +172,13 @@ class Pry
|
|
168
172
|
|
169
173
|
repl_prologue(target)
|
170
174
|
|
171
|
-
# cannot rely on nesting.level as
|
172
|
-
# nesting.level changes with new sessions
|
173
|
-
nesting_level = nesting.size
|
174
|
-
|
175
175
|
break_data = catch(:breakout) do
|
176
|
-
nesting.push [nesting.size, target_self, self]
|
177
176
|
loop do
|
178
|
-
rep(
|
177
|
+
rep(binding_stack.last)
|
179
178
|
end
|
180
179
|
end
|
181
180
|
|
182
|
-
return_value = repl_epilogue(target,
|
181
|
+
return_value = repl_epilogue(target, break_data)
|
183
182
|
return_value || target_self
|
184
183
|
end
|
185
184
|
|
@@ -211,29 +210,18 @@ class Pry
|
|
211
210
|
Readline.completion_proc = Pry::InputCompleter.build_completion_proc target, instance_eval(&custom_completions)
|
212
211
|
end
|
213
212
|
|
214
|
-
#
|
215
|
-
|
216
|
-
|
217
|
-
target.eval("inp = ::Pry.active_instance.instance_eval { @input_array }")
|
218
|
-
target.eval("out = ::Pry.active_instance.instance_eval { @output_array }")
|
219
|
-
|
220
|
-
@last_result_is_exception = false
|
221
|
-
set_active_instance(target)
|
213
|
+
# It's not actually redundant to inject them continually as we may have
|
214
|
+
# moved into the scope of a new Binding (e.g the user typed `cd`)
|
215
|
+
inject_special_locals(target)
|
222
216
|
|
223
217
|
code = r(target)
|
224
218
|
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
rescue SystemExit => e
|
229
|
-
exit
|
230
|
-
rescue Exception => e
|
231
|
-
@last_result_is_exception = true
|
232
|
-
@output_array << e
|
219
|
+
result = set_last_result(target.eval(code, Pry.eval_path, Pry.current_line), target)
|
220
|
+
result
|
221
|
+
rescue RescuableException => e
|
233
222
|
set_last_exception(e, target)
|
234
223
|
ensure
|
235
|
-
|
236
|
-
Pry.current_line += code.each_line.count if code
|
224
|
+
update_input_history(code)
|
237
225
|
end
|
238
226
|
|
239
227
|
# Perform a read.
|
@@ -258,7 +246,7 @@ class Pry
|
|
258
246
|
break if valid_expression?(eval_string)
|
259
247
|
end
|
260
248
|
|
261
|
-
@suppress_output = true if eval_string =~ /;\Z/ ||
|
249
|
+
@suppress_output = true if eval_string =~ /;\Z/ || eval_string.empty?
|
262
250
|
|
263
251
|
eval_string
|
264
252
|
end
|
@@ -270,14 +258,19 @@ class Pry
|
|
270
258
|
else
|
271
259
|
print.call output, result
|
272
260
|
end
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
261
|
+
rescue RescuableException => e
|
262
|
+
# Being uber-paranoid here, given that this exception arose because we couldn't
|
263
|
+
# serialize something in the user's program, let's not assume we can serialize
|
264
|
+
# the exception either.
|
265
|
+
begin
|
266
|
+
output.puts "output error: #{e.inspect}"
|
267
|
+
rescue RescuableException => e
|
268
|
+
if last_result_is_exception?
|
269
|
+
output.puts "output error: failed to show exception"
|
270
|
+
else
|
271
|
+
output.puts "output error: failed to show result"
|
272
|
+
end
|
273
|
+
end
|
281
274
|
end
|
282
275
|
|
283
276
|
# Read a line of input and check for ^d, also determine prompt to use.
|
@@ -289,13 +282,14 @@ class Pry
|
|
289
282
|
current_prompt = select_prompt(eval_string.empty?, target.eval('self'))
|
290
283
|
val = readline(current_prompt)
|
291
284
|
|
292
|
-
# exit session if we receive EOF character
|
285
|
+
# exit session if we receive EOF character (^D)
|
293
286
|
if !val
|
294
|
-
output.puts
|
295
|
-
|
287
|
+
output.puts ""
|
288
|
+
Pry.config.control_d_handler.call(eval_string, self)
|
289
|
+
""
|
290
|
+
else
|
291
|
+
val
|
296
292
|
end
|
297
|
-
|
298
|
-
val
|
299
293
|
end
|
300
294
|
|
301
295
|
# Process the line received.
|
@@ -304,12 +298,23 @@ class Pry
|
|
304
298
|
# @param [String] eval_string The cumulative lines of input.
|
305
299
|
# @param [Binding] target The target of the Pry session.
|
306
300
|
def process_line(val, eval_string, target)
|
307
|
-
|
301
|
+
result = @command_processor.process_commands(val, eval_string, target)
|
302
|
+
|
303
|
+
# set a temporary (just so we can inject the value we want into eval_string)
|
304
|
+
Thread.current[:__pry_cmd_result__] = result
|
308
305
|
|
309
|
-
if
|
310
|
-
|
306
|
+
# note that `result` wraps the result of command processing; if a
|
307
|
+
# command was matched and invoked then `result.command?` returns true,
|
308
|
+
# otherwise it returns false.
|
309
|
+
if result.command? && !result.void_command?
|
310
|
+
|
311
|
+
# the command that was invoked was non-void (had a return value) and so we make
|
312
|
+
# the value of the current expression equal to the return value
|
313
|
+
# of the command.
|
314
|
+
eval_string.replace "Thread.current[:__pry_cmd_result__].retval\n"
|
311
315
|
else
|
312
|
-
# only commands
|
316
|
+
# only commands should have an empty `val`
|
317
|
+
# so this ignores their result
|
313
318
|
eval_string << "#{val.rstrip}\n" if !val.empty?
|
314
319
|
end
|
315
320
|
end
|
@@ -319,9 +324,10 @@ class Pry
|
|
319
324
|
# @param [Object] result The result.
|
320
325
|
# @param [Binding] target The binding to set `_` on.
|
321
326
|
def set_last_result(result, target)
|
322
|
-
|
327
|
+
@last_result_is_exception = false
|
323
328
|
@output_array << result
|
324
|
-
|
329
|
+
|
330
|
+
self.last_result = result
|
325
331
|
end
|
326
332
|
|
327
333
|
# Set the last exception for a session.
|
@@ -336,16 +342,22 @@ class Pry
|
|
336
342
|
ex.backtrace.first =~ /(.*):(\d+)/
|
337
343
|
ex.file, ex.line = $1, $2.to_i
|
338
344
|
|
339
|
-
|
340
|
-
|
345
|
+
@last_result_is_exception = true
|
346
|
+
@output_array << ex
|
347
|
+
|
348
|
+
self.last_exception = ex
|
341
349
|
end
|
342
350
|
|
343
|
-
#
|
351
|
+
# Update Pry's internal state after evalling code.
|
344
352
|
# This method should not need to be invoked directly.
|
345
|
-
# @param [
|
346
|
-
def
|
347
|
-
|
348
|
-
|
353
|
+
# @param [String] code The code we just eval'd
|
354
|
+
def update_input_history(code)
|
355
|
+
# Always push to the @input_array as the @output_array is always pushed to.
|
356
|
+
@input_array << code
|
357
|
+
if code
|
358
|
+
Pry.line_buffer.push(*code.each_line)
|
359
|
+
Pry.current_line += code.each_line.count
|
360
|
+
end
|
349
361
|
end
|
350
362
|
|
351
363
|
# @return [Boolean] True if the last result is an exception that was raised,
|
@@ -362,10 +374,9 @@ class Pry
|
|
362
374
|
def readline(current_prompt="> ")
|
363
375
|
|
364
376
|
if input == Readline
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
input.readline(current_prompt, true)
|
377
|
+
line = input.readline(current_prompt, false)
|
378
|
+
Pry.history << line.dup if line
|
379
|
+
line
|
369
380
|
else
|
370
381
|
begin
|
371
382
|
if input.method(:readline).arity == 1
|
@@ -389,14 +400,6 @@ class Pry
|
|
389
400
|
!@suppress_output || last_result_is_exception?
|
390
401
|
end
|
391
402
|
|
392
|
-
# Save readline history to a file.
|
393
|
-
def save_history
|
394
|
-
history_file = File.expand_path(Pry.config.history.file)
|
395
|
-
File.open(history_file, 'w') do |f|
|
396
|
-
f.write Readline::HISTORY.to_a.join("\n")
|
397
|
-
end
|
398
|
-
end
|
399
|
-
|
400
403
|
# Returns the appropriate prompt to use.
|
401
404
|
# This method should not need to be invoked directly.
|
402
405
|
# @param [Boolean] first_line Whether this is the first line of input
|
@@ -406,9 +409,9 @@ class Pry
|
|
406
409
|
def select_prompt(first_line, target_self)
|
407
410
|
|
408
411
|
if first_line
|
409
|
-
Array(prompt).first.call(target_self,
|
412
|
+
Array(prompt).first.call(target_self, binding_stack.size - 1, self)
|
410
413
|
else
|
411
|
-
Array(prompt).last.call(target_self,
|
414
|
+
Array(prompt).last.call(target_self, binding_stack.size - 1, self)
|
412
415
|
end
|
413
416
|
end
|
414
417
|
|
data/lib/pry/version.rb
CHANGED
data/pry.gemspec
CHANGED
@@ -1,20 +1,21 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
$:.unshift File.expand_path('../lib', __FILE__)
|
3
|
-
require 'pry/version'
|
4
2
|
|
5
3
|
Gem::Specification.new do |s|
|
6
4
|
s.name = %q{pry}
|
7
|
-
s.version =
|
5
|
+
s.version = "0.9.4pre1"
|
8
6
|
|
9
7
|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
10
8
|
s.authors = [%q{John Mair (banisterfiend)}]
|
11
|
-
s.
|
9
|
+
s.date = %q{2011-09-07}
|
10
|
+
s.description = %q{An IRB alternative and runtime developer console}
|
12
11
|
s.email = %q{jrmair@gmail.com}
|
13
12
|
s.executables = [%q{pry}]
|
14
|
-
s.files = [%q{.document}, %q{.gemtest}, %q{.gitignore}, %q{.yardopts}, %q{CHANGELOG}, %q{LICENSE}, %q{README.markdown}, %q{Rakefile}, %q{TODO}, %q{bin/pry}, %q{examples/example_basic.rb}, %q{examples/example_command_override.rb}, %q{examples/example_commands.rb}, %q{examples/example_hooks.rb}, %q{examples/example_image_edit.rb}, %q{examples/example_input.rb}, %q{examples/example_input2.rb}, %q{examples/example_output.rb}, %q{examples/example_print.rb}, %q{examples/example_prompt.rb}, %q{examples/helper.rb}, %q{lib/pry.rb}, %q{lib/pry/command_context.rb}, %q{lib/pry/command_processor.rb}, %q{lib/pry/command_set.rb}, %q{lib/pry/commands.rb}, %q{lib/pry/completion.rb}, %q{lib/pry/config.rb}, %q{lib/pry/core_extensions.rb}, %q{lib/pry/custom_completions.rb}, %q{lib/pry/default_commands/basic.rb}, %q{lib/pry/default_commands/context.rb}, %q{lib/pry/default_commands/documentation.rb}, %q{lib/pry/default_commands/easter_eggs.rb}, %q{lib/pry/default_commands/gems.rb}, %q{lib/pry/default_commands/input.rb}, %q{lib/pry/default_commands/introspection.rb}, %q{lib/pry/default_commands/ls.rb}, %q{lib/pry/default_commands/shell.rb}, %q{lib/pry/extended_commands/experimental.rb}, %q{lib/pry/extended_commands/user_command_api.rb}, %q{lib/pry/helpers.rb}, %q{lib/pry/helpers/base_helpers.rb}, %q{lib/pry/helpers/command_helpers.rb}, %q{lib/pry/helpers/text.rb}, %q{lib/pry/history_array.rb}, %q{lib/pry/plugins.rb}, %q{lib/pry/pry_class.rb}, %q{lib/pry/pry_instance.rb}, %q{lib/pry/version.rb}, %q{pry.gemspec}, %q{test/helper.rb}, %q{test/test_command_helpers.rb}, %q{test/test_command_processor.rb}, %q{test/test_command_set.rb}, %q{test/test_default_commands.rb}, %q{test/test_default_commands/test_context.rb}, %q{test/test_default_commands/test_documentation.rb}, %q{test/test_default_commands/test_gems.rb}, %q{test/test_default_commands/test_input.rb}, %q{test/test_default_commands/test_introspection.rb}, %q{test/test_history_array.rb}, %q{test/test_pry.rb}, %q{test/testrc}, %q{wiki/Customizing-pry.md}, %q{wiki/Home.md}]
|
15
|
-
s.homepage = %q{http://
|
16
|
-
s.
|
17
|
-
s.
|
13
|
+
s.files = [%q{.document}, %q{.gemtest}, %q{.gitignore}, %q{.yardopts}, %q{CHANGELOG}, %q{CONTRIBUTORS}, %q{LICENSE}, %q{README.markdown}, %q{Rakefile}, %q{TODO}, %q{bin/pry}, %q{examples/example_basic.rb}, %q{examples/example_command_override.rb}, %q{examples/example_commands.rb}, %q{examples/example_hooks.rb}, %q{examples/example_image_edit.rb}, %q{examples/example_input.rb}, %q{examples/example_input2.rb}, %q{examples/example_output.rb}, %q{examples/example_print.rb}, %q{examples/example_prompt.rb}, %q{examples/helper.rb}, %q{lib/pry.rb}, %q{lib/pry/command_context.rb}, %q{lib/pry/command_processor.rb}, %q{lib/pry/command_set.rb}, %q{lib/pry/commands.rb}, %q{lib/pry/completion.rb}, %q{lib/pry/config.rb}, %q{lib/pry/core_extensions.rb}, %q{lib/pry/custom_completions.rb}, %q{lib/pry/default_commands/basic.rb}, %q{lib/pry/default_commands/context.rb}, %q{lib/pry/default_commands/documentation.rb}, %q{lib/pry/default_commands/easter_eggs.rb}, %q{lib/pry/default_commands/gems.rb}, %q{lib/pry/default_commands/input.rb}, %q{lib/pry/default_commands/introspection.rb}, %q{lib/pry/default_commands/ls.rb}, %q{lib/pry/default_commands/shell.rb}, %q{lib/pry/extended_commands/experimental.rb}, %q{lib/pry/extended_commands/user_command_api.rb}, %q{lib/pry/helpers.rb}, %q{lib/pry/helpers/base_helpers.rb}, %q{lib/pry/helpers/command_helpers.rb}, %q{lib/pry/helpers/text.rb}, %q{lib/pry/history.rb}, %q{lib/pry/history_array.rb}, %q{lib/pry/plugins.rb}, %q{lib/pry/pry_class.rb}, %q{lib/pry/pry_instance.rb}, %q{lib/pry/version.rb}, %q{pry.gemspec}, %q{test/helper.rb}, %q{test/test_command_helpers.rb}, %q{test/test_command_processor.rb}, %q{test/test_command_set.rb}, %q{test/test_completion.rb}, %q{test/test_default_commands.rb}, %q{test/test_default_commands/test_context.rb}, %q{test/test_default_commands/test_documentation.rb}, %q{test/test_default_commands/test_gems.rb}, %q{test/test_default_commands/test_input.rb}, %q{test/test_default_commands/test_introspection.rb}, %q{test/test_default_commands/test_shell.rb}, %q{test/test_history_array.rb}, %q{test/test_pry.rb}, %q{test/test_pry_history.rb}, %q{test/test_pry_output.rb}, %q{test/test_special_locals.rb}, %q{test/testrc}, %q{wiki/Customizing-pry.md}, %q{wiki/Home.md}]
|
14
|
+
s.homepage = %q{http://pry.github.com}
|
15
|
+
s.require_paths = [%q{lib}]
|
16
|
+
s.rubygems_version = %q{1.8.6}
|
17
|
+
s.summary = %q{An IRB alternative and runtime developer console}
|
18
|
+
s.test_files = [%q{test/helper.rb}, %q{test/test_command_helpers.rb}, %q{test/test_command_processor.rb}, %q{test/test_command_set.rb}, %q{test/test_completion.rb}, %q{test/test_default_commands.rb}, %q{test/test_default_commands/test_context.rb}, %q{test/test_default_commands/test_documentation.rb}, %q{test/test_default_commands/test_gems.rb}, %q{test/test_default_commands/test_input.rb}, %q{test/test_default_commands/test_introspection.rb}, %q{test/test_default_commands/test_shell.rb}, %q{test/test_history_array.rb}, %q{test/test_pry.rb}, %q{test/test_pry_history.rb}, %q{test/test_pry_output.rb}, %q{test/test_special_locals.rb}, %q{test/testrc}]
|
18
19
|
|
19
20
|
if s.respond_to? :specification_version then
|
20
21
|
s.specification_version = 3
|
@@ -22,23 +23,23 @@ Gem::Specification.new do |s|
|
|
22
23
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
23
24
|
s.add_runtime_dependency(%q<ruby_parser>, [">= 2.0.5"])
|
24
25
|
s.add_runtime_dependency(%q<coderay>, [">= 0.9.8"])
|
25
|
-
s.add_runtime_dependency(%q<slop>, ["~> 1.
|
26
|
-
s.add_runtime_dependency(%q<method_source>, [">= 0.
|
26
|
+
s.add_runtime_dependency(%q<slop>, ["~> 2.1.0"])
|
27
|
+
s.add_runtime_dependency(%q<method_source>, [">= 0.6.0"])
|
27
28
|
s.add_development_dependency(%q<bacon>, [">= 1.1.0"])
|
28
29
|
s.add_development_dependency(%q<open4>, ["~> 1.0.1"])
|
29
30
|
else
|
30
31
|
s.add_dependency(%q<ruby_parser>, [">= 2.0.5"])
|
31
32
|
s.add_dependency(%q<coderay>, [">= 0.9.8"])
|
32
|
-
s.add_dependency(%q<slop>, ["~> 1.
|
33
|
-
s.add_dependency(%q<method_source>, [">= 0.
|
33
|
+
s.add_dependency(%q<slop>, ["~> 2.1.0"])
|
34
|
+
s.add_dependency(%q<method_source>, [">= 0.6.0"])
|
34
35
|
s.add_dependency(%q<bacon>, [">= 1.1.0"])
|
35
36
|
s.add_dependency(%q<open4>, ["~> 1.0.1"])
|
36
37
|
end
|
37
38
|
else
|
38
39
|
s.add_dependency(%q<ruby_parser>, [">= 2.0.5"])
|
39
40
|
s.add_dependency(%q<coderay>, [">= 0.9.8"])
|
40
|
-
s.add_dependency(%q<slop>, ["~> 1.
|
41
|
-
s.add_dependency(%q<method_source>, [">= 0.
|
41
|
+
s.add_dependency(%q<slop>, ["~> 2.1.0"])
|
42
|
+
s.add_dependency(%q<method_source>, [">= 0.6.0"])
|
42
43
|
s.add_dependency(%q<bacon>, [">= 1.1.0"])
|
43
44
|
s.add_dependency(%q<open4>, ["~> 1.0.1"])
|
44
45
|
end
|
data/test/helper.rb
CHANGED
@@ -25,13 +25,33 @@ class << Pry
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
# are we on Jruby platform?
|
29
|
+
def jruby?
|
30
|
+
defined?(RUBY_ENGINE) && RUBY_ENGINE =~ /jruby/
|
31
|
+
end
|
32
|
+
|
33
|
+
# are we on rbx platform?
|
34
|
+
def rbx?
|
35
|
+
defined?(RUBY_ENGINE) && RUBY_ENGINE =~ /rbx/
|
36
|
+
end
|
37
|
+
|
28
38
|
Pry.reset_defaults
|
29
39
|
|
40
|
+
# this is to test exception code (cat --ex)
|
41
|
+
def broken_method
|
42
|
+
this method is broken
|
43
|
+
end
|
44
|
+
|
30
45
|
# sample doc
|
31
46
|
def sample_method
|
32
47
|
:sample
|
33
48
|
end
|
34
49
|
|
50
|
+
# another sample doc
|
51
|
+
def another_sample_method
|
52
|
+
:another_sample
|
53
|
+
end
|
54
|
+
|
35
55
|
def redirect_pry_io(new_in, new_out)
|
36
56
|
old_in = Pry.input
|
37
57
|
old_out = Pry.output
|
@@ -46,6 +66,17 @@ def redirect_pry_io(new_in, new_out)
|
|
46
66
|
end
|
47
67
|
end
|
48
68
|
|
69
|
+
def mock_pry(*args)
|
70
|
+
input = InputTester.new(*args)
|
71
|
+
output = StringIO.new
|
72
|
+
|
73
|
+
redirect_pry_io(input, output) do
|
74
|
+
Pry.start
|
75
|
+
end
|
76
|
+
|
77
|
+
output.string
|
78
|
+
end
|
79
|
+
|
49
80
|
def redirect_global_pry_input(new_io)
|
50
81
|
old_io = Pry.input
|
51
82
|
Pry.input = new_io
|