Sha256: 24b88e4068ca671bd23588e3b7c05f4f1194ad4efbc63e3ec11d606dac4430d5

Contents?: true

Size: 802 Bytes

Versions: 9

Compression:

Stored size: 802 Bytes

Contents

require_relative '../ext/string'

def load_app_rakefile
  @app_rakefile_loaded ||= begin
    load './Rakefile'
  end
end

namespace :drake do
  desc "task runner to optionally invoke tasks"
  task :runner do
    runner_tasks = ENV["runner_tasks"] || ""
    optional = ENV["runner_optional"]
    app_task = ENV["runner_app_task"]

    load_app_rakefile if app_task
    tasks = runner_tasks.split(',')
    task = tasks.find { |i| Rake::Task.task_defined? i}

    if task
      puts "#{"\u2219".bold.yellow} #{task}"
      Rake::Task[task].invoke
    else
      if optional
        puts "#{"WARN".yellow} any of the tasks not found: #{tasks}"
      else
        abort "#{"ERROR".red} any of the required tasks not defined: #{tasks}"
      end
    end
  end
end

Dir.glob('dply/*.rake').each { |r| load r}

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
dply-0.2.19 lib/dply/rakelib/drake.rake
dply-0.2.18 lib/dply/rakelib/drake.rake
dply-0.2.17 lib/dply/rakelib/drake.rake
dply-0.2.16 lib/dply/rakelib/drake.rake
dply-0.2.15 lib/dply/rakelib/drake.rake
dply-0.2.14 lib/dply/rakelib/drake.rake
dply-0.2.13 lib/dply/rakelib/drake.rake
dply-0.2.11 lib/dply/rakelib/drake.rake
dply-0.2.10 lib/dply/rakelib/drake.rake