lib/reap/task.rb in reap-4.0 vs lib/reap/task.rb in reap-4.0.0
- old
+ new
@@ -1,6 +1,9 @@
+#require 'rake'
+#require 'rake/tasklib'
+
require 'rbconfig'
require 'fileutils'
require 'facet/fileutils/safe_ln'
require 'facet/string/tabto'
@@ -41,38 +44,38 @@
#
module Reap
def self.registry ; @registry ; end
- def self.register
+ def self.register( name, klass )
@registry ||= {}
- ObjectSpace.each_object(Class) { |klass|
- if klass < ::Reap::Task
- if klass.verify
- @registry[klass.basename.downcase] = klass
- end
- end
- }
+ if klass.verify
+ @registry[name.to_s.downcase] = klass
+ end
end
def self.tasks ; @tasks ; end
- def self.initialize
+ def self.initialize_all
@tasks ||= {}
registry.each do |name, klass|
@tasks[name] = klass.new
end
end
- class Task
+ class Task #< ::Rake::TaskLib
include ::Config
include ::FileUtils
RUBY = CONFIG['ruby_install_name']
# class methods
+
+ def self.inherited( task_class )
+ Reap::register( task_class.task_name, task_class )
+ end
def self.task_desc ; '(no desciption given)' ; end
def self.task_name ; basename.downcase ; end
def self.section_required( val ) ; @section_required = val ;end