lib/vamper.rb in code_tools-4.2.0 vs lib/vamper.rb in code_tools-4.2.1

- old
+ new

@@ -5,11 +5,11 @@ require 'colorize' require_relative './vamper/version_file.rb' require_relative './vamper/version_config_file.rb' require_relative './core_ext.rb' -$VERSION='4.2.0-20151225.0' +$VERSION='4.2.1-20151227.0' class Vamper def parse(args) options = OpenStruct.new @@ -71,23 +71,24 @@ version_file.revision = 0 version_file.build = build else version_file.revision += 1 end - when :FullDate + when :Incremental + version_file.build += 1 + version_file.revision = 0 + else # :FullDate build = get_full_date(now) if version_file.build != build version_file.revision = 0 version_file.build = build else version_file.revision += 1 end - tags[:DashBuild] = build[0..3] + '-' + build[4..5] + '-' + build[6..7] - when :Incremental - version_file.build += 1 - version_file.revision = 0 + build_str = build.to_s + tags[:DashBuild] = build_str[0..3] + '-' + build_str[4..5] + '-' + build_str[6..7] end puts 'Version data is:' tags.each { |key, value| puts " #{key}=#{value}" @@ -135,20 +136,20 @@ content.gsub!(%r(#{update.search})m, update.replace.gsub(/\${(\w+)}/,'\\\\k<\\1>')) IO.write(path, content) end end else - error "File #{path} does not exist to update" + error "file #{path} does not exist to update" exit(1) end end break end unless match - error "File '#{path}' has no matching file type in the .version.config" + error "file '#{path}' has no matching file type in the .version.config" exit(1) end puts path @@ -180,17 +181,17 @@ exit(1) end end def get_full_date(now) - (now.year * 10000 + now.month * 100 + now.mday).to_s + now.year * 10000 + now.month * 100 + now.mday end def get_jdate(now, start_year) (((now.year - start_year + 1) * 10000) + (now.month * 100) + now.mday).to_s end def error(msg) - puts "error: #{msg}".colorize(:red) + STDERR.puts "error: #{msg}".red end end