module Dnnbundler
Constants
- VERSION
Public Class Methods
formatVersion(version)
click to toggle source
converts version numbers array into string <year>.<sprint>.<build> Params:
version
-
integer array: [year, sprint, build]
# File lib/dnnbundler/cli.rb, line 44 def self.formatVersion(version) "#{version[0].to_s.rjust(4, "0")}.#{version[1].to_s.rjust(2, "0")}.#{version[2].to_s.rjust(4, "0")}" end
getVersionFromManifest(file_name)
click to toggle source
# File lib/dnnbundler/packageVersionReplacer.rb, line 17 def self.getVersionFromManifest(file_name) text = File.read(file_name) (ManifestVersionRegex::NewManifestRegex.match(text) || ManifestVersionRegex::OldManifestRegex.match(text)).captures[1] end
replaceVersionInManifestFiles(file_names, new_version)
click to toggle source
# File lib/dnnbundler/packageVersionReplacer.rb, line 2 def self.replaceVersionInManifestFiles(file_names, new_version) file_names.each do |file_name| text = File.read(file_name) replace_expr = '\1' + new_version + '\3' text.gsub!(ManifestVersionRegex::NewManifestRegex, replace_expr ) text.gsub!(ManifestVersionRegex::OldManifestRegex, replace_expr ) # To merely print the contents of the file, use: # puts new_contents # To write changes to the file, use: File.open(file_name, "w") {|file| file.puts text } end end
splitVersionNumbers(version_string)
click to toggle source
splits string version into integers Params:
version_string
-
string version, format is dot separated numbers <year>.<sprint>.<build>
# File lib/dnnbundler/cli.rb, line 51 def self.splitVersionNumbers(version_string) version_string.split(".").map { |x| x.to_i } end