overview 0.0.3.61 → 0.0.4.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,61 +1,30 @@
1
1
  require 'spec_helper'
2
- require 'appversion/ci'
3
- require 'appversion/git'
2
+ require 'helpers/git'
3
+ require 'helpers/ci'
4
+ require 'appversion'
4
5
 
5
6
 
6
-
7
- RSpec.describe '#build_no' do
8
-
9
- include Overview
10
-
7
+ RSpec.describe 'CI#build_no' do
11
8
  it 'returns build number' do
12
9
  build_no = ENV['TRAVIS_BUILD_NUMBER'] || ENV['CIRCLE_BUILD_NUM'] || '1'
13
- expect(Overview::CI.build_no).to eq(build_no)
10
+ expect(CI.build_no).to eq(build_no)
14
11
  end
15
12
  end
16
13
 
17
- RSpec.describe '#clean_tag' do
18
- it '1.2.3-rc4 returns semantic version' do
19
- expect(Overview::Git.clean_tag('1.2.3-rc4')).to eq('1.2.3')
20
- end
21
- it '1.2-rc4 returns semantic version' do
22
- expect(Overview::Git.clean_tag('1.2-rc4')).to eq('1.2')
23
- end
24
- it '1.2-rc4 returns semantic version' do
25
- expect(Overview::Git.clean_tag('1.2-rc4')).to eq('1.2')
26
- end
27
- it '1.2.3 returns semantic version' do
28
- expect(Overview::Git.clean_tag('1.2.3')).to eq('1.2.3')
29
- end
30
- it '1.2.3.4 returns semantic version' do
31
- expect(Overview::Git.clean_tag('1.2.3.4')).to eq('1.2.3')
32
- end
33
- it '1.2.rc4 returns semantic version' do
34
- expect(Overview::Git.clean_tag('1.2.rc4')).to eq('1.2')
35
- end
36
- it '1.2.3.rc4 returns semantic version' do
37
- expect(Overview::Git.clean_tag('1.2.3.rc4')).to eq('1.2.3')
38
- end
39
- it '1.rc4 returns semantic version' do
40
- expect(Overview::Git.clean_tag('1.rc4')).to eq('1')
41
- end
42
- it '1 returns semantic version' do
43
- expect(Overview::Git.clean_tag('1')).to eq('1')
14
+
15
+ RSpec.describe 'Release#is_pre_release?' do
16
+ include AppVersion
17
+ it 'returns true' do
18
+ expect(AppVersion::Release.is_pre_release?('')).to eq(true)
44
19
  end
45
20
  end
46
21
 
47
- RSpec.describe '#tagged_build?' do
48
-
49
- include Overview
50
-
51
- it 'v0.0.3.5 returns true' do
52
- expect(Overview::CI.tagged_build?('v0.0.3.5')).to eq(true)
53
- end
54
- it 'EMPTY returns false' do
55
- expect(Overview::CI.tagged_build?('EMPTY')).to eq(false)
22
+ =begin
23
+ TODO: make these functions deterministic by passing in the tag
24
+ RSpec.describe 'Git#tag' do
25
+ include AppVersion
26
+ it 'returns true' do
27
+ expect(Git.tag.length).to be > 1
56
28
  end
57
-
58
29
  end
59
-
60
-
61
-
30
+ =end
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+ require 'changelog'
3
+ include Changelog
4
+
5
+ =begin
6
+ RSpec.describe 'Log#commit' do
7
+ it 'returns 40 character string' do
8
+ expect(Changelog::Log.new.commit.length).to eq(40)
9
+ end
10
+
11
+ end
12
+ =end
@@ -0,0 +1,196 @@
1
+ require 'spec_helper'
2
+ require 'helpers/ci'
3
+ require 'helpers/git'
4
+
5
+ RSpec.describe 'CI#build_no' do
6
+
7
+ it 'returns build number' do
8
+ build_no = ENV['TRAVIS_BUILD_NUMBER'] || ENV['CIRCLE_BUILD_NUM'] || '1'
9
+ expect(CI.build_no).to eq(build_no)
10
+ end
11
+ end
12
+
13
+ RSpec.describe 'Git#clean_tag' do
14
+ context '1.2.3-rc4' do
15
+ it 'returns semantic version' do
16
+ expect(Git.clean_tag('1.2.3-rc4')).to eq('1.2.3')
17
+ end
18
+ end
19
+
20
+ context '1.2-rc4' do
21
+ it 'returns semantic version' do
22
+ expect(Git.clean_tag('1.2-rc4')).to eq('1.2')
23
+ end
24
+ end
25
+
26
+ it '1.2-rc4 returns semantic version' do
27
+ expect(Git.clean_tag('1.2-rc4')).to eq('1.2')
28
+ end
29
+ it '1.2.3 returns semantic version' do
30
+ expect(Git.clean_tag('1.2.3')).to eq('1.2.3')
31
+ end
32
+ it '1.2.3.4 returns semantic version' do
33
+ expect(Git.clean_tag('1.2.3.4')).to eq('1.2.3')
34
+ end
35
+ it '1.2.rc4 returns semantic version' do
36
+ expect(Git.clean_tag('1.2.rc4')).to eq('1.2')
37
+ end
38
+ it '1.2.3.rc4 returns semantic version' do
39
+ expect(Git.clean_tag('1.2.3.rc4')).to eq('1.2.3')
40
+ end
41
+ it '1.rc4 returns semantic version' do
42
+ expect(Git.clean_tag('1.rc4')).to eq('1')
43
+ end
44
+ it '1 returns semantic version' do
45
+ expect(Git.clean_tag('1')).to eq('1')
46
+ end
47
+ end
48
+
49
+ RSpec.describe 'CI#tagged_build?' do
50
+
51
+ it 'v0.0.3.5 returns true' do
52
+ expect(CI.tagged_build?('v0.0.3.5')).to eq(true)
53
+ end
54
+ it 'EMPTY returns false' do
55
+ expect(CI.tagged_build?('EMPTY')).to eq(false)
56
+ end
57
+
58
+ end
59
+
60
+ RSpec.describe 'Git#parse_deploy' do
61
+
62
+ it '<DEPLOY: deploy message> returns true, deploy message' do
63
+ deploy, message = Git.parse_deploy('This is my change <DEPLOY: deploy message>. Ref #123. This is my second <deploy>')
64
+ expect(deploy).to eq(true)
65
+ expect(message).to eq('deploy message')
66
+ end
67
+ it '<deploy:deploy message> returns true, deploy message' do
68
+ deploy, message = Git.parse_deploy('This is my change <deploy:deploy message>. Ref #123')
69
+ expect(deploy).to eq(true)
70
+ expect(message).to eq('deploy message')
71
+
72
+ end
73
+ it '<deploy> returns true, message' do
74
+ deploy, message = Git.parse_deploy('This is my change <deploy>. Ref #123')
75
+ expect(deploy).to eq(true)
76
+ expect(message).to eq('')
77
+ end
78
+ it 'No brackets returns false, empty message' do
79
+ deploy, message = Git.parse_deploy('This is my change. deploy. Ref #123')
80
+ expect(deploy).to eq(false)
81
+ expect(message).to eq('')
82
+ end
83
+ it "Empty string returns false, empty message" do
84
+ deploy, message = Git.parse_deploy('')
85
+ expect(deploy).to eq(false)
86
+ expect(message).to eq('')
87
+ end
88
+ it 'Missing closing bracket returns true, deploy message' do
89
+ deploy, message = Git.parse_deploy('This is my change <DEPLOY: deploy message')
90
+ expect(deploy).to eq(false)
91
+ expect(message).to eq('')
92
+ end
93
+
94
+ end
95
+
96
+ RSpec.describe 'Git#parse_crashlytics' do
97
+
98
+ it 'C:87 returns 87' do
99
+ ids = Git.parse_crashlytics('Fixed the bug C:87')
100
+ expect(ids.first).to eq(87)
101
+ end
102
+
103
+ it 'c:87 returns 87' do
104
+ ids = Git.parse_crashlytics('Fixed the bug c:87')
105
+ expect(ids.first).to eq(87)
106
+ end
107
+
108
+ it 'c:87 C:27 returns 87,27' do
109
+ ids = Git.parse_crashlytics('Fixed the bug c:87, C:27')
110
+ expect(ids.first).to eq(87)
111
+ expect(ids.last).to eq(27)
112
+ end
113
+
114
+ it 'remove duplicates' do
115
+ ids = Git.parse_crashlytics('Fixed the bug c:87, c:87')
116
+ expect(ids.first).to eq(87)
117
+ expect(ids.length).to eq(1)
118
+ end
119
+
120
+ it '87 27 returns empty array' do
121
+ ids = Git.parse_crashlytics('Fixed the bug 87,27')
122
+ expect(ids.count).to eq(0)
123
+ end
124
+
125
+ end
126
+
127
+
128
+ RSpec.describe 'Git#parse_sprintly' do
129
+
130
+ it 'Ignore duplicates' do
131
+ ids = Git.parse_sprintly('Fixes #87,#87')
132
+ expect(ids.first).to eq(87)
133
+ expect(ids.length).to eq(1)
134
+ end
135
+
136
+ it 'Ignore case of command' do
137
+ ids = Git.parse_sprintly('Fixes #35')
138
+ expect(ids.first).to eq(35)
139
+ expect(ids.count).to eq(1)
140
+ end
141
+
142
+ it 'Ignore case of prefix' do
143
+ ids = Git.parse_sprintly('fixes ticket:35')
144
+ expect(ids.first).to eq(35)
145
+ expect(ids.count).to eq(1)
146
+ end
147
+
148
+ it 'Command required' do
149
+ ids = Git.parse_sprintly('ticket:35')
150
+ expect(ids.count).to eq(0)
151
+ end
152
+
153
+ it 'Reopens ticket:50' do
154
+ ids = Git.parse_sprintly('Reopens ticket:50')
155
+ expect(ids.first).to eq(50)
156
+ end
157
+
158
+ it 'Closes #50' do
159
+ ids = Git.parse_sprintly('Closes #50')
160
+ expect(ids.first).to eq(50)
161
+ end
162
+
163
+ end
164
+
165
+ RSpec.describe 'Git#commit_sha' do
166
+
167
+ it 'returns 40 characters' do
168
+ expect(Git.commit_sha.length).to eq(40)
169
+ end
170
+ end
171
+
172
+ RSpec.describe 'Git#commit_short_sha' do
173
+
174
+ it 'returns 7 characters ' do
175
+ expect(Git.commit_short_sha.length).to eq(7)
176
+ end
177
+ end
178
+
179
+ RSpec.describe 'Git#branch' do
180
+
181
+ it 'returns a branch' do
182
+ expect(Git.branch.length).to be > 1
183
+ end
184
+ end
185
+
186
+ RSpec.describe 'Git#repo' do
187
+
188
+ it 'returns a repo' do
189
+ expect(Git.repo.length).to be > 1
190
+ end
191
+ end
192
+
193
+
194
+
195
+
196
+
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.3.61
4
+ version: 0.0.4.12
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-04-07 00:00:00.000000000 Z
11
+ date: 2015-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -136,6 +136,90 @@ dependencies:
136
136
  - - '='
137
137
  - !ruby/object:Gem::Version
138
138
  version: 3.8.0
139
+ - !ruby/object:Gem::Dependency
140
+ name: httparty
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ! '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ! '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: formatador
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ! '>='
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ! '>='
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: moneta
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ! '>='
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: api_cache
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ! '>='
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ! '>='
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: logging
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ! '>='
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :runtime
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ! '>='
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: faraday-http-cache
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ! '>='
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ type: :runtime
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ! '>='
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
139
223
  description:
140
224
  email: jono@overllc.com
141
225
  executables:
@@ -152,15 +236,19 @@ files:
152
236
  - README.rdoc
153
237
  - Rakefile
154
238
  - bin/overview
155
- - lib/appversion/appversion.rb
156
- - lib/appversion/ci.rb
157
- - lib/appversion/git.rb
158
- - lib/appversion/string.rb
239
+ - lib/appversion.rb
240
+ - lib/changelog.rb
241
+ - lib/helpers/ci.rb
242
+ - lib/helpers/git.rb
243
+ - lib/helpers/github.rb
244
+ - lib/helpers/string.rb
159
245
  - lib/overview.rb
160
246
  - lib/overview/version.rb
161
247
  - overview.gemspec
162
248
  - overview.rdoc
163
249
  - spec/appversion_spec.rb
250
+ - spec/changelog_spec.rb
251
+ - spec/helpers_spec.rb
164
252
  - spec/spec_helper.rb
165
253
  homepage: http://www.overllc.com
166
254
  licenses: []
@@ -190,6 +278,6 @@ rubyforge_project:
190
278
  rubygems_version: 2.4.5
191
279
  signing_key:
192
280
  specification_version: 4
193
- summary: Over's custom CI / CD toolchain, integrating Sprint.ly, Github, Travis and
281
+ summary: Over's custom CI / CD toolchain, integrating Sprint.ly, Github, Github and
194
282
  ITC
195
283
  test_files: []
@@ -1,41 +0,0 @@
1
- require_relative 'string.rb'
2
- require_relative 'ci.rb'
3
-
4
- module Overview
5
-
6
- class Git
7
- def self.remote
8
- begin
9
- `git remote -v show`.lines.first.strip.match(/github\.com[\/|:](.+)\.git/)[1]
10
- rescue
11
- $stderr.puts 'Unable to retrieve slug from >> git remote -v show'
12
- exit 1
13
- end
14
- end
15
- def self.repo
16
- CI.repo || remote
17
- end
18
- def self.branch
19
- CI.branch || `git rev-parse --abbrev-ref HEAD`.strip
20
- end
21
- def self.tag
22
- (`git describe --tags --match 'v*' --abbrev=0 2>/dev/null` || 'HEAD').strip
23
- end
24
- def self.clean_tag(tag=self.tag)
25
- tag.strip.sub('v','').split(/[\.,-]/).select { |e| e.is_number?}.first(3).join('.')
26
- end
27
- def self.commit_count
28
- `git rev-list --count HEAD`
29
- end
30
- def self.commit_count_since_tag(tag)
31
- `git rev-list --count ${tag}.. 2>/dev/null`
32
- end
33
- def self.installed?
34
- system 'git --version >>/dev/null 2>&1'
35
- end
36
- end
37
- def clean_tag
38
- tag.strip.sub('v','').split('.').select { |e| e.is_number?}.join('.')
39
- end
40
- end
41
-