class DataMetaDom::Ver
Version info.
Attributes
full[RW]
Full version info.
Public Class Methods
new(specs)
click to toggle source
Creates an instance with the given full version.
# File lib/dataMetaDom/ver.rb, line 178 def initialize(specs) @full = if specs.kind_of?(Integer) raise ArgumentError, %|Invalid version specs: "#{specs }"; a version must be of a valid Semantic format| else SemVer.fromSpecs(specs) end end
reVersion(path, namespace, globs, srcVer, trgVer)
click to toggle source
Reversions all the files in the given paths recursively
# File lib/dataMetaDom/ver.rb, line 190 def reVersion(path, namespace, globs, srcVer, trgVer) vPat = srcVer ? srcVer.toVarName : '\d+_\d+_\d+' globs.each { |g| Dir.glob("#{path}/#{g}").each { |f| origLines = IO.read(f).split("\n") newLines = [] origLines.each { |line| newLines << (line.end_with?('KEEP') ? line : line.gsub(%r~#{namespace.gsub(/\./, '\.')}\.v#{vPat}~, "#{namespace}.v#{trgVer.toVarName}")) } IO.write(f, newLines.join("\n"), mode: 'wb') } } Dir.entries(path).select{|e| File.directory?(File.join(path, e))}.reject{|e| e.start_with?('.')}.each {|d| reVersion File.join(path, d), namespace, globs, srcVer, trgVer } end
Public Instance Methods
to_s()
click to toggle source
Textual presentation for the instance.
# File lib/dataMetaDom/ver.rb, line 214 def to_s; "ver #{full}" end