Sha256: 84affcca474f69a139f2d7db6ab88c3fbddf4119d649da1760bc041cbf65bc98

Contents?: true

Size: 677 Bytes

Versions: 1

Compression:

Stored size: 677 Bytes

Contents

require 'rake'
require 'straight_line/common/command'

# Configuration class to add tasks to the straightline rake config
class Configure
  def add(name, type, command, opts = {})
    Rake.application.in_namespace StraightLine::TASK_NAMESPACE do
      Rake::Task.define_task name => opts[:before] do
        if type == :shell
          cmd = Command.new command
          cmd.run
        elsif !name.nil?
          Rake::Task[command].invoke
        end
        run_after_commands(opts)
      end
    end
  end

  private

  def run_after_commands(opts)
    after = opts[:after]
    return if after.nil?
    after.each do |task|
      Rake::Task[task].invoke
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
straight_line-0.1.2.0 lib/straight_line/common/configure.rb