Sha256: e5a361136e97fa7db20985f2a63873f71a9eb71e6788bbe5e26e42c66b817266
Contents?: true
Size: 1.7 KB
Versions: 5
Compression:
Stored size: 1.7 KB
Contents
require 'semver' require 'rake' require 'awesome_print' include Rake::DSL require_relative './commands.rb' require_relative './console.rb' class DevTasks attr_accessor :version, :commands def initialize v=SemVer.find @version="#{v.major}.#{v.minor}.#{v.patch}" about @commands=Commands.new update_tasks end def about puts Color.green + "dev_tasks " + version + Color.clear end def execute_task task start_time=Time.now Console.announce_task_start task if(!@commands.has_key?(task)) puts "no commands discovered for task " + task else @commands[task].each {|c| @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 ["build","test","add","commit","push"].each{|task| if @commands.has_key? task define_task(task) dev_task_defaults << task 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 dev_task commands' task :show_commands do puts "DEV_TASKS.commands" ap DEV_TASKS.commands end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
dev_tasks-0.0.6 | lib/dev_tasks.rb |
dev_tasks-0.0.5 | lib/dev_tasks.rb |
dev_tasks-0.0.4 | lib/dev_tasks.rb |
dev_tasks-0.0.3 | lib/dev_tasks.rb |
dev_tasks-0.0.2 | lib/dev_tasks.rb |