Rake::TaskLib
# File lib/shipit.rb, line 26 def define t = Proc.new do |t| puts green { "Preparing steps... " } steps = [] def steps.state @state ||= {} end eigenclass = class <<steps; self; end plugins = self.class.const_get(:Step) plugins.constants.each do |i| eigenclass.__send__(:define_method, i) do |*args| self << ret = plugins.const_get(i).new(self, *args) ret end end @block.call(steps) steps.each do |s| puts cyan { "Running Step (Prepare): #{s.class.name}" } s.prepare if s.respond_to? :prepare end puts green { "done." } unless t.name =~ /:prepare$/ puts puts green { "Steps: #{steps.map{|i| i.class.name.sub(/.+::/, "")}.join(", ")}" } puts "Really run? Cancel to press Ctrl+C." $stdin.gets steps.each do |s| puts red { "Running Step: #{s.class.name}" } s.run end puts green { "done." } end end desc "Shipit: Automated Release" task @name, &t namespace @name do desc "Shipit: Automated Release (Only run prepare phase)" task :prepare, &t # desc "Shipit: Automated Release (Dry run)" # task :dryrun, &t end end
Generated with the Darkfish Rdoc Generator 2.