releasecop 0.0.8 → 0.0.9
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 +4 -4
- data/CHANGELOG.md +7 -1
- data/lib/releasecop/checker.rb +3 -3
- data/lib/releasecop/comparison.rb +17 -15
- data/lib/releasecop/manifest_item.rb +31 -29
- data/lib/releasecop/result.rb +36 -32
- data/lib/releasecop/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80b447cdd1baf76fd9563d55b07097551d7bc04b6a17f1100f0bc86525378850
|
4
|
+
data.tar.gz: '098356e8e0b7e83de38bf62e9d29a79f4cc6b16a434d2fcded1fda3e4d0b704d'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e1b9a92d37b352b57d8ea7f4f13dabbd025a37fff5be9803a8e5ffacdbecb3ea528e7b37dd5532aba18378a9abc20214da0b122a2454f9712c584d0076723b1
|
7
|
+
data.tar.gz: 2478e9f8bd5df7802bc64be5105b0ccceaaccb0f62dc93e43a6b49d0aca45429d05559b5b9789ac29cfeec2e69a3388d2a032c55826201b21d3e0eaf2f6c7a47
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
(Next)
|
2
2
|
------------
|
3
3
|
|
4
|
-
* Your contribution here
|
4
|
+
* Your contribution here...
|
5
|
+
|
6
|
+
0.0.9 (2018-08-20)
|
7
|
+
------------
|
8
|
+
|
9
|
+
* Properly namespace internal classes (5439cc9)
|
10
|
+
* Expose `Result#name` and `#comparisons` (2ea111c)
|
5
11
|
|
6
12
|
0.0.8 (2018-07-23)
|
7
13
|
---
|
data/lib/releasecop/checker.rb
CHANGED
@@ -4,7 +4,7 @@ module Releasecop
|
|
4
4
|
|
5
5
|
def initialize(name, envs)
|
6
6
|
self.name = name
|
7
|
-
self.envs = envs.map { |e| ManifestItem.new(name, e) }
|
7
|
+
self.envs = envs.map { |e| Releasecop::ManifestItem.new(name, e) }
|
8
8
|
end
|
9
9
|
|
10
10
|
def check
|
@@ -19,11 +19,11 @@ module Releasecop
|
|
19
19
|
|
20
20
|
comparisons = []
|
21
21
|
envs.each_cons(2) do |ahead, behind|
|
22
|
-
comparisons << Comparison.new(ahead, behind)
|
22
|
+
comparisons << Releasecop::Comparison.new(ahead, behind)
|
23
23
|
end
|
24
24
|
|
25
25
|
comparisons.each &:check
|
26
|
-
@result = Result.new(name, comparisons)
|
26
|
+
@result = Releasecop::Result.new(name, comparisons)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -1,22 +1,24 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
module Releasecop
|
2
|
+
class Comparison
|
3
|
+
attr_accessor :lines, :behind, :ahead
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
def initialize(ahead, behind)
|
6
|
+
@ahead = ahead
|
7
|
+
@behind = behind
|
8
|
+
end
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
def check
|
11
|
+
@lines = log.lines
|
12
|
+
end
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
14
|
+
def unreleased?
|
15
|
+
!lines.empty?
|
16
|
+
end
|
16
17
|
|
17
|
-
|
18
|
+
private
|
18
19
|
|
19
|
-
|
20
|
-
|
20
|
+
def log
|
21
|
+
`git log #{@behind.for_rev_range}..#{@ahead.for_rev_range} --pretty=format:"%h %ad %s (%an)" --date=short --no-merges`
|
22
|
+
end
|
21
23
|
end
|
22
24
|
end
|
@@ -1,38 +1,40 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
module Releasecop
|
2
|
+
class ManifestItem
|
3
|
+
OPTION_KEYS = %w[hokusai tag_pattern]
|
4
|
+
attr_reader :git, :branch, :name
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
def initialize(repo_name, item)
|
7
|
+
@repo_name = repo_name
|
8
|
+
@git = item['git']
|
9
|
+
@name = item['name']
|
10
|
+
@branch = item['branch'] || 'master'
|
11
|
+
@options = item.select { |k, _v| OPTION_KEYS.include?(k) }
|
12
|
+
end
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
def for_rev_range
|
15
|
+
@sha ||= find_tag_pattern_sha if @options['tag_pattern']
|
16
|
+
@sha ||= find_hokusai_sha if @options['hokusai']
|
17
|
+
@sha || [@name, @branch].join('/')
|
18
|
+
end
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
20
|
+
def bare_clone?
|
21
|
+
!@options.key?('hokusai')
|
22
|
+
end
|
22
23
|
|
23
|
-
|
24
|
+
private
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
|
26
|
+
def working_dir
|
27
|
+
"#{@repo_name}-#{@name}-working"
|
28
|
+
end
|
28
29
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
def find_hokusai_sha
|
31
|
+
images_output = `hokusai registry images`
|
32
|
+
tags = images_output.lines.grep(/\d{4}.* | .* | .*/).map{|l| l.split(' | ').last.split(',').map(&:strip)}
|
33
|
+
tags.detect{|t| t.include?(@options['hokusai']) }.detect{|t| t[/^[0-9a-f]{40}$/]}
|
34
|
+
end
|
34
35
|
|
35
|
-
|
36
|
-
|
36
|
+
def find_tag_pattern_sha
|
37
|
+
`git for-each-ref --format='%(objectname)' --count=1 --sort=-authordate --sort=-committerdate 'refs/tags/#{@options['tag_pattern']}'`.strip
|
38
|
+
end
|
37
39
|
end
|
38
40
|
end
|
data/lib/releasecop/result.rb
CHANGED
@@ -1,44 +1,48 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
@comparisons = comparisons
|
5
|
-
end
|
1
|
+
module Releasecop
|
2
|
+
class Result
|
3
|
+
attr_accessor :name, :comparisons
|
6
4
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
else
|
11
|
-
puts message if unreleased?
|
5
|
+
def initialize(name, comparisons)
|
6
|
+
@name = name
|
7
|
+
@comparisons = comparisons
|
12
8
|
end
|
13
|
-
end
|
14
9
|
|
15
|
-
|
16
|
-
|
17
|
-
|
10
|
+
def puts_message(verbose_flag)
|
11
|
+
if verbose_flag
|
12
|
+
puts message
|
13
|
+
else
|
14
|
+
puts message if unreleased?
|
15
|
+
end
|
16
|
+
end
|
18
17
|
|
19
|
-
|
18
|
+
def unreleased
|
19
|
+
@comparisons.select(&:unreleased?).count
|
20
|
+
end
|
20
21
|
|
21
|
-
|
22
|
-
[header, *comparison_messages].join "\n"
|
23
|
-
end
|
22
|
+
private
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
def message
|
25
|
+
[header, *comparison_messages].join "\n"
|
26
|
+
end
|
28
27
|
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
def header
|
29
|
+
"#{@name}..."
|
30
|
+
end
|
32
31
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
32
|
+
def unreleased?
|
33
|
+
unreleased > 0
|
34
|
+
end
|
35
|
+
|
36
|
+
def comparison_messages
|
37
|
+
@comparisons.map do |comparison|
|
38
|
+
summary = if comparison.unreleased?
|
39
|
+
" #{comparison.behind.name} is behind #{comparison.ahead.name} by:\n"
|
40
|
+
else
|
41
|
+
" #{comparison.behind.name} is up-to-date with #{comparison.ahead.name}"
|
42
|
+
end
|
43
|
+
detailed_messages = comparison.lines.map { |l| " #{l}" }
|
44
|
+
[summary, *detailed_messages].join
|
39
45
|
end
|
40
|
-
detailed_messages = comparison.lines.map { |l| " #{l}" }
|
41
|
-
[summary, *detailed_messages].join
|
42
46
|
end
|
43
47
|
end
|
44
48
|
end
|
data/lib/releasecop/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: releasecop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joey Aghion
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
109
|
version: '0'
|
110
110
|
requirements: []
|
111
111
|
rubyforge_project:
|
112
|
-
rubygems_version: 2.7.
|
112
|
+
rubygems_version: 2.7.6
|
113
113
|
signing_key:
|
114
114
|
specification_version: 4
|
115
115
|
summary: Given a list of projects and environments pipelines, report which environments
|