overview 0.0.5.pre.22 → 0.0.6.pre.24
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/.gitignore +2 -1
- data/lib/appversion.rb +11 -11
- data/lib/changelog.rb +6 -81
- data/lib/helpers/cache.rb +17 -0
- data/lib/helpers/ci.rb +2 -1
- data/lib/helpers/git.rb +12 -9
- data/lib/helpers/github.rb +65 -61
- data/lib/helpers/sprintly.rb +117 -0
- data/lib/overview.rb +4 -1
- data/lib/overview/version.rb +1 -1
- data/overview.gemspec +5 -2
- data/spec/appversion_spec.rb +1 -1
- data/spec/helpers_spec.rb +66 -3
- metadata +23 -7
checksums.yaml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
!binary "U0hBMQ==":
|
|
3
3
|
metadata.gz: !binary |-
|
|
4
|
-
|
|
4
|
+
ZWNiYjZhYjBmYmU5NWQ0YjM3ZmI4NzQ3OWFjZTcyYWExODg1ZWU0NQ==
|
|
5
5
|
data.tar.gz: !binary |-
|
|
6
|
-
|
|
6
|
+
ZjhlNGRkZTE1N2EwYTg3OGQ4OTgwY2Y3MWQyYzc3ZDhmZGIyYzNjYg==
|
|
7
7
|
SHA512:
|
|
8
8
|
metadata.gz: !binary |-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
MjBiZDA5OTIzODZjN2IxZTkwYzZmZDViYWMyMDUwZWU2ZjI1YTg1ZGZkYmVj
|
|
10
|
+
YzVjMWI2OTI4ZTMzYjViMmU0YjQ4YWYzMmM0NDVmNjE5NDAxNjRmYjhiM2Ew
|
|
11
|
+
ZGNkMTZlNjBlMmNkNzMyYjY4YTM4N2EwMjNmY2ZlZWIxMjZhZDk=
|
|
12
12
|
data.tar.gz: !binary |-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
YzcyNmM4ZWMyYWM1OTIwMjQyMTQyZmQ1MjZiN2QwNzVjYmY3YzUzZDkyM2Q3
|
|
14
|
+
YzEwOTBiZWJmNzczOWI0NmI3YTFiMWNlYjdmOGRmZDYxNTIzMThlNDE5NGJk
|
|
15
|
+
ZmI3MWIzMTYzYTY4ODk1ODdkNzc5YzVmMzQ5NzZjMmRjY2MzMWY=
|
data/.gitignore
CHANGED
data/lib/appversion.rb
CHANGED
|
@@ -11,7 +11,7 @@ module AppVersion
|
|
|
11
11
|
default
|
|
12
12
|
else
|
|
13
13
|
require 'octokit'
|
|
14
|
-
repo = CI.repo || Git.repo
|
|
14
|
+
repo = Helpers::CI.repo || Git.repo
|
|
15
15
|
$stdout.puts "Repo slug is #{repo}"
|
|
16
16
|
if repo.empty? || ENV['GITHUB_TOKEN'].nil? #for local builds
|
|
17
17
|
$stdout.puts 'GITHUB_TOKEN missing, running locally'
|
|
@@ -47,22 +47,22 @@ module AppVersion
|
|
|
47
47
|
#TODO: refactor so that every permutation can be tested. E.g. github release where is_pre_release=false, what is the commit count?
|
|
48
48
|
#Make this a class method
|
|
49
49
|
def version(semantic:false, rubygem:false)
|
|
50
|
-
version_suffix = CI.version_suffix
|
|
50
|
+
version_suffix = Helpers::CI.version_suffix
|
|
51
51
|
if !Git.installed? then
|
|
52
52
|
$stderr.puts 'Git required, not installed'
|
|
53
53
|
exit 1
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
-
latest_tag = Git.tag
|
|
56
|
+
latest_tag = Helpers::Git.tag
|
|
57
57
|
if latest_tag == 'HEAD'
|
|
58
|
-
commit_count = Git.commit_count
|
|
58
|
+
commit_count = Helpers::Git.commit_count
|
|
59
59
|
clean_tag = '0.0.1'
|
|
60
60
|
elsif latest_tag.empty? #not a git directory
|
|
61
61
|
commit_count = 0
|
|
62
62
|
clean_tag = '0.0.1'
|
|
63
63
|
else
|
|
64
|
-
commit_count = Git.commit_count_since_tag(latest_tag)
|
|
65
|
-
clean_tag = Git.clean_tag(rubygem:rubygem)
|
|
64
|
+
commit_count = Helpers::Git.commit_count_since_tag(latest_tag)
|
|
65
|
+
clean_tag = Helpers::Git.clean_tag(rubygem:rubygem)
|
|
66
66
|
end
|
|
67
67
|
#Only increment version after production release, so that we retain a single version during beta and RCs
|
|
68
68
|
#TODO: check if this is a tagged build, and then always use the clean_tag. Not need to check pre_release or increment
|
|
@@ -70,10 +70,10 @@ module AppVersion
|
|
|
70
70
|
$stdout.puts "Latest tag = #{latest_tag}"
|
|
71
71
|
$stdout.puts "Commit count since tag = #{commit_count}"
|
|
72
72
|
$stdout.puts "Was tag from a Github pre-release? #{is_pre_release}"
|
|
73
|
-
$stdout.puts "Is this a Github release? #{CI.tagged_build?}"
|
|
73
|
+
$stdout.puts "Is this a Github release? #{Helpers::CI.tagged_build?}"
|
|
74
74
|
|
|
75
75
|
#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
|
|
76
|
-
if CI.tagged_build? || commit_count == 0 || is_pre_release
|
|
76
|
+
if Helpers::CI.tagged_build? || commit_count == 0 || is_pre_release
|
|
77
77
|
short_version = clean_tag
|
|
78
78
|
else
|
|
79
79
|
short_version = clean_tag.increment_version
|
|
@@ -88,11 +88,11 @@ module AppVersion
|
|
|
88
88
|
end
|
|
89
89
|
|
|
90
90
|
def build_no
|
|
91
|
-
CI.build_no
|
|
91
|
+
Helpers::CI.build_no
|
|
92
92
|
end
|
|
93
93
|
|
|
94
94
|
def suffix
|
|
95
|
-
branch = CI.branch || Git.branch
|
|
95
|
+
branch = Helpers::CI.branch || Git.branch
|
|
96
96
|
$stdout.puts "Branch = #{branch}"
|
|
97
97
|
case branch
|
|
98
98
|
when /develop/
|
|
@@ -109,7 +109,7 @@ module AppVersion
|
|
|
109
109
|
suffix = '-debug'
|
|
110
110
|
end
|
|
111
111
|
#special case for github releases
|
|
112
|
-
if CI.tagged_build?
|
|
112
|
+
if Helpers::CI.tagged_build?
|
|
113
113
|
$stdout.puts 'Tagged build, suppressing branch suffix'
|
|
114
114
|
suffix = ''
|
|
115
115
|
end
|
data/lib/changelog.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module Changelog
|
|
2
2
|
|
|
3
|
-
require '
|
|
3
|
+
require 'typhoeus'
|
|
4
4
|
require 'json'
|
|
5
5
|
require 'octokit'
|
|
6
6
|
require 'formatador'
|
|
@@ -15,7 +15,7 @@ module Changelog
|
|
|
15
15
|
require 'faraday-http-cache'
|
|
16
16
|
=begin
|
|
17
17
|
TODO:
|
|
18
|
-
|
|
18
|
+
*** This is now completed broken ****
|
|
19
19
|
More than I can comprehend...
|
|
20
20
|
Keep all incoming data in original format, so that it can be reproccessed. e.g. Make calls. Store Data. Retrieve data. Process data. Display data. Deploy.
|
|
21
21
|
Mark sprint.ly items as deployed if complete. This will eventually be in a separate script.
|
|
@@ -33,9 +33,7 @@ Deployment logic to work differently for feature branches... I think
|
|
|
33
33
|
@logger = Logging.logger[self]
|
|
34
34
|
@logger.add_appenders \
|
|
35
35
|
Logging.appenders.stdout,
|
|
36
|
-
Logging.appenders.file(
|
|
37
|
-
@logger.level = :info
|
|
38
|
-
|
|
36
|
+
Logging.appenders.file("#{self.class.name}.log")
|
|
39
37
|
APICache.store = Moneta.new(:YAML, :file => "#{self.class.name}_cache")
|
|
40
38
|
APICache.logger.level = Logger::DEBUG
|
|
41
39
|
|
|
@@ -99,80 +97,7 @@ Deployment logic to work differently for feature branches... I think
|
|
|
99
97
|
end
|
|
100
98
|
end
|
|
101
99
|
|
|
102
|
-
class Item
|
|
103
|
-
def initialize(title, id, description, sha, date, source, type=nil, status=nil, author=nil, environments=nil)
|
|
104
|
-
type ||="NA"
|
|
105
|
-
status ||="UNKNOWN"
|
|
106
|
-
author ||="UNKNOWN"
|
|
107
|
-
environments ||= []
|
|
108
|
-
@title = title.delete("\n")
|
|
109
|
-
@description = description
|
|
110
|
-
@sha = sha
|
|
111
|
-
@date = date
|
|
112
|
-
@id = id
|
|
113
|
-
@source = source
|
|
114
|
-
@type = type
|
|
115
|
-
@status = status
|
|
116
|
-
@author = author
|
|
117
|
-
@environments = environments
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
def inspect
|
|
121
|
-
"<#{@source} #{@type.upcase} ##{@id} : #{self.status} : #{@title}>"
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
def title
|
|
125
|
-
return @title
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
def date
|
|
129
|
-
return @date
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
def type
|
|
133
|
-
return @type
|
|
134
|
-
end
|
|
135
|
-
|
|
136
|
-
def author
|
|
137
|
-
return @author
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
def environments
|
|
141
|
-
return @environments.any? ? @environments : nil
|
|
142
|
-
end
|
|
143
|
-
|
|
144
|
-
def sha
|
|
145
|
-
return @sha
|
|
146
|
-
end
|
|
147
|
-
|
|
148
|
-
def id
|
|
149
|
-
return @id
|
|
150
|
-
end
|
|
151
|
-
|
|
152
|
-
def status
|
|
153
|
-
return @status.nil? ? "NA" : @status.upcase
|
|
154
|
-
end
|
|
155
|
-
|
|
156
|
-
def source
|
|
157
|
-
return @source
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
def sprintly?
|
|
161
|
-
return self.source.upcase == "SPRINT.LY"
|
|
162
|
-
end
|
|
163
|
-
|
|
164
|
-
def complete?
|
|
165
|
-
return %w(COMPLETED ACCEPTED).include?(self.status)
|
|
166
|
-
end
|
|
167
100
|
|
|
168
|
-
def built?
|
|
169
|
-
return self.environments.join.scan(/#(\d+)/).any? unless self.environments.nil?
|
|
170
|
-
end
|
|
171
|
-
|
|
172
|
-
def released?
|
|
173
|
-
return self.environments.join.scan(/v(\d+)/).any? unless self.environments.nil?
|
|
174
|
-
end
|
|
175
|
-
end
|
|
176
101
|
|
|
177
102
|
class Log < Base
|
|
178
103
|
def githubReleaseStatus(release=nil)
|
|
@@ -283,7 +208,7 @@ Deployment logic to work differently for feature branches... I think
|
|
|
283
208
|
|
|
284
209
|
def crashlyticsItem(title, id, sha, date, author)
|
|
285
210
|
#puts " " + item["type"].capitalize + " " + item["number"].to_s + ": " + item["title"]
|
|
286
|
-
return
|
|
211
|
+
return SprintlyItem.new(title, id, "NA", sha, date, "Crashlytics", "crash", nil, author)
|
|
287
212
|
end
|
|
288
213
|
|
|
289
214
|
#TODO - consider returning sprint.ly story rather than task
|
|
@@ -293,13 +218,13 @@ Deployment logic to work differently for feature branches... I think
|
|
|
293
218
|
APICache.get(url, :timeout => 30, :fail => []) do
|
|
294
219
|
response = HTTParty.get(url, :basic_auth => @auth)
|
|
295
220
|
item = JSON.parse(response.body)
|
|
296
|
-
|
|
221
|
+
SprintlyItem.new(item["title"], item["number"], item["description"], sha, date, "Sprint.ly", item["type"], item["status"], author, item["deployed_to"])
|
|
297
222
|
end
|
|
298
223
|
end
|
|
299
224
|
|
|
300
225
|
def commitItem(commit)
|
|
301
226
|
APICache.get(commit.sha, :fail => []) do
|
|
302
|
-
|
|
227
|
+
SprintlyItem.new(commit.commit.message.lines.first, commit.sha[0..6], commit.commit.message, commit.sha, commit.commit.author.date, "Github", "commit", "NA", commit.commit.author.name)
|
|
303
228
|
end
|
|
304
229
|
end
|
|
305
230
|
|
data/lib/helpers/ci.rb
CHANGED
data/lib/helpers/git.rb
CHANGED
|
@@ -59,20 +59,23 @@ module Helpers
|
|
|
59
59
|
return commitMessage.scan(/(c|C):(?<crashlytics>\d+)/).flatten.collect { |x| x.to_i }.uniq
|
|
60
60
|
end
|
|
61
61
|
def self.parse_sprintly(commitMessage)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
#logic from https://github.com/sprintly/sprintly-commit-parser/blob/master/sprintly_commit_parser/commit_parser.py
|
|
63
|
+
commandsRE = Regexp.new(/(?<action>[A-Za-z]*) ?(task|issue|defect|bug|item|ticket|:)?.?(?<ticket>(?:#|(?:ticket|issue|item|defect|bug)[: ]?)(\d+)(?:(?:[, &]*|[ ,]+?and[ ]?)(?:#|(?:ticket|issue|item|defect|bug)[: ]?)(\d+))*)/)
|
|
64
|
+
ticketsRE = Regexp.new(/(?:#|(?:ticket|issue|item|defect|bug)[: ]?)(\d+)/)
|
|
65
|
+
commands = commitMessage.downcase.scan(commandsRE)
|
|
66
|
+
tickets = commands.collect { |command|
|
|
67
|
+
command.last.scan(ticketsRE) unless command.first.empty? #only collect tickets with commands
|
|
68
|
+
}
|
|
69
|
+
return tickets.flatten.compact.collect{ |x| x.to_i }.uniq
|
|
66
70
|
end
|
|
67
71
|
def self.parse_commit_message(commitMessage)
|
|
68
72
|
h = {}
|
|
69
|
-
deploy
|
|
73
|
+
deploy = self.parse_deploy(commitMessage)
|
|
70
74
|
sprintly_tickets = self.parse_sprintly(commitMessage)
|
|
71
75
|
crashlytics_ids = self.parse_crashlytics(commitMessage)
|
|
72
|
-
h[
|
|
73
|
-
h[
|
|
74
|
-
h[
|
|
75
|
-
h["crashlytics"] = crashlytics_ids
|
|
76
|
+
h[:deploy] = deploy
|
|
77
|
+
h[:sprintly] = sprintly_tickets
|
|
78
|
+
h[:crashlytics] = crashlytics_ids
|
|
76
79
|
return h
|
|
77
80
|
end
|
|
78
81
|
def self.commit_sha
|
data/lib/helpers/github.rb
CHANGED
|
@@ -2,80 +2,84 @@ require 'api_cache'
|
|
|
2
2
|
require 'moneta'
|
|
3
3
|
require 'octokit'
|
|
4
4
|
#TODO - this is actually a github class
|
|
5
|
-
|
|
6
|
-
#TODO make this a singleton
|
|
7
|
-
#TODO add repo, and branch to cache keys
|
|
8
|
-
def initialize(repo, branch, github_token=ENV['GITHUB_TOKEN'])
|
|
9
|
-
#TODO: inherit from base class
|
|
10
|
-
@github_token = github_token
|
|
11
|
-
@repo = repo
|
|
12
|
-
@branch = branch
|
|
13
|
-
@logger = Logging.logger[self]
|
|
14
|
-
@logger.add_appenders \
|
|
15
|
-
Logging.appenders.stdout,
|
|
16
|
-
Logging.appenders.file('overview.log')
|
|
17
|
-
@logger.level = :info
|
|
5
|
+
module Helpers
|
|
18
6
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
#
|
|
22
|
-
|
|
7
|
+
class Github
|
|
8
|
+
#TODO make this a singleton
|
|
9
|
+
#TODO add repo, and branch to cache keys
|
|
10
|
+
def initialize(repo, branch, github_token=ENV['GITHUB_TOKEN'])
|
|
11
|
+
#TODO: inherit from base class
|
|
12
|
+
@github_token = github_token
|
|
13
|
+
if !@github_token || @github_token.empty?
|
|
14
|
+
$stderr.puts 'github_token missing. Unable to authenticate with Github. Aborting...'
|
|
15
|
+
exit 1
|
|
16
|
+
end
|
|
17
|
+
@repo = repo
|
|
18
|
+
@branch = branch
|
|
19
|
+
@logger = Logging.logger[self]
|
|
20
|
+
@logger.add_appenders \
|
|
21
|
+
Logging.appenders.stdout,
|
|
22
|
+
Logging.appenders.file('overview.log')
|
|
23
|
+
@logger.level = :info
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
@client.auto_paginate = true
|
|
28
|
-
@client.default_media_type = "application/vnd.github.moondragon+json"
|
|
29
|
-
@logger.info "Connected to Github" if @client
|
|
25
|
+
APICache.store = Moneta.new(:YAML, :file => "#{self.class.name}_cache")
|
|
26
|
+
APICache.logger.level = Logger::INFO
|
|
27
|
+
#APICache.store = nil
|
|
30
28
|
end
|
|
31
|
-
@client
|
|
32
|
-
end
|
|
33
29
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
@logger.info "Retrieved hooks for #{@repo}" if @hooks
|
|
37
|
-
@hooks
|
|
38
|
-
end
|
|
30
|
+
def client
|
|
31
|
+
if !@client
|
|
39
32
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
33
|
+
@client = Octokit::Client.new(:access_token => @github_token)
|
|
34
|
+
@client.auto_paginate = true
|
|
35
|
+
@client.default_media_type = "application/vnd.github.moondragon+json"
|
|
36
|
+
@logger.info "Connected to Github as #{@client.user[:login]}"
|
|
37
|
+
end
|
|
38
|
+
@client
|
|
39
|
+
end
|
|
45
40
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
product_id = hooks.map { |h| h.config.product_id }.compact.first
|
|
51
|
-
@logger.info "Sprint.ly product_id = #{product_id}" if product_id
|
|
52
|
-
product_id
|
|
41
|
+
def hooks
|
|
42
|
+
@hooks = client.hooks(@repo) unless @hooks
|
|
43
|
+
@logger.info "Retrieved hooks for #{@repo}" if @hooks
|
|
44
|
+
@hooks
|
|
53
45
|
end
|
|
54
|
-
end
|
|
55
46
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
47
|
+
def releases
|
|
48
|
+
#APICache.get("releases") do
|
|
49
|
+
client.releases(@repo)
|
|
50
|
+
#end
|
|
51
|
+
end
|
|
61
52
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
53
|
+
def sprintly_product_id
|
|
54
|
+
product_id = hooks.map { |h| h.config.product_id }.compact.first
|
|
55
|
+
@logger.info "Sprint.ly product_id = #{product_id}" if product_id
|
|
56
|
+
product_id
|
|
57
|
+
end
|
|
67
58
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
59
|
+
def ref(tag)
|
|
60
|
+
#APICache.get("ref_#{tag}") do
|
|
61
|
+
client.ref(@repo, "tags/" + tag)
|
|
62
|
+
#end
|
|
63
|
+
end
|
|
73
64
|
|
|
74
|
-
|
|
65
|
+
def commit(sha)
|
|
66
|
+
#APICache.get("commit_#{sha}") do
|
|
67
|
+
client.commit(@repo, sha)
|
|
68
|
+
#end
|
|
69
|
+
end
|
|
75
70
|
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
def commits_since(since)
|
|
72
|
+
#APICache.get("commit_since_#{since}") do
|
|
73
|
+
client.commits_since(@repo, since, @branch)
|
|
74
|
+
#end
|
|
75
|
+
end
|
|
78
76
|
|
|
77
|
+
def commits_between(from,to)
|
|
78
|
+
|
|
79
|
+
end
|
|
80
|
+
def commits_before(to)
|
|
81
|
+
|
|
82
|
+
end
|
|
79
83
|
end
|
|
80
84
|
end
|
|
81
85
|
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
module Helpers
|
|
2
|
+
class Base
|
|
3
|
+
require 'logging'
|
|
4
|
+
|
|
5
|
+
def initialize
|
|
6
|
+
@logger = Logging.logger[self]
|
|
7
|
+
@logger.add_appenders \
|
|
8
|
+
Logging.appenders.stdout,
|
|
9
|
+
Logging.appenders.file("#{self.class.name}.log")
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
class SprintlyItem
|
|
14
|
+
require 'uri'
|
|
15
|
+
|
|
16
|
+
attr_accessor :title
|
|
17
|
+
attr_accessor :date
|
|
18
|
+
attr_accessor :description
|
|
19
|
+
attr_accessor :source
|
|
20
|
+
attr_accessor :author
|
|
21
|
+
attr_accessor :id
|
|
22
|
+
attr_accessor :hackpads
|
|
23
|
+
attr_accessor :url
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
HACKPADURL = "hackpad.com"
|
|
27
|
+
|
|
28
|
+
def initialize(json)
|
|
29
|
+
|
|
30
|
+
type ||="NA"
|
|
31
|
+
status ||="UNKNOWN"
|
|
32
|
+
author ||="UNKNOWN"
|
|
33
|
+
environments ||= []
|
|
34
|
+
|
|
35
|
+
@title = json["title"]
|
|
36
|
+
@id = json["number"]
|
|
37
|
+
@description = json["description"]
|
|
38
|
+
@source = "Sprint.ly"
|
|
39
|
+
@type = json["type"]
|
|
40
|
+
@status = json["status"]
|
|
41
|
+
@author = author
|
|
42
|
+
@url = json["short_url"]
|
|
43
|
+
|
|
44
|
+
urls = URI.extract(@description)
|
|
45
|
+
urls.select! { |u| u.include?(HACKPADURL)}
|
|
46
|
+
|
|
47
|
+
@hackpads = urls
|
|
48
|
+
# json["deployed_to"])
|
|
49
|
+
|
|
50
|
+
# @title = title.delete("\n")
|
|
51
|
+
# @description = description
|
|
52
|
+
# @sha = sha
|
|
53
|
+
# @date = date
|
|
54
|
+
# @id = id
|
|
55
|
+
# @source = source
|
|
56
|
+
# @type = type
|
|
57
|
+
# @status = status
|
|
58
|
+
# @author = author
|
|
59
|
+
# @environments = environments
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def inspect
|
|
63
|
+
"<#{@source} #{@type.upcase} ##{@id} : #{self.status} : #{@title}>"
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def environments
|
|
67
|
+
return @environments.any? ? @environments : nil
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def sha
|
|
71
|
+
return @sha
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def id
|
|
75
|
+
return @id
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def status
|
|
79
|
+
return @status.nil? ? "NA" : @status.upcase
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def complete?
|
|
83
|
+
return %w(COMPLETED ACCEPTED).include?(self.status)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def built?
|
|
87
|
+
return self.environments.join.scan(/#(\d+)/).any? unless self.environments.nil?
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def released?
|
|
91
|
+
return self.environments.join.scan(/v(\d+)/).any? unless self.environments.nil?
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
class Sprintly < Base
|
|
96
|
+
|
|
97
|
+
require 'typhoeus'
|
|
98
|
+
|
|
99
|
+
def initialize(product_id, sprintlyUser = ENV['SPRINTLY_USER'], sprintlyAPIKey = ENV['SPRINTLY_API_KEY'], cache=nil)
|
|
100
|
+
super()
|
|
101
|
+
Typhoeus::Config.cache = cache
|
|
102
|
+
@auth = "#{sprintlyUser}:#{sprintlyAPIKey}"
|
|
103
|
+
@product_id = product_id
|
|
104
|
+
@end_point = "https://sprint.ly/api/products/"
|
|
105
|
+
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def sprintlyItem(id)
|
|
109
|
+
|
|
110
|
+
url = @end_point + @product_id.to_s + "/items/" + id.to_s + ".json"
|
|
111
|
+
response = Typhoeus::Request.get(url, userpwd: @auth)
|
|
112
|
+
item = SprintlyItem.new(JSON.parse(response.body))
|
|
113
|
+
return item
|
|
114
|
+
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
end
|
data/lib/overview.rb
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
require_relative 'overview/version.rb'
|
|
2
2
|
require_relative 'helpers/git.rb'
|
|
3
3
|
require_relative 'helpers/ci.rb'
|
|
4
|
-
require_relative 'helpers/
|
|
4
|
+
require_relative 'helpers/sprintly.rb'
|
|
5
|
+
require_relative 'helpers/github.rb'
|
|
6
|
+
require_relative 'helpers/cache.rb'
|
|
7
|
+
|
|
5
8
|
require_relative 'appversion.rb'
|
|
6
9
|
require_relative 'changelog.rb'
|
|
7
10
|
|
data/lib/overview/version.rb
CHANGED
data/overview.gemspec
CHANGED
|
@@ -27,11 +27,14 @@ spec = Gem::Specification.new do |s|
|
|
|
27
27
|
s.add_development_dependency('codeclimate-test-reporter')
|
|
28
28
|
s.add_development_dependency('gem-release')
|
|
29
29
|
s.add_runtime_dependency('gli','2.13.0')
|
|
30
|
-
s.add_runtime_dependency('octokit','
|
|
30
|
+
s.add_runtime_dependency('octokit','4.0.1')
|
|
31
31
|
s.add_runtime_dependency('httparty')
|
|
32
32
|
s.add_runtime_dependency('formatador')
|
|
33
33
|
s.add_runtime_dependency('moneta')
|
|
34
|
-
s.add_runtime_dependency('api_cache')
|
|
35
34
|
s.add_runtime_dependency('logging')
|
|
36
35
|
s.add_runtime_dependency('faraday-http-cache')
|
|
36
|
+
s.add_runtime_dependency('typhoeus')
|
|
37
|
+
s.add_runtime_dependency('api_cache')
|
|
38
|
+
|
|
39
|
+
|
|
37
40
|
end
|
data/spec/appversion_spec.rb
CHANGED
data/spec/helpers_spec.rb
CHANGED
|
@@ -2,6 +2,9 @@ require 'spec_helper'
|
|
|
2
2
|
require 'helpers/ci'
|
|
3
3
|
require 'helpers/git'
|
|
4
4
|
require 'helpers/string'
|
|
5
|
+
require 'helpers/sprintly'
|
|
6
|
+
require 'helpers/cache'
|
|
7
|
+
require 'pp'
|
|
5
8
|
|
|
6
9
|
|
|
7
10
|
include Helpers
|
|
@@ -198,6 +201,28 @@ RSpec.describe 'Git#parse_sprintly' do
|
|
|
198
201
|
expect(ids.first).to eq(50)
|
|
199
202
|
end
|
|
200
203
|
|
|
204
|
+
it 'Supports multiple items e.g. #50,#20' do
|
|
205
|
+
ids = Git.parse_sprintly('Closes #50,#20')
|
|
206
|
+
expect(ids.count).to eq(2)
|
|
207
|
+
expect(ids.first).to eq(50)
|
|
208
|
+
expect(ids.last).to eq(20)
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
it 'Supports multiple items e.g. #50, #20' do
|
|
213
|
+
ids = Git.parse_sprintly('Closes #50, #20')
|
|
214
|
+
expect(ids.count).to eq(2)
|
|
215
|
+
expect(ids.first).to eq(50)
|
|
216
|
+
expect(ids.last).to eq(20)
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
it 'Supports multiple items e.g. item:50, item:20' do
|
|
220
|
+
ids = Git.parse_sprintly('Closes item:50, item:20')
|
|
221
|
+
expect(ids.count).to eq(2)
|
|
222
|
+
expect(ids.first).to eq(50)
|
|
223
|
+
expect(ids.last).to eq(20)
|
|
224
|
+
end
|
|
225
|
+
|
|
201
226
|
end
|
|
202
227
|
|
|
203
228
|
RSpec.describe 'Git#commit_sha' do
|
|
@@ -221,14 +246,52 @@ RSpec.describe 'Git#branch' do
|
|
|
221
246
|
end
|
|
222
247
|
end
|
|
223
248
|
|
|
224
|
-
RSpec.describe 'Git#
|
|
249
|
+
RSpec.describe 'Git#parse_commit_message' do
|
|
250
|
+
|
|
251
|
+
it 'returns a populated hash' do
|
|
252
|
+
hash = Git.parse_commit_message("Fixes #1, #2 <DEPLOY #engineering This is a test>")
|
|
253
|
+
expect(hash[:deploy][:match]).to eq(true)
|
|
254
|
+
pp hash[:sprintly]
|
|
255
|
+
expect(hash[:sprintly].first).to eq(1)
|
|
256
|
+
expect(hash[:sprintly].last).to eq(2)
|
|
225
257
|
|
|
226
|
-
it 'returns a repo' do
|
|
227
|
-
expect(Git.repo.length).to be > 1
|
|
228
258
|
end
|
|
229
259
|
end
|
|
230
260
|
|
|
231
261
|
|
|
262
|
+
RSpec.describe 'Sprintly#retrieveSprintlyItem' do
|
|
263
|
+
it 'returns hackpad item' do
|
|
264
|
+
cache = Cache.new
|
|
265
|
+
sprintly = Sprintly.new(30420,"jono+overview+test@overllc.com", "kPnNLnM8pjkYeS9sMvrQPhj6JkC4mcNL", cache)
|
|
266
|
+
item = sprintly.sprintlyItem(1)
|
|
267
|
+
|
|
268
|
+
expect(item.hackpads.count).to eq(1)
|
|
269
|
+
end
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
RSpec.describe 'Sprintly#retrieveSprintlyItem' do
|
|
273
|
+
it 'returns sprintly item with id' do
|
|
274
|
+
cache = Cache.new
|
|
275
|
+
sprintly = Sprintly.new(30420,"jono+overview+test@overllc.com", "kPnNLnM8pjkYeS9sMvrQPhj6JkC4mcNL", cache)
|
|
276
|
+
item = sprintly.sprintlyItem(1)
|
|
277
|
+
item = sprintly.sprintlyItem(1)
|
|
278
|
+
|
|
279
|
+
expect(item.id).to eq(1)
|
|
280
|
+
end
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
RSpec.describe 'Sprintly#retrieveSprintlyItem' do
|
|
284
|
+
it 'returns hackpad item' do
|
|
285
|
+
cache = Cache.new
|
|
286
|
+
sprintly = Sprintly.new(30420,"jono+overview+test@overllc.com", "kPnNLnM8pjkYeS9sMvrQPhj6JkC4mcNL", cache)
|
|
287
|
+
item = sprintly.sprintlyItem(1)
|
|
288
|
+
|
|
289
|
+
expect(item.hackpads.count).to eq(1)
|
|
290
|
+
end
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
|
|
232
295
|
|
|
233
296
|
|
|
234
297
|
|
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.6.pre.24
|
|
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-07-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|
|
@@ -128,14 +128,14 @@ dependencies:
|
|
|
128
128
|
requirements:
|
|
129
129
|
- - '='
|
|
130
130
|
- !ruby/object:Gem::Version
|
|
131
|
-
version:
|
|
131
|
+
version: 4.0.1
|
|
132
132
|
type: :runtime
|
|
133
133
|
prerelease: false
|
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
|
135
135
|
requirements:
|
|
136
136
|
- - '='
|
|
137
137
|
- !ruby/object:Gem::Version
|
|
138
|
-
version:
|
|
138
|
+
version: 4.0.1
|
|
139
139
|
- !ruby/object:Gem::Dependency
|
|
140
140
|
name: httparty
|
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -179,7 +179,7 @@ dependencies:
|
|
|
179
179
|
- !ruby/object:Gem::Version
|
|
180
180
|
version: '0'
|
|
181
181
|
- !ruby/object:Gem::Dependency
|
|
182
|
-
name:
|
|
182
|
+
name: logging
|
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
|
184
184
|
requirements:
|
|
185
185
|
- - ! '>='
|
|
@@ -193,7 +193,7 @@ dependencies:
|
|
|
193
193
|
- !ruby/object:Gem::Version
|
|
194
194
|
version: '0'
|
|
195
195
|
- !ruby/object:Gem::Dependency
|
|
196
|
-
name:
|
|
196
|
+
name: faraday-http-cache
|
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
|
198
198
|
requirements:
|
|
199
199
|
- - ! '>='
|
|
@@ -207,7 +207,21 @@ dependencies:
|
|
|
207
207
|
- !ruby/object:Gem::Version
|
|
208
208
|
version: '0'
|
|
209
209
|
- !ruby/object:Gem::Dependency
|
|
210
|
-
name:
|
|
210
|
+
name: typhoeus
|
|
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'
|
|
223
|
+
- !ruby/object:Gem::Dependency
|
|
224
|
+
name: api_cache
|
|
211
225
|
requirement: !ruby/object:Gem::Requirement
|
|
212
226
|
requirements:
|
|
213
227
|
- - ! '>='
|
|
@@ -238,9 +252,11 @@ files:
|
|
|
238
252
|
- bin/overview
|
|
239
253
|
- lib/appversion.rb
|
|
240
254
|
- lib/changelog.rb
|
|
255
|
+
- lib/helpers/cache.rb
|
|
241
256
|
- lib/helpers/ci.rb
|
|
242
257
|
- lib/helpers/git.rb
|
|
243
258
|
- lib/helpers/github.rb
|
|
259
|
+
- lib/helpers/sprintly.rb
|
|
244
260
|
- lib/helpers/string.rb
|
|
245
261
|
- lib/overview.rb
|
|
246
262
|
- lib/overview/version.rb
|