Sha256: dbf61b2cdab27cb3eac5ac3925e5cc1f75dbbe705e6c7795e715b4633fdf8bdb
Contents?: true
Size: 1.94 KB
Versions: 4
Compression:
Stored size: 1.94 KB
Contents
require 'semver' require 'rake' require 'rake/clean' require 'yaml' include Rake::DSL require_relative './commands.rb' require_relative './dependencies.rb' require_relative './artifacts.rb' require_relative './console.rb' CLEAN.include("*.gem") SPEC=Gem::Specification.load('./dev_tasks.gemspec') class DevTasks < Hash #attr_accessor :commands, :dependencies def initialize self[:name]=SPEC.name self[:version]=SPEC.version self[:commands]=Commands.new self[:dependencies]=Dependencies.new self[:artifacts]=Artifacts.new update_tasks end def execute_task task start_time=Time.now Console.announce_task_start task if(!self[:commands].has_key?(task)) puts "no commands discovered for task " + task else self[:commands][task].each {|c| self[:commands].execute_command(c) } end end_time=Time.now elapsed=end_time-start_time elapsed_str="[" + "%.0f" %(elapsed) + "s]" Console.announce_task_end task, elapsed_str end def define_task task_name if(!Rake::Task.task_defined?(task_name)) ruby="desc '#{task_name} task';task :#{task_name} do;DEV_TASKS.execute_task '#{task_name}';end" eval(ruby) end end def update_tasks dev_task_defaults=Array.new self[:commands].each do |key,array| if(array.length > 0) define_task key dev_task_defaults << key end end if(!Rake::Task.task_defined?('dev_tasks_default')) tasklist="" dev_task_defaults.each{|t| tasklist = tasklist + "," if tasklist.length > 0 tasklist = tasklist + ":" + t } ruby="desc 'dev_tasks_default task';task :dev_tasks_default => [#{tasklist}] do;end" eval(ruby) end end end DEV_TASKS=DevTasks.new desc 'displays information about current rake directory' task :info do Console.print_hash("",DEV_TASKS) end desc 'displays help for dev_task' task :help do puts "use rake -T to see available tasks" end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
dev_tasks-0.0.13 | lib/dev_tasks.rb |
dev_tasks-0.0.12 | lib/dev_tasks.rb |
dev_tasks-0.0.11 | lib/dev_tasks.rb |
dev_tasks-0.0.10 | lib/dev_tasks.rb |