Class: Configure

Inherits:
Object
  • Object
show all
Defined in:
lib/straight_line/common/configure.rb

Overview

Configuration class to add tasks to the straightline rake config

Instance Method Summary collapse

Instance Method Details

#add(name, type, command, opts = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/straight_line/common/configure.rb', line 6

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