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



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

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
        Util.logger.puts "executing command #{command}. Error results will be
          displayed if any ocur"
        cmd.run
      elsif !name.nil?
        Util.logger.puts "executing task #{command}. Error results will be
        displayed if any ocur"
        Rake::Task[command].invoke
      end
      run_after_commands(opts)
    end
  end
end