Sha256: eaa5dfe949c8ba8bd9ec6339aa54da1951c10c265ff20a0e9b62f096656a1962
Contents?: true
Size: 1016 Bytes
Versions: 60
Compression:
Stored size: 1016 Bytes
Contents
module CfgConfig def convert(filename) @convertText = "" $log.debug "Processing Windows Configuration file [#{filename}]" begin fh = File.open(filename) fh.each do |line| line.AsciiToUtf8!.strip! next if line.length == 0 next if line =~ /^#.*$/ next unless line.include?("=") k, v = line.split(/\s*=\s*/) send(k, v) if self.respond_to?(k) end return @convertText ensure fh.close end end def name(value) vmName = value.gsub(/^"/, "").gsub(/"$/, "") add_item("displayName", vmName) end def memory(value) add_item("memsize", value) end def disk(value) eval(value).each do |d| diskProp = d.split(",") # scsi0:0.fileName = "Windows XP Professional x64 Edition.vmdk" add_item("scsi0:#{diskProp[1][-1..-1]}.fileName", File.basename(diskProp[0])) end end def add_item(var, value) @convertText += "#{var} = \"#{value}\"\n" end def vendor "xen" end end
Version data entries
60 entries across 60 versions & 1 rubygems