puts_debug "read " + __FILE__.foreground(:green) require 'rake' if("#{RUBY_VERSION}">"1.9.1") include Rake::DSL end def task_start(task_name) puts " " puts "[:#{task_name}]".foreground(:yellow).bright + " " + Dir.pwd end task :clean do; task_start "clean"; end task :clobber do; task_start "clobber"; end require 'rake/clean' CLEAN.include('bin/Debug','bin/Release','bin/x86','*.gem','doc/*','obj/*','*.taskstamp') CLOBBER.include('bin/Debug','bin/Release','bin/x86','doc','obj') def generate_tasks(project) task_hash = { :add=> { :desc=> 'add files defined by src_glob to source code management' }, :info=> { :desc=> 'display information about the rakefile' }, :compile=> { :desc=> 'compile' }, :test=> { :desc=> 'run unit tests' }, :commit=> { :desc=> 'commit' }, :replace=> { :desc=> 'replace text' }, :loc=> { :desc=> 'count the lines of code' }, :setup=> { :desc=> 'setup the project environment' }, :pull=> { :desc=> 'rake working copies of dependencies' }, :check=> { :desc=> 'checks if the project default task may be skipped' }, :update=> { :desc=> 'updates changes from source code management' } } if project[:type]=="gem" || project[:type]=="ruby" task_hash[:features] = { :desc=> 'tests cucumber features' } end if("#{RUBY_VERSION}">"1.9.1") task_hash.each do |k,v| name=k.to_s desc=nil desc=v[:desc] if v.has_key?(:desc) ruby="task :#{name} do; task_start '#{name}'; PROJECT.#{name}; end" ruby="desc '#{desc}'; " + ruby unless desc.nil? unless task_defined(name) puts_debug "defining task " + name eval(ruby) end end end end if("#{RUBY_VERSION}"<="1.9.1") task :add do; task_start('add'); PROJECT.add; end task :check do; task_start('check'); PROJECT.check; end task :update do; task_start('update'); PROJECT.update; end task :setup do; task_start('setup'); PROJECT.setup; end task :compile do; task_start('compile'); PROJECT.compile; end task :test do; task_start('test'); PROJECT.test; end task :commit do; task_start('commit'); PROJECT.commit; end task :replace do; task_start('replace'); PROJECT.replace; end task :loc do; task_start('loc'); PROJECT.loc; end task :info do; task_start('info'); PROJECT.info; end end