cookbook-release 1.4.5 → 1.4.6

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: 1d320d81b00bbc0568db5a101bf05cb341ffc23aed196a0d82a08a37c2921ccd
4
- data.tar.gz: a66c146cce4f56369b30329f810d0de829abe85fcfe79f9760d0f445547d3a65
3
+ metadata.gz: f7437fec8e18c6f3d3010cabcc1560d2f50a21fa9f3d3721fea2e11fbfa41245
4
+ data.tar.gz: 528a77af3764cabb0ea07cb41b1d21c52e2ff57a306ce4924d129ee657da5522
5
5
  SHA512:
6
- metadata.gz: a8d578db88940e2a0552cd74a203e104693ec1377b97db12fbf29ea15aed8e58e1fb1e967bc3226a8fb45a5689c24ab69d7826fd96a6935fdfc9d908b38f540d
7
- data.tar.gz: febc04990a5974dd9305874332443155069f3f044d562fb5297b805345554b2ba62bac2b2e389bbde73bf396b1ef49b2caceddde7ec21b3501d4202d11aed7c7
6
+ metadata.gz: 14d6f53eab37b49ee1b5336e23f1f05fe4145b4f8b28610645d5418a9e8b18617081060fb5c96bc79ccc2136a2a890c1f0068403e065e9136ea1ea6a0d10ca92
7
+ data.tar.gz: 5a5b26e7d8035f611a5a79dc03523d81ff8d9b87f97728ebcb9de3d3e9846d8b5b639c4c90b368355da887f42be209b3c934e1fccc9ebe2fcef1921def5d57f0
@@ -6,7 +6,7 @@ require 'English'
6
6
 
7
7
  Gem::Specification.new do |spec|
8
8
  spec.name = 'cookbook-release'
9
- spec.version = '1.4.5'
9
+ spec.version = '1.4.6'
10
10
  spec.authors = ['Grégoire Seux']
11
11
  spec.email = 'g.seux@criteo.com'
12
12
  spec.summary = 'Provide primitives (and rake tasks) to release a cookbook'
@@ -11,6 +11,7 @@ module CookbookRelease
11
11
  RISKY = 'RISKY/BREAKING (details below):'
12
12
  NO_RISKY = 'NO RISKY/BREAKING COMMITS. READ FULL CHANGELOG.'
13
13
  NON_NODES_ONLY = 'Non-risky/major, Non-node-only commits'
14
+ NODES_ONLY = 'Commits impacting only nodes'
14
15
  FULL = 'Full changelog:'
15
16
  DETAILS = 'Details of risky commits:'
16
17
 
@@ -109,28 +110,53 @@ module CookbookRelease
109
110
  end
110
111
 
111
112
  def markdown_priority_nodes
112
- cl = changelog
113
- risky_commits = cl.select { |c| c.risky? || c.major? }
114
- not_nodes_only_commits = cl.reject { |c| c.nodes_only? || c.risky? || c.major? }
115
113
  result = []
116
- if risky_commits.any?
117
- result << "*#{RISKY}*\n" << risky_commits.map { |c| c.to_s_markdown(false) }.join("\n") << "\n"
118
- else
119
- result << "*#{NO_RISKY}*\n\n"
120
- end
114
+ result << append_risky(changelog)
115
+ result << append_by_impact(changelog)
116
+ result << append_risky_details(changelog)
117
+ result
118
+ end
119
+
120
+ private
121
+
122
+ # @param changelog [Array<Commit>]
123
+ # @return [String] a string describing the changelog
124
+ def append_by_impact(changelog)
125
+ not_nodes_only_commits = changelog.reject { |c| c.nodes_only? || c.risky? || c.major? }
126
+ nodes_only_commits = changelog.select(&:nodes_only?)
127
+ output = []
121
128
  if not_nodes_only_commits.any?
122
- result << "*#{NON_NODES_ONLY}*\n" << not_nodes_only_commits.map { |c| c.to_s_markdown(false) }.join("\n") << "\n"
129
+ txt = not_nodes_only_commits.map { |c| c.to_s_markdown(false) }.join("\n")
130
+ output << "*#{NON_NODES_ONLY}*\n#{txt}\n"
123
131
  end
124
- result << "*#{FULL}*\n"
125
- result << cl.map { |c| c.to_s_markdown(false) }.join("\n")
132
+ if nodes_only_commits.any?
133
+ txt = nodes_only_commits.map { |c| c.to_s_markdown(false) }.join("\n")
134
+ output << "*#{NODES_ONLY}*\n#{txt}\n"
135
+ end
136
+ output.join
137
+ end
138
+
139
+ # @param changelog [Array<Commit>]
140
+ # @return [String] a string describing the changelog
141
+ def append_risky_details(changelog)
142
+ risky_commits = changelog.select { |c| c.risky? || c.major? }
126
143
  if risky_commits.any?
127
- result << "\n#{DETAILS}\n"
128
- result << risky_commits.map { |c| c.to_s_markdown(true) }.join("\n")
144
+ "\n#{DETAILS}\n" + risky_commits.map { |c| c.to_s_markdown(true) }.join("\n")
145
+ else
146
+ ''
129
147
  end
130
- result
131
148
  end
132
149
 
133
- private
150
+ # @param changelog [Array<Commit>]
151
+ # @return [String] a string describing the changelog
152
+ def append_risky(changelog)
153
+ risky_commits = changelog.select { |c| c.risky? || c.major? }
154
+ if risky_commits.any?
155
+ "*#{RISKY}*\n" << risky_commits.map { |c| c.to_s_markdown(false) }.join("\n") << "\n"
156
+ else
157
+ "*#{NO_RISKY}*\n\n"
158
+ end
159
+ end
134
160
 
135
161
  def changelog
136
162
  ref = ENV['RELEASE_BRANCH'] || 'origin/master'
@@ -83,10 +83,10 @@ describe CookbookRelease::Changelog do
83
83
  end
84
84
 
85
85
  it 'expands the body with non-risky+non-nodes' do
86
- expect(git).to receive(:compute_changelog).and_return(commits)
86
+ expect(git).to receive(:compute_changelog).and_return(commits).at_least(:once)
87
87
  changelog = CookbookRelease::Changelog.new(git, expand_risky: true, nodes_only: true)
88
88
  expect(changelog.markdown_priority_nodes.join('')).to include(
89
- "\n*Non-risky/major, Non-node-only commits*\n*654321* _John Doe <j.doe@nobody.com>_ `hello`\n*Full"
89
+ "\n*Non-risky/major, Non-node-only commits*\n*654321* _John Doe <j.doe@nobody.com>_ `hello`\n*Commits impacting only nodes"
90
90
  )
91
91
  end
92
92
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cookbook-release
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.5
4
+ version: 1.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grégoire Seux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-05 00:00:00.000000000 Z
11
+ date: 2020-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: semantic
@@ -194,8 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
194
  - !ruby/object:Gem::Version
195
195
  version: '0'
196
196
  requirements: []
197
- rubyforge_project:
198
- rubygems_version: 2.7.7
197
+ rubygems_version: 3.0.8
199
198
  signing_key:
200
199
  specification_version: 4
201
200
  summary: Provide primitives (and rake tasks) to release a cookbook