class Rake::Delphi::RCTask

Attributes

input[RW]
mainicon_path[RW]
output[RW]

Public Class Methods

new(name, app) click to toggle source
Calls superclass method Rake::Task::new
# File lib/rake/delphi/resources.rb, line 103
def initialize(name, app)
    super
    @output = nil
    @is_rc = false
    @main_icon_path = nil
end

Public Instance Methods

execute(args=nil) click to toggle source
Calls superclass method Rake::Task#execute
# File lib/rake/delphi/resources.rb, line 128
def execute(args=nil)
    super
    v, path, tool = RCResourceCompiler.find(true)
    a = []
    a << '/dRC' if @is_rc
    a << '/dMAIN_ICON' if is_main_icon
    a |= ['/fo', Rake.quotepath('', output), '/r', Rake.quotepath('', input) ]
    opts = { :args => a }
    opts.merge!(args)
    cmd = ([Rake.quotepath('', tool)] | opts[:args]).join(' ')
    RakeFileUtils.verbose(Logger.debug?) do
        sh cmd
    end
end
input=(value) click to toggle source
# File lib/rake/delphi/resources.rb, line 110
def input=(value)
    @input = value.pathmap('%X.rc')
    @output = @input.pathmap('%X.res')
end
is_main_icon() click to toggle source
# File lib/rake/delphi/resources.rb, line 119
def is_main_icon
    mainicon_path_unquoted = File.expand_path2(Rake.unquotepath(@mainicon_path), '-ml')
    is_main_icon = File.exists?(mainicon_path_unquoted)
    unless is_main_icon
        warn "WARNING! Icon file '#{mainicon_path_unquoted}' does not exists. Application icon is disabled."
    end
    return is_main_icon
end
is_rc=(value) click to toggle source
# File lib/rake/delphi/resources.rb, line 115
def is_rc=(value)
    @is_rc = ! value.to_s.empty?
end