renogen 1.3.1 → 1.4.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3f61827e5a1a1224d86a20cddecf5757ace8719f2c6e38120e859f8951289814
4
- data.tar.gz: f1174f4d416402cbf025a5a05f3f2f5ca00c436cecc032c6b87399dac7422bed
3
+ metadata.gz: 882d9056311e5a9baba8dd05bd1ec8c2ada3e5d84d612abbb15940140e07f9ed
4
+ data.tar.gz: ece836f07e37055b4d84180c7c9522d32814e5c1839e2484e4cf2354acff29f2
5
5
  SHA512:
6
- metadata.gz: 6683b5861e4d779967bf100a6683be6c6dccfe64e099906f6991caa266e5a976601c96a9905d8e89d91d2a958190301b3d7c54f79e7a644ff27319f8f50da926
7
- data.tar.gz: aebbc3dcdf470a7882cf2c038406085d9233774f828675a7b5c0e787899c5be6ccb297419c9a82d92e9e64d172a73dcc71f2a6258aedf893c9dd8e16adbbec3e
6
+ metadata.gz: 0d2edd0513ee545a1b26e0f78846deb543e38ba0227e96d92b6497435916563684f61df58673650e12634e647bdae4e0cde547ee38052d6f53b5f4ea01a2d76e
7
+ data.tar.gz: 6395af9fc76aefa6a3f126cc633aeca9eb80330eb6ab95f59be48f04522ead09f13ab3bf70e96eb923d20c7421d26266634aa7b05f5da52d960ef4ee517477c9
data/README.md CHANGED
@@ -138,6 +138,7 @@ with the following keys:
138
138
  | `changelog_path` | The directory where the feature note files are stored. | `./change_log` | `./doc/src/changes` |
139
139
  | `default_headings` | The headings/group names that will be printed into a feature note file created by the `new` command. Ignored when there is a rule defined for the given file name. | `%w[Summary Detailed Tasks]` | `%w[Title Description Deployment]` |
140
140
  | `allowed_values` | Allowed values for default headings. See [Allowed Values](#AllowedValues). | `{}` (none) | |
141
+ | `remove_duplicates` | Remove duplicate items from output release notes. Not applicable when using table formats (e.g`csv` or `markdown_table`). | `false` | |
141
142
 
142
143
  <a name="AllowedValues"></a>
143
144
  ## Allowed Values
@@ -50,10 +50,22 @@ module Renogen
50
50
  def output_groups(groups)
51
51
  groups.each do |group, changes|
52
52
  puts formatter.write_group(group)
53
- changes.each { |change| output_change(change) }
53
+ deduped_changes(changes).each { |change| output_change(change) }
54
54
  puts formatter.write_group_end
55
55
  end
56
56
  end
57
+
58
+ def deduped_changes(changes)
59
+ return changes unless config.remove_duplicates
60
+
61
+ changes.uniq { |c| c.to_s }
62
+ end
63
+
64
+ private
65
+
66
+ def config
67
+ Config.instance
68
+ end
57
69
  end
58
70
  end
59
71
  end
@@ -8,7 +8,7 @@ module Renogen
8
8
  class Config
9
9
  include Singleton
10
10
  attr_accessor :single_line_format, :input_source, :output_format, :supported_keys, :changelog_path,
11
- :default_headings, :validations
11
+ :default_headings, :validations, :remove_duplicates
12
12
 
13
13
  def initialize
14
14
  config_file = load_yaml_config
@@ -19,6 +19,7 @@ module Renogen
19
19
  self.changelog_path = config_file['changelog_path'] || './change_log'
20
20
  self.default_headings = config_file['default_headings'] || %w(Summary Detailed Tasks)
21
21
  self.validations = config_file['allowed_values']
22
+ self.remove_duplicates = config_file['remove_duplicates'] || false
22
23
  end
23
24
 
24
25
  # Renogen configuration extension
@@ -1,3 +1,3 @@
1
1
  module Renogen
2
- VERSION = '1.3.1'.freeze # :nodoc:
2
+ VERSION = '1.4.0'.freeze # :nodoc:
3
3
  end
@@ -36,6 +36,9 @@ describe Renogen::ChangeLog::Writer do
36
36
  expected_output.split("\n").each do |line|
37
37
  expect($stdout.gets.strip).to eq(line)
38
38
  end
39
+
40
+ # read remaining output and check we reached the end
41
+ expect($stdout.read.gsub("\n", '')).to be_empty
39
42
  end
40
43
  end
41
44
 
@@ -143,5 +146,60 @@ describe Renogen::ChangeLog::Writer do
143
146
 
144
147
  it_behaves_like 'a valid output format'
145
148
  end
149
+
150
+ describe 'duplicates' do
151
+ let(:formatter) { Renogen::Formatters::PlainText.new }
152
+ let(:changes_with_duplicates) do
153
+ [
154
+ renogen_change(1, 'Group 1', 'This is a Group 1 change'),
155
+ renogen_change(1, 'Group 2', 'This is a Group 2 change'),
156
+ renogen_change(2, 'Group 1', 'This is a Group 1 change'),
157
+ renogen_change(2, 'Group 2', 'This is a Group 2 change')
158
+ ]
159
+ end
160
+
161
+ context 'when remove duplicates is false in config (default)' do
162
+ it_behaves_like 'a valid output format' do
163
+ let(:changes) { changes_with_duplicates }
164
+
165
+ let(:expected_output) do
166
+ <<~EOS
167
+ test (2020-07-08)
168
+
169
+ Group 1
170
+ - This is a Group 1 change
171
+ - This is a Group 1 change
172
+
173
+ Group 2
174
+ - This is a Group 2 change
175
+ - This is a Group 2 change
176
+ EOS
177
+ end
178
+ end
179
+ end
180
+
181
+ context 'when remove duplicates is true in config' do
182
+ before do
183
+ allow(Renogen::Config.instance)
184
+ .to receive(:remove_duplicates).and_return(true)
185
+ end
186
+
187
+ it_behaves_like 'a valid output format' do
188
+ let(:changes) { changes_with_duplicates }
189
+
190
+ let(:expected_output) do
191
+ <<~EOS
192
+ test (2020-07-08)
193
+
194
+ Group 1
195
+ - This is a Group 1 change
196
+
197
+ Group 2
198
+ - This is a Group 2 change
199
+ EOS
200
+ end
201
+ end
202
+ end
203
+ end
146
204
  end
147
205
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: renogen
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Elliott