extracted initial_session_setup method from Pry.start; invoking :when_started hook in Pry.start
This commit is contained in:
parent
c02772af19
commit
cab51af3ef
|
@ -33,7 +33,9 @@ class Pry
|
||||||
end
|
end
|
||||||
|
|
||||||
# Activate the plugin (require the gem - enables/loads the
|
# Activate the plugin (require the gem - enables/loads the
|
||||||
# plugin immediately at point of call, even if plugin is disabled)
|
# plugin immediately at point of call, even if plugin is
|
||||||
|
# disabled)
|
||||||
|
# Does not reload plugin if it's already active.
|
||||||
def activate!
|
def activate!
|
||||||
begin
|
begin
|
||||||
require gem_name if !active?
|
require gem_name if !active?
|
||||||
|
|
|
@ -73,6 +73,21 @@ class Pry
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Do basic setup for initial session.
|
||||||
|
# Including: loading .pryrc, loading plugins, loading requires, and
|
||||||
|
# loading history.
|
||||||
|
def self.initial_session_setup
|
||||||
|
# note these have to be loaded here rather than in pry_instance as
|
||||||
|
# we only want them loaded once per entire Pry lifetime, not
|
||||||
|
# multiple times per each new session (i.e in debugging)
|
||||||
|
load_rc if Pry.config.should_load_rc
|
||||||
|
load_plugins if Pry.config.plugins.enabled
|
||||||
|
load_requires if Pry.config.should_load_requires
|
||||||
|
load_history if Pry.config.history.should_load
|
||||||
|
|
||||||
|
@initial_session = false
|
||||||
|
end
|
||||||
|
|
||||||
# Start a Pry REPL.
|
# Start a Pry REPL.
|
||||||
# This method also loads the files specified in `Pry::RC_FILES` the
|
# This method also loads the files specified in `Pry::RC_FILES` the
|
||||||
# first time it is invoked.
|
# first time it is invoked.
|
||||||
|
@ -83,17 +98,10 @@ class Pry
|
||||||
# Pry.start(Object.new, :input => MyInput.new)
|
# Pry.start(Object.new, :input => MyInput.new)
|
||||||
def self.start(target=TOPLEVEL_BINDING, options={})
|
def self.start(target=TOPLEVEL_BINDING, options={})
|
||||||
if initial_session?
|
if initial_session?
|
||||||
# note these have to be loaded here rather than in pry_instance as
|
initial_session_setup
|
||||||
# we only want them loaded once per entire Pry lifetime, not
|
|
||||||
# multiple times per each new session (i.e in debugging)
|
|
||||||
load_rc if Pry.config.should_load_rc
|
|
||||||
load_plugins if Pry.config.plugins.enabled
|
|
||||||
load_requires if Pry.config.should_load_requires
|
|
||||||
load_history if Pry.config.history.should_load
|
|
||||||
|
|
||||||
@initial_session = false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Pry.config.hooks.exec_hook(:when_started, target)
|
||||||
new(options).repl(target)
|
new(options).repl(target)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
class Pry
|
class Pry
|
||||||
VERSION = "0.9.7.4"
|
VERSION = "0.9.7.5"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue