class Configure

Configuration class to add tasks to the straightline rake config

Public Instance Methods

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

Private Instance Methods

run_after_commands(opts) click to toggle source
# File lib/straight_line/common/configure.rb, line 27
def run_after_commands(opts)
  after = opts[:after]
  return if after.nil?
  after.each do |task|
    Rake::Task[task].invoke
  end
end