class Rake::Delphi::BDSVersionInfo

Public Class Methods

encoding() click to toggle source
# File lib/rake/delphi/projectinfo.rb, line 61
def self.encoding
    # override to set your own encoding
    nil
end
new(task) click to toggle source
Calls superclass method Rake::Delphi::ProjectVersionInfo::new
# File lib/rake/delphi/projectinfo.rb, line 33
def initialize(task)
    super(task)
    versioninfo = get_versioninfo_tag(@content)
    # no need to continue if no version info file
    return unless versioninfo
    ['Delphi.Personality', 'VersionInfoKeys', 'VersionInfoKeys'].each do |key|
      versioninfo = versioninfo[key]
      # test version info file validity
      # no need to continue if file not valid
      return unless versioninfo
    end
    use_encode = String.new.respond_to?(:encode)
    encoding = self.class.encoding
    if encoding && ! use_encode
        require 'iconv'
        iconv = Iconv.new(encoding, 'UTF-8')
    end
    versioninfo.each do |v|
        cv = v['content']
        cv = (use_encode ? cv.encode(encoding, 'UTF-8') : iconv.iconv(cv)) if cv && encoding
        @info[v['Name'].to_sym] = cv
    end
end

Public Instance Methods

_ext() click to toggle source
# File lib/rake/delphi/projectinfo.rb, line 75
def _ext
    return 'bdsproj'
end
do_getcontent() click to toggle source
# File lib/rake/delphi/projectinfo.rb, line 66
def do_getcontent
    if File.exists?(@file)
        @content = XmlSimple.xml_in(@file, :ForceArray => false)
    else
        warn "WARNING! Version info file #{@file} does not exists"
        super
    end
end
get_versioninfo_tag(content) click to toggle source
# File lib/rake/delphi/projectinfo.rb, line 57
def get_versioninfo_tag(content)
    return content
end