lib/appversion.rb in overview-0.0.4.17 vs lib/appversion.rb in overview-0.0.5.pre.22
- old
+ new
@@ -1,8 +1,10 @@
module AppVersion
class Release
+ include Helpers
+
def self.is_pre_release?(tag)
default = TRUE #default to true if running locally
begin
if tag.empty?
p 'No tag, so unable to check Github release status'
@@ -34,17 +36,19 @@
end
end
end
class Version
+ include Helpers
def to_s
"#{version} (#{build_no})"
end
#TODO: refactor so that every permutation can be tested. E.g. github release where is_pre_release=false, what is the commit count?
- def version(semantic = false)
+ #Make this a class method
+ def version(semantic:false, rubygem:false)
version_suffix = CI.version_suffix
if !Git.installed? then
$stderr.puts 'Git required, not installed'
exit 1
end
@@ -56,10 +60,10 @@
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
+ clean_tag = 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}"
\ No newline at end of file