releasecop 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 90354ae214811a3290ab6b20f85276daacf12676cca75d42e11b18922a0cfa71
4
- data.tar.gz: a1f6e772cfbcf0f81d29a3f0dce747c0d64407c9d7bc702f526428eda51a4be0
3
+ metadata.gz: 80b447cdd1baf76fd9563d55b07097551d7bc04b6a17f1100f0bc86525378850
4
+ data.tar.gz: '098356e8e0b7e83de38bf62e9d29a79f4cc6b16a434d2fcded1fda3e4d0b704d'
5
5
  SHA512:
6
- metadata.gz: b3be386f94956b1919469de8ef09ec370a2ce5ca2f2b49f528e51b9207a42b9a3bac4231b50eb812748cd59a1d785243d9f60cf4ca492d6a10e7360af28c13fa
7
- data.tar.gz: 52a15b9d8504a97540ca3fd5ff3024205bc7cf2582137dbb0fc05efda1f92b59d8142e56155a927355451262b1fc277f19278d7c7a55c49de97e5cc1519d826e
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
  ---
@@ -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
- class Comparison
2
- attr_accessor :lines, :behind, :ahead
1
+ module Releasecop
2
+ class Comparison
3
+ attr_accessor :lines, :behind, :ahead
3
4
 
4
- def initialize(ahead, behind)
5
- @ahead = ahead
6
- @behind = behind
7
- end
5
+ def initialize(ahead, behind)
6
+ @ahead = ahead
7
+ @behind = behind
8
+ end
8
9
 
9
- def check
10
- @lines = log.lines
11
- end
10
+ def check
11
+ @lines = log.lines
12
+ end
12
13
 
13
- def unreleased?
14
- !lines.empty?
15
- end
14
+ def unreleased?
15
+ !lines.empty?
16
+ end
16
17
 
17
- private
18
+ private
18
19
 
19
- def log
20
- `git log #{@behind.for_rev_range}..#{@ahead.for_rev_range} --pretty=format:"%h %ad %s (%an)" --date=short --no-merges`
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
- class ManifestItem
2
- OPTION_KEYS = %w[hokusai tag_pattern]
3
- attr_reader :git, :branch, :name
1
+ module Releasecop
2
+ class ManifestItem
3
+ OPTION_KEYS = %w[hokusai tag_pattern]
4
+ attr_reader :git, :branch, :name
4
5
 
5
- def initialize(repo_name, item)
6
- @repo_name = repo_name
7
- @git = item['git']
8
- @name = item['name']
9
- @branch = item['branch'] || 'master'
10
- @options = item.select { |k, _v| OPTION_KEYS.include?(k) }
11
- end
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
- def for_rev_range
14
- @sha ||= find_tag_pattern_sha if @options['tag_pattern']
15
- @sha ||= find_hokusai_sha if @options['hokusai']
16
- @sha || [@name, @branch].join('/')
17
- end
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
- def bare_clone?
20
- !@options.key?('hokusai')
21
- end
20
+ def bare_clone?
21
+ !@options.key?('hokusai')
22
+ end
22
23
 
23
- private
24
+ private
24
25
 
25
- def working_dir
26
- "#{@repo_name}-#{@name}-working"
27
- end
26
+ def working_dir
27
+ "#{@repo_name}-#{@name}-working"
28
+ end
28
29
 
29
- def find_hokusai_sha
30
- images_output = `hokusai registry images`
31
- tags = images_output.lines.grep(/\d{4}.* | .* | .*/).map{|l| l.split(' | ').last.split(',').map(&:strip)}
32
- tags.detect{|t| t.include?(@options['hokusai']) }.detect{|t| t[/^[0-9a-f]{40}$/]}
33
- end
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
- def find_tag_pattern_sha
36
- `git for-each-ref --format='%(objectname)' --count=1 --sort=-authordate --sort=-committerdate 'refs/tags/#{@options['tag_pattern']}'`.strip
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
@@ -1,44 +1,48 @@
1
- class Result
2
- def initialize(name, comparisons)
3
- @name = name
4
- @comparisons = comparisons
5
- end
1
+ module Releasecop
2
+ class Result
3
+ attr_accessor :name, :comparisons
6
4
 
7
- def puts_message(verbose_flag)
8
- if verbose_flag
9
- puts message
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
- def unreleased
16
- @comparisons.select(&:unreleased?).count
17
- end
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
- private
18
+ def unreleased
19
+ @comparisons.select(&:unreleased?).count
20
+ end
20
21
 
21
- def message
22
- [header, *comparison_messages].join "\n"
23
- end
22
+ private
24
23
 
25
- def header
26
- "#{@name}..."
27
- end
24
+ def message
25
+ [header, *comparison_messages].join "\n"
26
+ end
28
27
 
29
- def unreleased?
30
- unreleased > 0
31
- end
28
+ def header
29
+ "#{@name}..."
30
+ end
32
31
 
33
- def comparison_messages
34
- @comparisons.map do |comparison|
35
- summary = if comparison.unreleased?
36
- " #{comparison.behind.name} is behind #{comparison.ahead.name} by:\n"
37
- else
38
- " #{comparison.behind.name} is up-to-date with #{comparison.ahead.name}"
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
@@ -1,3 +1,3 @@
1
1
  module Releasecop
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
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.8
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-07-23 00:00:00.000000000 Z
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.3
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