add config to disable auto-reload

This commit is contained in:
Ryan Fitzgerald 2011-07-24 22:57:40 -07:00
parent c8845bffb4
commit 3b955809ca
3 changed files with 7 additions and 2 deletions

View File

@ -75,6 +75,10 @@ class Pry
# @return [Boolean] # @return [Boolean]
attr_accessor :should_load_requires attr_accessor :should_load_requires
# Determines whether to disable edit-method's auto-reloading behavior.
# @return [Boolean]
attr_accessor :disable_auto_reload
# Config option for history. # Config option for history.
# sub-options include hist.file, hist.load, and hist.save # sub-options include hist.file, hist.load, and hist.save
# hist.file is the file to save/load history too, e.g # hist.file is the file to save/load history too, e.g

View File

@ -147,7 +147,7 @@ class Pry
opt.on :M, "instance-methods", "Operate on instance methods." opt.on :M, "instance-methods", "Operate on instance methods."
opt.on :m, :methods, "Operate on methods." opt.on :m, :methods, "Operate on methods."
opt.on :n, "no-reload", "Do not automatically reload the method's file after editting." opt.on :n, "no-reload", "Do not automatically reload the method's file after editing."
opt.on "no-jump", "Do not fast forward editor to first line of method." opt.on "no-jump", "Do not fast forward editor to first line of method."
opt.on :c, :context, "Select object context to run under.", true do |context| opt.on :c, :context, "Select object context to run under.", true do |context|
target = Pry.binding_for(target.eval(context)) target = Pry.binding_for(target.eval(context))
@ -179,7 +179,7 @@ class Pry
invoke_editor(file, opts["no-jump"] ? 0 : line) invoke_editor(file, opts["no-jump"] ? 0 : line)
silence_warnings do silence_warnings do
load file if !opts.n? load file if !opts.n? && !Pry.config.disable_auto_reload
end end
end end
end end

View File

@ -198,6 +198,7 @@ class Pry
config.pager = true config.pager = true
config.editor = default_editor_for_platform config.editor = default_editor_for_platform
config.should_load_rc = true config.should_load_rc = true
config.disable_auto_reload = false
config.plugins ||= OpenStruct.new config.plugins ||= OpenStruct.new
config.plugins.enabled = true config.plugins.enabled = true