overview 0.0.4.17 → 0.0.5.pre.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/bin/overview +3 -3
- data/lib/appversion.rb +6 -2
- data/lib/helpers/git.rb +28 -9
- data/lib/helpers/string.rb +12 -3
- data/lib/overview/version.rb +1 -1
- data/overview.gemspec +3 -1
- data/spec/helpers_spec.rb +61 -22
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZmVmZDE3YjMxNmFiYmUzNDlmOWM4YWZhYmE5OWJhNzUyYWQyMWE3ZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NzI4NzYxNzMyODczMmY2MTdkMzcxY2M0Y2Q5NGM2ZGY2N2Q0ZDVhMw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODhjMzkwMGUxNzFkYTI3NzhmYTdhYjBiNjljYTdkYjgwNjE3MjAwOGE3Mjll
|
10
|
+
NDU3OWU0OTEyMzIzYmZkNTA5MmRlOTA5MjIxMDdiNTRjYzlmODQwNThlOGQ4
|
11
|
+
MmVhZGY1Y2NmYmQ0YTE0YzBkYmY2OWE4MTQ1MDlmNzM0ODVmNDI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZDM0OGY4YmJmMTZkMzMzZGZkMjYyOWFjMGRjOTM2YTYxM2E1OWVhOTdmOGRk
|
14
|
+
Yzg3ZWZiNWY1MWJiYzc5ODJlNmM0Nzk4YjY1YTM4YjUzYTkxNDhjYTYxOWY3
|
15
|
+
OTI2N2JmNDZkNGI3NjkxMzM0ODYzNjdjNmJlMmIxM2RjYTE4YzY=
|
data/bin/overview
CHANGED
@@ -92,20 +92,20 @@ command :appversion do |c|
|
|
92
92
|
c.switch :b
|
93
93
|
c.desc 'Version (no build) with branch e.g. 0.1.1-feature'
|
94
94
|
c.switch :v
|
95
|
-
c.desc 'Rubygem compatible version with build appended e.g. 0.1.1-feature-534'
|
95
|
+
c.desc 'Rubygem compatible version with build appended e.g. 0.1.1.pre-feature-534'
|
96
96
|
c.switch :r
|
97
97
|
c.desc 'Google App Engine compatible version with build appended e.g. 0-1-1-feature-534'
|
98
98
|
c.switch :a
|
99
99
|
c.action do |global_options,options,args|
|
100
100
|
include AppVersion
|
101
101
|
if options[:s]
|
102
|
-
puts AppVersion::Version.new.version(true).to_s
|
102
|
+
puts AppVersion::Version.new.version(semantic:true).to_s
|
103
103
|
elsif options[:b]
|
104
104
|
puts AppVersion::Version.new.build_no.to_s
|
105
105
|
elsif options[:v]
|
106
106
|
puts AppVersion::Version.new.version.to_s
|
107
107
|
elsif options[:r]
|
108
|
-
puts "#{AppVersion::Version.new.version.to_s}.#{AppVersion::Version.new.build_no.to_s}"
|
108
|
+
puts "#{AppVersion::Version.new.version(rubygem:true).to_s}.#{AppVersion::Version.new.build_no.to_s}"
|
109
109
|
elsif options[:a]
|
110
110
|
puts "#{AppVersion::Version.new.version.to_s}".gsub('.','-')
|
111
111
|
else
|
data/lib/appversion.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
module AppVersion
|
2
2
|
|
3
3
|
class Release
|
4
|
+
include Helpers
|
5
|
+
|
4
6
|
def self.is_pre_release?(tag)
|
5
7
|
default = TRUE #default to true if running locally
|
6
8
|
begin
|
@@ -36,13 +38,15 @@ module AppVersion
|
|
36
38
|
end
|
37
39
|
|
38
40
|
class Version
|
41
|
+
include Helpers
|
39
42
|
|
40
43
|
def to_s
|
41
44
|
"#{version} (#{build_no})"
|
42
45
|
end
|
43
46
|
|
44
47
|
#TODO: refactor so that every permutation can be tested. E.g. github release where is_pre_release=false, what is the commit count?
|
45
|
-
|
48
|
+
#Make this a class method
|
49
|
+
def version(semantic:false, rubygem:false)
|
46
50
|
version_suffix = CI.version_suffix
|
47
51
|
if !Git.installed? then
|
48
52
|
$stderr.puts 'Git required, not installed'
|
@@ -58,7 +62,7 @@ module AppVersion
|
|
58
62
|
clean_tag = '0.0.1'
|
59
63
|
else
|
60
64
|
commit_count = Git.commit_count_since_tag(latest_tag)
|
61
|
-
clean_tag = Git.clean_tag
|
65
|
+
clean_tag = Git.clean_tag(rubygem:rubygem)
|
62
66
|
end
|
63
67
|
#Only increment version after production release, so that we retain a single version during beta and RCs
|
64
68
|
#TODO: check if this is a tagged build, and then always use the clean_tag. Not need to check pre_release or increment
|
data/lib/helpers/git.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require_relative 'string.rb'
|
2
|
-
|
2
|
+
module Helpers
|
3
3
|
class Git
|
4
4
|
def self.remote
|
5
5
|
begin
|
@@ -18,8 +18,13 @@ require_relative 'string.rb'
|
|
18
18
|
def self.tag
|
19
19
|
(`git describe --tags --match 'v*' --abbrev=0 2>/dev/null` || 'HEAD').strip
|
20
20
|
end
|
21
|
-
def self.clean_tag(tag=self.tag)
|
22
|
-
tag.strip.sub('v','').split(/[\.,-]/).select { |e| e.is_number?
|
21
|
+
def self.clean_tag(tag=self.tag, rubygem:false)
|
22
|
+
array = tag.strip.sub('v','').split(/[\.,-]/).select { |e| e.is_number? || (rubygem && e == 'pre') }
|
23
|
+
if rubygem then
|
24
|
+
array.join('.')
|
25
|
+
else
|
26
|
+
array.first(3).join('.')
|
27
|
+
end
|
23
28
|
end
|
24
29
|
def self.commit_count
|
25
30
|
`git rev-list --count HEAD`.to_i
|
@@ -27,14 +32,28 @@ require_relative 'string.rb'
|
|
27
32
|
def self.commit_count_since_tag(tag)
|
28
33
|
`git rev-list --count #{tag}.. 2>/dev/null`.to_i
|
29
34
|
end
|
35
|
+
def self.commit_author
|
36
|
+
`git --no-pager show -s --format='%an' -1`
|
37
|
+
end
|
38
|
+
def self.commit_email
|
39
|
+
`git --no-pager show -s --format='%ae' -1`
|
40
|
+
end
|
30
41
|
def self.installed?
|
31
42
|
system 'git --version >>/dev/null 2>&1'
|
32
43
|
end
|
33
44
|
def self.parse_deploy(commitMessage)
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
45
|
+
deploy = {}
|
46
|
+
commands = %w(deploy DEPLOY force_deploy FORCE_DEPLOY).collect{ |command| "\\b#{command}\\b" }.join("|")
|
47
|
+
re_command_and_message = Regexp.new(/<(#{commands}):?\s*(.*?)(?:>)/)
|
48
|
+
result = commitMessage.scan(re_command_and_message).flatten.compact
|
49
|
+
deploy[:match] = !result[0].nil? && !result[0].empty?
|
50
|
+
re_channel = Regexp.new(/\s*([@#][A-z]+)\s*/)
|
51
|
+
deploy[:message] = result[1] ? result[1].gsub(re_channel, '') : ''
|
52
|
+
if result[1] && result[1].scan(re_channel) && result[1].scan(re_channel).first then
|
53
|
+
deploy[:channel] = result[1].scan(re_channel).first.first || ''
|
54
|
+
end
|
55
|
+
deploy[:author] = commit_author || ''
|
56
|
+
return deploy
|
38
57
|
end
|
39
58
|
def self.parse_crashlytics(commitMessage)
|
40
59
|
return commitMessage.scan(/(c|C):(?<crashlytics>\d+)/).flatten.collect { |x| x.to_i }.uniq
|
@@ -46,7 +65,7 @@ require_relative 'string.rb'
|
|
46
65
|
return commitMessage.downcase.scan(re).flatten.collect{ |x| x.to_i }.uniq
|
47
66
|
end
|
48
67
|
def self.parse_commit_message(commitMessage)
|
49
|
-
h =
|
68
|
+
h = {}
|
50
69
|
deploy, message = self.parse_deploy(commitMessage)
|
51
70
|
sprintly_tickets = self.parse_sprintly(commitMessage)
|
52
71
|
crashlytics_ids = self.parse_crashlytics(commitMessage)
|
@@ -63,5 +82,5 @@ require_relative 'string.rb'
|
|
63
82
|
`git rev-parse --short HEAD`.strip
|
64
83
|
end
|
65
84
|
end
|
66
|
-
|
85
|
+
end
|
67
86
|
|
data/lib/helpers/string.rb
CHANGED
@@ -1,9 +1,18 @@
|
|
1
1
|
class String
|
2
2
|
def increment_version
|
3
|
-
|
4
|
-
|
3
|
+
array = self.split('.')
|
4
|
+
digits = 0
|
5
|
+
index_of_last_digit = 0
|
6
|
+
array.each_with_index {|x, i|
|
7
|
+
if x.is_number? then
|
8
|
+
digits += 1
|
9
|
+
index_of_last_digit = i
|
10
|
+
end
|
11
|
+
break if (digits==3 || i==array.count-1) && x.is_number?
|
12
|
+
}
|
13
|
+
array[index_of_last_digit] = (array[index_of_last_digit].to_i + 1).to_s
|
5
14
|
$stdout.puts 'Incrementing version...'
|
6
|
-
|
15
|
+
array.join('.')
|
7
16
|
end
|
8
17
|
def increment_version!
|
9
18
|
replace increment_version
|
data/lib/overview/version.rb
CHANGED
data/overview.gemspec
CHANGED
@@ -4,11 +4,13 @@ require File.join([File.dirname(__FILE__),'lib/overview','version.rb'])
|
|
4
4
|
spec = Gem::Specification.new do |s|
|
5
5
|
s.name = 'overview'
|
6
6
|
s.version = Overview::VERSION
|
7
|
+
s.licenses = ['MIT']
|
8
|
+
s.required_ruby_version = '>= 2.0.0'
|
7
9
|
s.author = 'Jonathan Orford'
|
8
10
|
s.email = 'jono@overllc.com'
|
9
11
|
s.homepage = 'http://www.overllc.com'
|
10
12
|
s.platform = Gem::Platform::RUBY
|
11
|
-
s.summary = "Over's custom CI / CD toolchain, integrating Sprint.ly, Github,
|
13
|
+
s.summary = "Over's custom CI / CD toolchain, integrating Sprint.ly, Github, Travis CI and ITC"
|
12
14
|
s.files = `git ls-files`.split("
|
13
15
|
")
|
14
16
|
s.require_paths << 'lib'
|
data/spec/helpers_spec.rb
CHANGED
@@ -1,6 +1,29 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'helpers/ci'
|
3
3
|
require 'helpers/git'
|
4
|
+
require 'helpers/string'
|
5
|
+
|
6
|
+
|
7
|
+
include Helpers
|
8
|
+
|
9
|
+
RSpec.describe 'String#increment_version' do
|
10
|
+
|
11
|
+
it '1.2.3 returns 1.2.4' do
|
12
|
+
expect('1.2.3'.increment_version).to eq('1.2.4')
|
13
|
+
end
|
14
|
+
|
15
|
+
it '1.2.3.pre returns 1.2.4.pre' do
|
16
|
+
expect('1.2.3.pre'.increment_version).to eq('1.2.4.pre')
|
17
|
+
end
|
18
|
+
|
19
|
+
it '1.2.3.1 returns 1.2.4.1' do
|
20
|
+
expect('1.2.3.1'.increment_version).to eq('1.2.4.1')
|
21
|
+
end
|
22
|
+
|
23
|
+
it '1.2 returns 1.3' do
|
24
|
+
expect('1.2'.increment_version).to eq('1.3')
|
25
|
+
end
|
26
|
+
end
|
4
27
|
|
5
28
|
RSpec.describe 'CI#build_no' do
|
6
29
|
|
@@ -11,6 +34,15 @@ RSpec.describe 'CI#build_no' do
|
|
11
34
|
end
|
12
35
|
|
13
36
|
RSpec.describe 'Git#clean_tag' do
|
37
|
+
|
38
|
+
it '1.2.1.1 returns ruby version' do
|
39
|
+
expect(Git.clean_tag('1.2.1.1', rubygem:true)).to eq('1.2.1.1')
|
40
|
+
end
|
41
|
+
|
42
|
+
it '1.2.1.pre returns ruby version' do
|
43
|
+
expect(Git.clean_tag('1.2.1.pre', rubygem:true)).to eq('1.2.1.pre')
|
44
|
+
end
|
45
|
+
|
14
46
|
context '1.2.3-rc4' do
|
15
47
|
it 'returns semantic version' do
|
16
48
|
expect(Git.clean_tag('1.2.3-rc4')).to eq('1.2.3')
|
@@ -58,37 +90,43 @@ RSpec.describe 'CI#tagged_build?' do
|
|
58
90
|
end
|
59
91
|
|
60
92
|
RSpec.describe 'Git#parse_deploy' do
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
expect(
|
65
|
-
expect(
|
93
|
+
it '<DEPLOY: deploy message #channel> returns true, deploy message, channel' do
|
94
|
+
result = Git.parse_deploy('This is my change <DEPLOY: #channel deploy message #channel>. Ref #123. This is my second <deploy>')
|
95
|
+
expect(result[:match]).to eq(true)
|
96
|
+
expect(result[:message]).to eq('deploy message')
|
97
|
+
expect(result[:channel]).to eq('#channel')
|
98
|
+
end
|
99
|
+
it '<DEPLOY: @jono deploy message> returns true, deploy message' do
|
100
|
+
result = Git.parse_deploy('This is my change <DEPLOY: @jono deploy message>. Ref #123. This is my second <deploy>')
|
101
|
+
expect(result[:match]).to eq(true)
|
102
|
+
expect(result[:message]).to eq('deploy message')
|
103
|
+
expect(result[:channel]).to eq('@jono')
|
66
104
|
end
|
67
105
|
it '<deploy:deploy message> returns true, deploy message' do
|
68
|
-
|
69
|
-
expect(
|
70
|
-
expect(message).to eq('deploy message')
|
106
|
+
result = Git.parse_deploy('This is my change <deploy:deploy message>. Ref #123')
|
107
|
+
expect(result[:match]).to eq(true)
|
108
|
+
expect(result[:message]).to eq('deploy message')
|
71
109
|
|
72
110
|
end
|
73
|
-
it '<deploy> returns true, message' do
|
74
|
-
|
75
|
-
expect(
|
76
|
-
expect(message).to eq('')
|
111
|
+
it '<deploy> returns true, empty message' do
|
112
|
+
result = Git.parse_deploy('This is my change <deploy>. Ref #123')
|
113
|
+
expect(result[:match]).to eq(true)
|
114
|
+
expect(result[:message]).to eq('')
|
77
115
|
end
|
78
116
|
it 'No brackets returns false, empty message' do
|
79
|
-
|
80
|
-
expect(
|
81
|
-
expect(message).to eq('')
|
117
|
+
result = Git.parse_deploy('This is my change. deploy. Ref #123')
|
118
|
+
expect(result[:match]).to eq(false)
|
119
|
+
expect(result[:message]).to eq('')
|
82
120
|
end
|
83
121
|
it "Empty string returns false, empty message" do
|
84
|
-
|
85
|
-
expect(
|
86
|
-
expect(message).to eq('')
|
122
|
+
result = Git.parse_deploy('')
|
123
|
+
expect(result[:match]).to eq(false)
|
124
|
+
expect(result[:message]).to eq('')
|
87
125
|
end
|
88
|
-
it 'Missing closing bracket returns
|
89
|
-
|
90
|
-
expect(
|
91
|
-
expect(message).to eq('')
|
126
|
+
it 'Missing closing bracket returns false, empty message' do
|
127
|
+
result = Git.parse_deploy('This is my change <DEPLOY: deploy message')
|
128
|
+
expect(result[:match]).to eq(false)
|
129
|
+
expect(result[:message]).to eq('')
|
92
130
|
end
|
93
131
|
|
94
132
|
end
|
@@ -194,3 +232,4 @@ end
|
|
194
232
|
|
195
233
|
|
196
234
|
|
235
|
+
|
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
|
+
version: 0.0.5.pre.22
|
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-06-
|
11
|
+
date: 2015-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -251,7 +251,8 @@ files:
|
|
251
251
|
- spec/helpers_spec.rb
|
252
252
|
- spec/spec_helper.rb
|
253
253
|
homepage: http://www.overllc.com
|
254
|
-
licenses:
|
254
|
+
licenses:
|
255
|
+
- MIT
|
255
256
|
metadata: {}
|
256
257
|
post_install_message:
|
257
258
|
rdoc_options:
|
@@ -267,17 +268,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
267
268
|
requirements:
|
268
269
|
- - ! '>='
|
269
270
|
- !ruby/object:Gem::Version
|
270
|
-
version:
|
271
|
+
version: 2.0.0
|
271
272
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
272
273
|
requirements:
|
273
|
-
- - ! '
|
274
|
+
- - ! '>'
|
274
275
|
- !ruby/object:Gem::Version
|
275
|
-
version:
|
276
|
+
version: 1.3.1
|
276
277
|
requirements: []
|
277
278
|
rubyforge_project:
|
278
279
|
rubygems_version: 2.4.5
|
279
280
|
signing_key:
|
280
281
|
specification_version: 4
|
281
|
-
summary: Over's custom CI / CD toolchain, integrating Sprint.ly, Github,
|
282
|
-
ITC
|
282
|
+
summary: Over's custom CI / CD toolchain, integrating Sprint.ly, Github, Travis CI
|
283
|
+
and ITC
|
283
284
|
test_files: []
|