summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordon Bedwell <jordon@envygeeks.com>2012-02-25 16:15:10 -0600
committerJordon Bedwell <jordon@envygeeks.com>2012-02-25 16:15:10 -0600
commit408a62e5609cfdb119de6b9ebcca4c6178789d7c (patch)
tree773cf463fa588789d5463f1ee8da4c06745e67d1
parentcf3588edb9597ca900ec4ba1e31c1d0009dfd080 (diff)
downloadpry-408a62e5609cfdb119de6b9ebcca4c6178789d7c.tar.gz
Decouple load and start for load first initialize last.
The idea: * We load our code first, setup the environment, then we create Plugin::initialize(). * The plugin system runs Plugin.new() just before Pry.start 'enters the Matrix.' * We integrate Pry.start with Hooks at some point so users can select their point of init. * We no longer control when and where they init, they control this with hooks. Neat huh? * This means that plugins can replace code without monkey patching. Neater huh? * Soon plugins can specify tainted state (meaning they never reinit and instances do inception.) * In this fashion each instance of Pry can also have it's own instance of Plugins even disabled plugins.
-rw-r--r--lib/pry/plugins.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/pry/plugins.rb b/lib/pry/plugins.rb
index c9c13486..47d8e5c0 100644
--- a/lib/pry/plugins.rb
+++ b/lib/pry/plugins.rb
@@ -78,7 +78,9 @@ class Pry
end
end
end
-
+ end
+
+ def start
@plugins.each do |plugin_name, plugin|
unless @enabled[plugin_name]
@enabled[plugin_name] = plugin.merge!(:legacy => true)
@@ -158,4 +160,5 @@ class Pry
end
end
-Pry::Plugins.run \ No newline at end of file
+Pry::Plugins.run
+Pry::Plugins.start \ No newline at end of file