Sha256: 059a68ae05494972e6921085cf5f51d7afb156964c013ff9c0f612e70d31f77f
Contents?: true
Size: 1.77 KB
Versions: 1
Compression:
Stored size: 1.77 KB
Contents
# encoding: utf-8 require 'xmlsimple' require 'rake/helpers/rake' module Rake module Delphi class ProjectVersionInfo def initialize(task) @info = Hash.new @file = task.systempath.pathmap('%X.' + self._ext) do_getcontent end def do_getcontent @content = nil end def _ext '' end def [](key) @info[key.to_sym] end def method_missing(name, *args, &block) @info[name] end end class BDSVersionInfo < ProjectVersionInfo def initialize(task) super(task) content = @content['Delphi.Personality']['VersionInfoKeys']['VersionInfoKeys'] use_encode = String.new.respond_to?(:encode) encoding = self.class.encoding if encoding && ! use_encode require 'iconv' iconv = Iconv.new(encoding, 'UTF-8') end content.each do |v| cv = v['content'] cv = (use_encode ? cv.encode(encoding, 'UTF-8') : iconv.iconv(cv)) if encoding @info[v['Name'].to_sym] = cv end end def self.encoding # override to set your own encoding nil end def do_getcontent @content = XmlSimple.xml_in(@file, :ForceArray => false) end def _ext return 'bdsproj' end end class RAD2007VersionInfo < BDSVersionInfo def _ext return 'dproj' end def do_getcontent super # .dproj file has more nesting levels @content = @content['ProjectExtensions']['BorlandProject']['BorlandProject'] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rake-delphi-0.0.4 | lib/rake/delphi/projectinfo.rb |