class Cxxproject::CommandLine

Public Class Methods

new(name) click to toggle source
Calls superclass method Cxxproject::BuildingBlock::new
# File lib/cxxproject/buildingblocks/command_line.rb, line 35
def initialize(name)
  set_command_line(name)
  @num = Rake.application.command_line_number
  super(get_task_name)
end

Public Instance Methods

convert_to_rake() click to toggle source
# File lib/cxxproject/buildingblocks/command_line.rb, line 45
def convert_to_rake()
  res = task get_task_name do
    Dir.chdir(@project_dir) do
      check_config_file
      cmd = get_command_line
      puts cmd + ((RakeFileUtils.verbose == true) ? " (executed in '#{@project_dir}')" : "")
      cmd_result = false
      begin
        cmd_result = ProcessHelper.spawnProcess(cmd + " 2>&1")
      rescue
      end
      if (cmd_result == false)
        if Rake.application.idei
          err_res = ErrorDesc.new
          err_res.file_name = (@defined_in_file ? @defined_in_file : @project_dir)
          err_res.line_number = (@defined_in_line ? @defined_in_line : 0)
          err_res.severity = ErrorParser::SEVERITY_ERROR
          err_res.message = "Command \"#{get_command_line}\" failed"
          Rake.application.idei.set_errors([err_res])
        end
        Printer.printError "Error: command \"#{get_command_line}\" failed" + ((RakeFileUtils.verbose == true) ? "" : " (executed in '#{@project_dir}')")
        raise SystemCommandFailed.new
      end
    end
  end
  res.immediate_output = true
  res.transparent_timestamp = true
  res.type = Rake::Task::COMMANDLINE
  setup_rake_dependencies(res)
  res
end
get_command_line() click to toggle source
# File lib/cxxproject/buildingblocks/command_line.rb, line 13
def get_command_line
  @line
end
get_defined_in_file() click to toggle source
# File lib/cxxproject/buildingblocks/command_line.rb, line 22
def get_defined_in_file
  @defined_in_file
end
get_defined_in_line() click to toggle source
# File lib/cxxproject/buildingblocks/command_line.rb, line 31
def get_defined_in_line
  @defined_in_line
end
get_task_name() click to toggle source
# File lib/cxxproject/buildingblocks/command_line.rb, line 41
def get_task_name()
  "command line (#{@num}): " + get_command_line
end
set_command_line(x) click to toggle source
# File lib/cxxproject/buildingblocks/command_line.rb, line 8
def set_command_line(x)
  @line = x
  self
end
set_defined_in_file(x) click to toggle source
# File lib/cxxproject/buildingblocks/command_line.rb, line 17
def set_defined_in_file(x)
  @defined_in_file = x
  self
end
set_defined_in_line(x) click to toggle source
# File lib/cxxproject/buildingblocks/command_line.rb, line 26
def set_defined_in_line(x)
  @defined_in_line = x
  self
end