renogen 1.1.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 +5 -5
- data/README.md +155 -25
- data/lib/renogen/change_log.rb +1 -0
- data/lib/renogen/change_log/item.rb +6 -4
- data/lib/renogen/change_log/model.rb +11 -8
- data/lib/renogen/change_log/validator.rb +61 -0
- data/lib/renogen/change_log/writer.rb +35 -3
- data/lib/renogen/cli.rb +8 -4
- data/lib/renogen/cli/param_parser.rb +12 -0
- data/lib/renogen/config.rb +16 -15
- data/lib/renogen/exceptions.rb +5 -0
- data/lib/renogen/exceptions/invalid_item_found.rb +32 -0
- data/lib/renogen/exceptions/yaml_file_blank.rb +21 -0
- data/lib/renogen/exceptions/yaml_file_invalid.rb +20 -0
- data/lib/renogen/extraction_stratagies.rb +0 -2
- data/lib/renogen/extraction_stratagies/yaml_file.rb +0 -1
- data/lib/renogen/extraction_stratagies/yaml_file/parser.rb +5 -4
- data/lib/renogen/extraction_stratagies/yaml_file/reader.rb +20 -11
- data/lib/renogen/formatters.rb +2 -0
- data/lib/renogen/formatters/base.rb +32 -7
- data/lib/renogen/formatters/csv.rb +42 -0
- data/lib/renogen/formatters/html.rb +1 -1
- data/lib/renogen/formatters/markdown.rb +2 -2
- data/lib/renogen/formatters/markdown_table.rb +58 -0
- data/lib/renogen/generator.rb +9 -1
- data/lib/renogen/version.rb +1 -1
- data/lib/renogen/writers/csv.rb +23 -0
- data/spec/lib/renogen/change_log/item_spec.rb +1 -1
- data/spec/lib/renogen/change_log/model_spec.rb +22 -8
- data/spec/lib/renogen/change_log/validator_spec.rb +38 -0
- data/spec/lib/renogen/change_log/writer_spec.rb +199 -2
- data/spec/lib/renogen/config_spec.rb +7 -2
- data/spec/lib/renogen/exceptions/invalid_item_found_spec.rb +35 -0
- data/spec/lib/renogen/exceptions/stratagy_not_found_spec.rb +2 -1
- data/spec/lib/renogen/{extraction_stratagies/yaml_file/exceptions → exceptions}/yaml_file_blank_spec.rb +1 -1
- data/spec/lib/renogen/exceptions/yaml_file_invalid_spec.rb +12 -0
- data/spec/lib/renogen/extraction_stratagies/yaml_file/parser_spec.rb +3 -3
- data/spec/lib/renogen/extraction_stratagies/yaml_file/reader_spec.rb +11 -5
- data/spec/lib/renogen/formatters/base_spec.rb +14 -4
- data/spec/lib/renogen/formatters/csv_spec.rb +49 -0
- data/spec/lib/renogen/formatters/html_spec.rb +1 -1
- data/spec/lib/renogen/formatters/markdown_spec.rb +2 -2
- data/spec/spec_helper.rb +5 -0
- data/spec/support/renogen_helper.rb +9 -0
- metadata +20 -11
- data/lib/renogen/extraction_stratagies/yaml_file/exceptions.rb +0 -12
- data/lib/renogen/extraction_stratagies/yaml_file/exceptions/yaml_file_blank.rb +0 -25
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Renogen::Exceptions::YamlFileInvalid do
|
4
|
+
let(:name) { 'foobar' }
|
5
|
+
subject { described_class.new(name) }
|
6
|
+
|
7
|
+
describe '#message' do
|
8
|
+
it 'returns friendly error message' do
|
9
|
+
expect(subject.message).to eql "Error: File contents invalid '#{name}'"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -6,13 +6,13 @@ describe Renogen::ExtractionStratagies::YamlFile::Parser do
|
|
6
6
|
describe '#parse!' do
|
7
7
|
before :each do
|
8
8
|
yaml_file_reader = double(Renogen::ExtractionStratagies::YamlFile::Reader)
|
9
|
-
allow(yaml_file_reader).to receive(:each_yaml_file).and_yield(file_contents)
|
9
|
+
allow(yaml_file_reader).to receive(:each_yaml_file).and_yield(file_contents, 1)
|
10
10
|
allow(Renogen::ExtractionStratagies::YamlFile::Reader).to receive(:new).and_return(yaml_file_reader)
|
11
11
|
end
|
12
12
|
|
13
13
|
it 'extracts contents from file' do
|
14
|
-
changelog_item = Renogen::ChangeLog::Item.new('Foo', 'Bar')
|
15
|
-
allow(Renogen::ChangeLog::Item).to receive(:new).with('Foo', 'Bar').and_return changelog_item
|
14
|
+
changelog_item = Renogen::ChangeLog::Item.new(1, 'Foo', 'Bar')
|
15
|
+
allow(Renogen::ChangeLog::Item).to receive(:new).with(1, 'Foo', 'Bar').and_return changelog_item
|
16
16
|
|
17
17
|
changelog = subject.parse!
|
18
18
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
require 'json'
|
3
5
|
|
@@ -6,15 +8,19 @@ describe Renogen::ExtractionStratagies::YamlFile::Reader do
|
|
6
8
|
subject { described_class.new(directory_path) }
|
7
9
|
|
8
10
|
describe '#each_yaml_file' do
|
9
|
-
let(:file_contents) { { 'Foo' => '
|
11
|
+
let(:file_contents) { { 'Foo' => 'bar' }.to_json }
|
10
12
|
|
11
|
-
|
12
|
-
allow(Dir).to receive(:glob).with([File.join(directory_path, 'next',
|
13
|
+
it 'yields each yaml file within given directory' do
|
14
|
+
allow(Dir).to receive(:glob).with([File.join(directory_path, 'next', '*.yml')]).and_return(['foo_file'])
|
13
15
|
allow(YAML).to receive(:load_file).with('foo_file').and_return(file_contents)
|
16
|
+
expect { |b| subject.each_yaml_file(&b) }.to yield_with_args(file_contents, 0)
|
14
17
|
end
|
15
18
|
|
16
|
-
it '
|
17
|
-
|
19
|
+
it 'throws invalid yaml file when missing quotes' do
|
20
|
+
allow(subject).to receive(:change_directories).and_return(%w(foo bar))
|
21
|
+
foo = Psych::SyntaxError.new('a', 1, 2, 'd', 'e', 'f')
|
22
|
+
allow(YAML).to receive(:load_file).and_raise(foo)
|
23
|
+
expect { subject.each_yaml_file }.to raise_error(Renogen::Exceptions::YamlFileInvalid)
|
18
24
|
end
|
19
25
|
end
|
20
26
|
end
|
@@ -1,15 +1,25 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Renogen::Formatters::Base do
|
4
|
+
let(:version) { '1.2.34' }
|
5
|
+
let(:date) { Date.today }
|
6
|
+
let(:changelog) { double(Renogen::ChangeLog::Model, version: version, date: date) }
|
7
|
+
|
8
|
+
describe '#header' do
|
9
|
+
subject { described_class.new.header(changelog) }
|
10
|
+
|
11
|
+
it { is_expected.to eql "#{version} (#{date})" }
|
12
|
+
end
|
13
|
+
|
4
14
|
describe '#write_header' do
|
5
|
-
it '
|
6
|
-
expect
|
15
|
+
it 'does nothing' do
|
16
|
+
expect(subject.write_header(changelog)).to be_nil
|
7
17
|
end
|
8
18
|
end
|
9
19
|
|
10
20
|
describe '#write_group' do
|
11
|
-
it '
|
12
|
-
expect
|
21
|
+
it 'does nothing' do
|
22
|
+
expect(subject.write_group(changelog)).to be_nil
|
13
23
|
end
|
14
24
|
end
|
15
25
|
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Renogen::Formatters::Csv do
|
6
|
+
describe 'write_methods' do
|
7
|
+
let(:change_1) { renogen_change(1, 'Group 1', 'Change 1') }
|
8
|
+
let(:change_2) { renogen_change(1, 'Group 2', 'Change 2') }
|
9
|
+
let(:change_3) { renogen_change(2, 'Group 1', 'Change 3') }
|
10
|
+
let(:changelog) { Renogen::ChangeLog::Model.new }
|
11
|
+
|
12
|
+
before do
|
13
|
+
[change_1, change_2, change_3].each { |c| changelog.add_change(c) }
|
14
|
+
subject.header(changelog)
|
15
|
+
end
|
16
|
+
|
17
|
+
it { is_expected.to be_table_formatter }
|
18
|
+
describe '#write_header' do
|
19
|
+
it 'returns a comma separated list of group names' do
|
20
|
+
expect(subject.write_header('Group 1,Group 2')).to eq("Group 1,Group 2\n")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#write_change' do
|
25
|
+
let(:ticket) do
|
26
|
+
{
|
27
|
+
'Group 1' => 'This is a Group 1 change',
|
28
|
+
'Group 2' => 'This is a Group 2 change, with a comma'
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'when ticket contains same keys as changelog groups' do
|
33
|
+
it 'outputs all values' do
|
34
|
+
expect(subject.write_change(ticket)).to eq(
|
35
|
+
'This is a Group 1 change,"This is a Group 2 change, with a comma"'
|
36
|
+
)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context 'when changelog contains keys missing in ticket' do
|
41
|
+
it 'outputs empty values for missing keys' do
|
42
|
+
expect(subject.write_change(ticket)).to eq(
|
43
|
+
'This is a Group 1 change,"This is a Group 2 change, with a comma"'
|
44
|
+
)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -8,7 +8,7 @@ describe Renogen::Formatters::Html do
|
|
8
8
|
|
9
9
|
describe '#write_header' do
|
10
10
|
it 'returns header with newline' do
|
11
|
-
expect(subject.write_header('header')).to eql "<html>\n<h1>header</h1
|
11
|
+
expect(subject.write_header('header')).to eql "<html>\n<h1>header</h1>\n"
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -11,13 +11,13 @@ describe Renogen::Formatters::Markdown do
|
|
11
11
|
|
12
12
|
describe '#write_header' do
|
13
13
|
it 'returns header with newline' do
|
14
|
-
expect(subject.write_header('header')).to eql "# header"
|
14
|
+
expect(subject.write_header('header')).to eql "# header\n\n"
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
describe '#write_group' do
|
19
19
|
it 'returns group' do
|
20
|
-
expect(subject.write_group('group')).to eql "
|
20
|
+
expect(subject.write_group('group')).to eql "## group\n\n"
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'renogen'
|
4
|
+
require_relative 'support/renogen_helper'
|
2
5
|
|
3
6
|
RSpec.configure do |config|
|
4
7
|
config.expect_with :rspec do |expectations|
|
@@ -40,4 +43,6 @@ RSpec.configure do |config|
|
|
40
43
|
# the seed, which is printed after each run.
|
41
44
|
# --seed 1234
|
42
45
|
config.order = :random
|
46
|
+
|
47
|
+
config.include Support::RenogenHelper
|
43
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: renogen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dave Elliott
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -39,50 +39,60 @@ files:
|
|
39
39
|
- lib/renogen/change_log/group.rb
|
40
40
|
- lib/renogen/change_log/item.rb
|
41
41
|
- lib/renogen/change_log/model.rb
|
42
|
+
- lib/renogen/change_log/validator.rb
|
42
43
|
- lib/renogen/change_log/writer.rb
|
43
44
|
- lib/renogen/cli.rb
|
44
45
|
- lib/renogen/cli/param_parser.rb
|
45
46
|
- lib/renogen/config.rb
|
46
47
|
- lib/renogen/exceptions.rb
|
47
48
|
- lib/renogen/exceptions/base.rb
|
49
|
+
- lib/renogen/exceptions/invalid_item_found.rb
|
48
50
|
- lib/renogen/exceptions/stratagy_not_found.rb
|
51
|
+
- lib/renogen/exceptions/yaml_file_blank.rb
|
52
|
+
- lib/renogen/exceptions/yaml_file_invalid.rb
|
49
53
|
- lib/renogen/extraction_stratagies.rb
|
50
54
|
- lib/renogen/extraction_stratagies/base.rb
|
51
55
|
- lib/renogen/extraction_stratagies/yaml_file.rb
|
52
|
-
- lib/renogen/extraction_stratagies/yaml_file/exceptions.rb
|
53
|
-
- lib/renogen/extraction_stratagies/yaml_file/exceptions/yaml_file_blank.rb
|
54
56
|
- lib/renogen/extraction_stratagies/yaml_file/parser.rb
|
55
57
|
- lib/renogen/extraction_stratagies/yaml_file/provider.rb
|
56
58
|
- lib/renogen/extraction_stratagies/yaml_file/reader.rb
|
57
59
|
- lib/renogen/formatters.rb
|
58
60
|
- lib/renogen/formatters/base.rb
|
61
|
+
- lib/renogen/formatters/csv.rb
|
59
62
|
- lib/renogen/formatters/html.rb
|
60
63
|
- lib/renogen/formatters/markdown.rb
|
64
|
+
- lib/renogen/formatters/markdown_table.rb
|
61
65
|
- lib/renogen/formatters/plain_text.rb
|
62
66
|
- lib/renogen/generator.rb
|
63
67
|
- lib/renogen/version.rb
|
68
|
+
- lib/renogen/writers/csv.rb
|
64
69
|
- spec/lib/renogen/change_log/group_spec.rb
|
65
70
|
- spec/lib/renogen/change_log/item_spec.rb
|
66
71
|
- spec/lib/renogen/change_log/model_spec.rb
|
72
|
+
- spec/lib/renogen/change_log/validator_spec.rb
|
67
73
|
- spec/lib/renogen/change_log/writer_spec.rb
|
68
74
|
- spec/lib/renogen/config_spec.rb
|
75
|
+
- spec/lib/renogen/exceptions/invalid_item_found_spec.rb
|
69
76
|
- spec/lib/renogen/exceptions/stratagy_not_found_spec.rb
|
77
|
+
- spec/lib/renogen/exceptions/yaml_file_blank_spec.rb
|
78
|
+
- spec/lib/renogen/exceptions/yaml_file_invalid_spec.rb
|
70
79
|
- spec/lib/renogen/extraction_stratagies/base_spec.rb
|
71
|
-
- spec/lib/renogen/extraction_stratagies/yaml_file/exceptions/yaml_file_blank_spec.rb
|
72
80
|
- spec/lib/renogen/extraction_stratagies/yaml_file/parser_spec.rb
|
73
81
|
- spec/lib/renogen/extraction_stratagies/yaml_file/provider_spec.rb
|
74
82
|
- spec/lib/renogen/extraction_stratagies/yaml_file/reader_spec.rb
|
75
83
|
- spec/lib/renogen/formatters/base_spec.rb
|
84
|
+
- spec/lib/renogen/formatters/csv_spec.rb
|
76
85
|
- spec/lib/renogen/formatters/html_spec.rb
|
77
86
|
- spec/lib/renogen/formatters/markdown_spec.rb
|
78
87
|
- spec/lib/renogen/formatters/plain_text_spec.rb
|
79
88
|
- spec/lib/renogen_spec.rb
|
80
89
|
- spec/spec_helper.rb
|
90
|
+
- spec/support/renogen_helper.rb
|
81
91
|
homepage: https://github.com/DDAZZA/renogen
|
82
92
|
licenses:
|
83
93
|
- GPL-3.0
|
84
94
|
metadata: {}
|
85
|
-
post_install_message:
|
95
|
+
post_install_message:
|
86
96
|
rdoc_options: []
|
87
97
|
require_paths:
|
88
98
|
- lib
|
@@ -97,10 +107,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
107
|
- !ruby/object:Gem::Version
|
98
108
|
version: '0'
|
99
109
|
requirements: []
|
100
|
-
rubyforge_project:
|
101
|
-
rubygems_version: 2.6.2
|
102
|
-
signing_key:
|
110
|
+
rubyforge_project:
|
111
|
+
rubygems_version: 2.7.6.2
|
112
|
+
signing_key:
|
103
113
|
specification_version: 4
|
104
114
|
summary: Release Notes/changelog Generator
|
105
115
|
test_files: []
|
106
|
-
has_rdoc:
|
@@ -1,25 +0,0 @@
|
|
1
|
-
module Renogen
|
2
|
-
module ExtractionStratagies
|
3
|
-
module YamlFile
|
4
|
-
module Exceptions
|
5
|
-
# This is raised when a yaml file change is found but has not contents
|
6
|
-
class YamlFileBlank < Renogen::Exceptions::Base
|
7
|
-
attr_reader :file_path
|
8
|
-
|
9
|
-
def initialize(file_path)
|
10
|
-
@file_path = file_path
|
11
|
-
super
|
12
|
-
end
|
13
|
-
|
14
|
-
# Friendly error message
|
15
|
-
#
|
16
|
-
# @return [String]
|
17
|
-
def message
|
18
|
-
"Error: File contents blank '#{file_path}'"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|