def initialize(spec)
@dependencies = Array.new
@provides = Array.new
if Hash === spec
name, depends = spec.to_a.first
else
name, depends = spec, nil
end
name = name.to_s
@name = name
raise ConfigException, "package #{name} is already defined" if Package[name]
@@packages[name] = self
yield(self) if block_given?
file installstamp
task "#{name}-build" => installstamp
task :build => "#{name}-build"
depends_on *depends if depends
task "#{name}-import" do import end
task :import => "#{name}-import"
task "#{name}-prepare" do prepare end
task :prepare => "#{name}-prepare"
task(name) do
Rake::Task["#{name}-import"].invoke
Rake::Task["#{name}-prepare"].invoke
Rake::Task["#{name}-build"].invoke
end
task :default => name
end