overview 0.0.4.14 → 0.0.4.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/appversion.rb +41 -34
- data/lib/helpers/ci.rb +0 -2
- data/lib/helpers/git.rb +1 -1
- data/lib/overview/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NDY5ODQ1ZDI0ZDEzYWJjNzNlOGI2NTBjNmViZDgzZWM0ZmJmZWI2YQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YzZjY2IzZjZmNjY1OTU2ZTk0YjU4Y2QyNDY5MDFkOTA3NDNiZjdlMw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YTAxMjkxNzliYTY3ZjY2MDIzY2RiZWU5YWZmOTVhZmMwZDY3NmQ4N2YyODc5
|
10
|
+
MjE0ZGIzZjU1MGM1YWI0NjUzNzRkZjMzMDc5MGUyMGVjN2ZjMjMxN2EwZTM3
|
11
|
+
OWZmYjgzYWY0NjFlZDZhYWZiYjhkZDFjNDNiMjc5OTYxOGE5Yjc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MWI5MDMzNmMxNDY1NzVhMDAyZjljZTAzNDNmMTdjMTAzMDZmYmUzMjhhZjJm
|
14
|
+
YjE1MTQzNzA3Yzk3YWZmNTQwMzcxYmVmZTM3NDgyZTZjMjczZDBlNzAwZTI2
|
15
|
+
YzMwZDYzMjViMDk5ZTg5Yjc5M2VhZDNiZDIwZWIyNGU1M2FlYzE=
|
data/lib/appversion.rb
CHANGED
@@ -5,18 +5,18 @@ module AppVersion
|
|
5
5
|
default = TRUE #default to true if running locally
|
6
6
|
begin
|
7
7
|
if tag.empty?
|
8
|
-
p 'No tag, so unable to check Github release status
|
8
|
+
p 'No tag, so unable to check Github release status'
|
9
9
|
default
|
10
10
|
else
|
11
11
|
require 'octokit'
|
12
12
|
repo = CI.repo || Git.repo
|
13
|
-
|
13
|
+
$stdout.puts "Repo slug is #{repo}"
|
14
14
|
if repo.empty? || ENV['GITHUB_TOKEN'].nil? #for local builds
|
15
|
-
|
15
|
+
$stdout.puts 'GITHUB_TOKEN missing, running locally'
|
16
16
|
default
|
17
17
|
else
|
18
18
|
client = Octokit::Client.new(:access_token => ENV['GITHUB_TOKEN'])
|
19
|
-
|
19
|
+
$stdout.puts 'Connecting to Github'
|
20
20
|
client.user.login
|
21
21
|
client.default_media_type = "application/vnd.github.moondragon+json"
|
22
22
|
release = client.release_for_tag(repo, tag)
|
@@ -29,7 +29,7 @@ module AppVersion
|
|
29
29
|
end
|
30
30
|
|
31
31
|
rescue LoadError
|
32
|
-
|
32
|
+
$stdout.puts 'Octokit gem missing, running locally'
|
33
33
|
default
|
34
34
|
end
|
35
35
|
end
|
@@ -44,35 +44,42 @@ module AppVersion
|
|
44
44
|
#TODO: refactor so that every permutation can be tested. E.g. github release where is_pre_release=false, what is the commit count?
|
45
45
|
def version(semantic = false)
|
46
46
|
version_suffix = CI.version_suffix
|
47
|
-
if Git.installed?
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
clean_tag = '0.0.1'
|
52
|
-
elsif latest_tag.empty? #not a git directory
|
53
|
-
commit_count = 0
|
54
|
-
clean_tag = '0.0.1'
|
55
|
-
else
|
56
|
-
commit_count = Git.commit_count_since_tag(latest_tag)
|
57
|
-
clean_tag = Git.clean_tag
|
58
|
-
end
|
59
|
-
#Only increment version after production release, so that we retain a single version during beta and RCs
|
60
|
-
#TODO: check if this is a tagged build, and then always use the clean_tag. Not need to check pre_release or increment
|
61
|
-
if commit_count == 0 || Release.is_pre_release?(latest_tag)
|
62
|
-
short_version = clean_tag
|
63
|
-
else
|
64
|
-
short_version = clean_tag.increment_version
|
65
|
-
end
|
47
|
+
if !Git.installed? then
|
48
|
+
$stderr.puts 'Git required, not installed'
|
49
|
+
exit 1
|
50
|
+
end
|
66
51
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
52
|
+
latest_tag = Git.tag
|
53
|
+
if latest_tag == 'HEAD'
|
54
|
+
commit_count = Git.commit_count
|
55
|
+
clean_tag = '0.0.1'
|
56
|
+
elsif latest_tag.empty? #not a git directory
|
57
|
+
commit_count = 0
|
58
|
+
clean_tag = '0.0.1'
|
73
59
|
else
|
74
|
-
|
75
|
-
|
60
|
+
commit_count = Git.commit_count_since_tag(latest_tag)
|
61
|
+
clean_tag = Git.clean_tag
|
62
|
+
end
|
63
|
+
#Only increment version after production release, so that we retain a single version during beta and RCs
|
64
|
+
#TODO: check if this is a tagged build, and then always use the clean_tag. Not need to check pre_release or increment
|
65
|
+
is_pre_release = Release.is_pre_release?(latest_tag)
|
66
|
+
$stdout.puts "Latest tag = #{latest_tag}"
|
67
|
+
$stdout.puts "Commit count since tag = #{commit_count}"
|
68
|
+
$stdout.puts "Was tag from a Github pre-release? #{is_pre_release}"
|
69
|
+
$stdout.puts "Is this a Github release? #{CI.tagged_build?}"
|
70
|
+
|
71
|
+
#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
|
72
|
+
if CI.tagged_build? || commit_count == 0 || is_pre_release
|
73
|
+
short_version = clean_tag
|
74
|
+
else
|
75
|
+
short_version = clean_tag.increment_version
|
76
|
+
end
|
77
|
+
|
78
|
+
if semantic
|
79
|
+
short_version
|
80
|
+
else
|
81
|
+
target = !version_suffix.empty? ? ":#{version_suffix.upcase}" : ''
|
82
|
+
short_version + target + suffix
|
76
83
|
end
|
77
84
|
end
|
78
85
|
|
@@ -82,7 +89,7 @@ module AppVersion
|
|
82
89
|
|
83
90
|
def suffix
|
84
91
|
branch = CI.branch || Git.branch
|
85
|
-
|
92
|
+
$stdout.puts "Branch = #{branch}"
|
86
93
|
case branch
|
87
94
|
when /develop/
|
88
95
|
suffix = '-develop'
|
@@ -99,7 +106,7 @@ module AppVersion
|
|
99
106
|
end
|
100
107
|
#special case for github releases
|
101
108
|
if CI.tagged_build?
|
102
|
-
|
109
|
+
$stdout.puts 'Tagged build, suppressing branch suffix'
|
103
110
|
suffix = ''
|
104
111
|
end
|
105
112
|
return suffix
|
data/lib/helpers/ci.rb
CHANGED
@@ -3,9 +3,7 @@
|
|
3
3
|
DEFAULT_BUILD_NO = '1'
|
4
4
|
|
5
5
|
def self.tagged_build?(travis_tag='')
|
6
|
-
p "TRAVIS_TAG=#{ENV['TRAVIS_TAG']}"
|
7
6
|
travis_tag = !travis_tag.empty? ? travis_tag : ENV['TRAVIS_TAG'] || ''
|
8
|
-
p "travis_tag=#{travis_tag}."
|
9
7
|
!travis_tag.empty? && !(travis_tag == 'EMPTY') #magic default value used by legacy build scripts
|
10
8
|
end
|
11
9
|
|
data/lib/helpers/git.rb
CHANGED
@@ -25,7 +25,7 @@ require_relative 'string.rb'
|
|
25
25
|
`git rev-list --count HEAD`.to_i
|
26
26
|
end
|
27
27
|
def self.commit_count_since_tag(tag)
|
28
|
-
`git rev-list --count
|
28
|
+
`git rev-list --count #{tag}.. 2>/dev/null`.to_i
|
29
29
|
end
|
30
30
|
def self.installed?
|
31
31
|
system 'git --version >>/dev/null 2>&1'
|
data/lib/overview/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: overview
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.4.
|
4
|
+
version: 0.0.4.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Orford
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|