lib/appversion.rb in overview-0.0.5.pre.22 vs lib/appversion.rb in overview-0.0.6.pre.24

- old
+ new

@@ -9,11 +9,11 @@ if tag.empty? p 'No tag, so unable to check Github release status' default else require 'octokit' - repo = CI.repo || Git.repo + repo = Helpers::CI.repo || Git.repo $stdout.puts "Repo slug is #{repo}" if repo.empty? || ENV['GITHUB_TOKEN'].nil? #for local builds $stdout.puts 'GITHUB_TOKEN missing, running locally' default else @@ -45,37 +45,37 @@ end #TODO: refactor so that every permutation can be tested. E.g. github release where is_pre_release=false, what is the commit count? #Make this a class method def version(semantic:false, rubygem:false) - version_suffix = CI.version_suffix + version_suffix = Helpers::CI.version_suffix if !Git.installed? then $stderr.puts 'Git required, not installed' exit 1 end - latest_tag = Git.tag + latest_tag = Helpers::Git.tag if latest_tag == 'HEAD' - commit_count = Git.commit_count + commit_count = Helpers::Git.commit_count clean_tag = '0.0.1' elsif latest_tag.empty? #not a git directory commit_count = 0 clean_tag = '0.0.1' else - commit_count = Git.commit_count_since_tag(latest_tag) - clean_tag = Git.clean_tag(rubygem:rubygem) + commit_count = Helpers::Git.commit_count_since_tag(latest_tag) + clean_tag = Helpers::Git.clean_tag(rubygem:rubygem) end #Only increment version after production release, so that we retain a single version during beta and RCs #TODO: check if this is a tagged build, and then always use the clean_tag. Not need to check pre_release or increment is_pre_release = Release.is_pre_release?(latest_tag) $stdout.puts "Latest tag = #{latest_tag}" $stdout.puts "Commit count since tag = #{commit_count}" $stdout.puts "Was tag from a Github pre-release? #{is_pre_release}" - $stdout.puts "Is this a Github release? #{CI.tagged_build?}" + $stdout.puts "Is this a Github release? #{Helpers::CI.tagged_build?}" #Don't increment version for Github releases, if no commits have been made since last tag, or if last Github release was a pre_release - if CI.tagged_build? || commit_count == 0 || is_pre_release + if Helpers::CI.tagged_build? || commit_count == 0 || is_pre_release short_version = clean_tag else short_version = clean_tag.increment_version end @@ -86,15 +86,15 @@ short_version + target + suffix end end def build_no - CI.build_no + Helpers::CI.build_no end def suffix - branch = CI.branch || Git.branch + branch = Helpers::CI.branch || Git.branch $stdout.puts "Branch = #{branch}" case branch when /develop/ suffix = '-develop' when /master/ @@ -107,10 +107,10 @@ suffix = "-#{branch.split('/').last.downcase}" else suffix = '-debug' end #special case for github releases - if CI.tagged_build? + if Helpers::CI.tagged_build? $stdout.puts 'Tagged build, suppressing branch suffix' suffix = '' end return suffix end \ No newline at end of file