summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordon Bedwell <jordon@envygeeks.com>2012-02-23 02:58:04 -0600
committerJordon Bedwell <jordon@envygeeks.com>2012-02-23 02:58:04 -0600
commit943e34c8909833a2ca59b9239794c5d8d85d1f6e (patch)
tree5309278eaa4927e4acfd6335d453a2d81787cb91
parent904b06aeb6e923df49b16ffacd0e4f423d94ee77 (diff)
downloadpry-943e34c8909833a2ca59b9239794c5d8d85d1f6e.tar.gz
Reduce the inherit list. And also, fuck your old Gem search method, fixt! :)
Signed-off-by: Jordon Bedwell <jordon@envygeeks.com>
-rw-r--r--lib/pry/plugins.rb12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/pry/plugins.rb b/lib/pry/plugins.rb
index 95b3e7f9..29c31cfd 100644
--- a/lib/pry/plugins.rb
+++ b/lib/pry/plugins.rb
@@ -38,13 +38,10 @@ class Pry
end
def run
- @@list.each do |plugin|
- unless @@disabled.include?(plugin.plugin_name)
- define_plugin OpenStruct.new(:listing => plugin.listing, :instance => plugin.new, :version => plugin.version, :plugin_name => plugin.plugin_name)
- end
+ Gem.refresh
+ Hash[Gem.source_index.each.to_a].delete_if { |package, gem| package !~ /\A#{PREFIX}/ }.each do |package, gem|
+ begin; require gem.name; rescue => error; Warn error.message unless error.message.empty? end
end
-
- @@enabled
end
end
end
@@ -52,7 +49,8 @@ class Pry
# Inherit.
class Plugin
class << self
- %w(listing version plugin_name).each do |meth|
+ # Alias VERSION to version if you like...
+ %w(printable_name version).each do |meth|
self.class_eval <<-EVAL
def #{meth} value = nil
if value && !value.empty?