lib/flay.rb in flay-1.4.0 vs lib/flay.rb in flay-1.4.1
- old
+ new
@@ -7,11 +7,11 @@
require 'rubygems'
require 'sexp_processor'
require 'ruby_parser'
class Flay
- VERSION = '1.4.0'
+ VERSION = '1.4.1'
def self.default_options
{
:diff => false,
:mass => 16,
@@ -83,21 +83,24 @@
}.flatten
end
def self.load_plugins
unless defined? @@plugins then
+ @@plugins = []
+
plugins = Gem.find_files("flay_*.rb").reject { |p| p =~ /flay_task/ }
plugins.each do |plugin|
+ plugin_name = File.basename(plugin, '.rb').sub(/^flay_/, '')
+ next if @@plugins.include? plugin_name
begin
load plugin
+ @@plugins << plugin_name
rescue LoadError => e
warn "error loading #{plugin.inspect}: #{e.message}. skipping..."
end
end
-
- @@plugins = plugins.map { |f| File.basename(f, '.rb').sub(/^flay_/, '') }
end
@@plugins
rescue
# ignore
end
@@ -302,16 +305,18 @@
hashes << node.structural_hash
end
hashes
end
+ # REFACTOR: move to sexp.rb
def deep_each(&block)
self.each_sexp do |sexp|
block[sexp]
sexp.deep_each(&block)
end
end
+ # REFACTOR: move to sexp.rb
def each_sexp
self.each do |sexp|
next unless Sexp === sexp
yield sexp