Sha256: 0d260733c57ad3e5d3294f2bd05148f594f18e7a98be2ecdd91e7ac66fbf5549
Contents?: true
Size: 1.67 KB
Versions: 1
Compression:
Stored size: 1.67 KB
Contents
module BuildMaster class JavaManifest def initialize(manifest_file) @manifest_file = manifest_file end def version number = nil build = nil IO.foreach(@manifest_file) do |line| name_value = NameValue.parse(line) if (name_value.name== "Implementation-Version") number = name_value.value elsif (name_value.name == "Implementation-Build") build = name_value.value end end return Version.new(number, build.to_i) end def increase_build content = "" number = nil build = nil IO.foreach(@manifest_file) do |line| name_value = NameValue.parse(line) if (name_value.name== "Implementation-Version") number = name_value.value content = content + line elsif (name_value.name == "Implementation-Build") build = name_value.value.to_i + 1 content = content + "Implementation-Build: #{build}\n" else content = content + line end end File.open(@manifest_file, "w") do |file| file.printf(content) end return Version.new(number, build) end end class NameValue attr_reader :name, :value def NameValue.parse(line) name_value = NameValue.new(nil, nil) index = line.index(':') if (index) name=line[0, index] value=line[index+1, line.length].strip name_value = NameValue.new(name, value) end return name_value end def initialize(name, value) @name = name @value = value end end class Version attr_reader :number, :build def initialize(number, build) @number = number @build = build end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
BuildMaster-0.7.0 | lib/buildmaster/java_manifest.rb |