defmastership 1.0.19 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.gitlab-ci.yml +27 -0
- data/Gemfile +27 -16
- data/LICENSE +1 -1
- data/README.adoc +24 -0
- data/Rakefile +0 -1
- data/bin/defmastership +5 -5
- data/config/mutant.yml +18 -16
- data/config/rubocop.yml +5 -10
- data/defmastership.gemspec +3 -3
- data/lib/defmastership/batch_modifier.rb +23 -5
- data/lib/defmastership/comment_filter.rb +2 -1
- data/lib/defmastership/definition.rb +24 -4
- data/lib/defmastership/definition_parser.rb +2 -2
- data/lib/defmastership/document.rb +39 -19
- data/lib/defmastership/export/body_formatter.rb +55 -0
- data/lib/defmastership/export/csv/formatter.rb +64 -0
- data/lib/defmastership/export/header_formatter.rb +51 -0
- data/lib/defmastership/filters.rb +15 -12
- data/lib/defmastership/matching_line.rb +3 -2
- data/lib/defmastership/modifier/change_ref.rb +117 -0
- data/lib/defmastership/modifier/factory.rb +17 -0
- data/lib/defmastership/modifier/modifier_common.rb +71 -0
- data/lib/defmastership/modifier/rename_included_files.rb +223 -0
- data/lib/defmastership/modifier/update_def.rb +72 -0
- data/lib/defmastership/modifier/update_def_checksum.rb +17 -0
- data/lib/defmastership/modifier/update_def_version.rb +110 -0
- data/lib/defmastership/set_join_hack.rb +2 -0
- data/lib/defmastership/version.rb +3 -2
- data/lib/defmastership.rb +6 -8
- data/spec/unit/{def_mastership → defmastership}/batch_modifier_spec.rb +13 -13
- data/spec/unit/{def_mastership → defmastership}/definition_parser_spec.rb +1 -1
- data/spec/unit/{def_mastership → defmastership}/definition_spec.rb +1 -1
- data/spec/unit/{def_mastership → defmastership}/document_spec.rb +57 -57
- data/spec/unit/{def_mastership/csv_formatter_body_spec.rb → defmastership/export/body_formatter_spec.rb} +4 -4
- data/spec/unit/{def_mastership/csv_formatter_spec.rb → defmastership/export/csv/formatter_spec.rb} +13 -8
- data/spec/unit/{def_mastership/csv_formatter_header_spec.rb → defmastership/export/header_formatter_spec.rb} +3 -3
- data/spec/unit/{def_mastership → defmastership}/matching_line_spec.rb +1 -1
- data/spec/unit/{def_mastership/change_ref_modifier_spec.rb → defmastership/modifier/change_ref_spec.rb} +19 -44
- data/spec/unit/defmastership/modifier/factory_spec.rb +45 -0
- data/spec/unit/{def_mastership/modifier_spec.rb → defmastership/modifier/modifier_common_spec.rb} +3 -12
- data/spec/unit/{def_mastership/rename_included_files_modifier_spec.rb → defmastership/modifier/rename_included_files_spec.rb} +3 -3
- data/spec/unit/{def_mastership/update_def_checksum_modifier_spec.rb → defmastership/modifier/update_def_checksum_spec.rb} +10 -10
- data/spec/unit/{def_mastership/update_def_modifier_spec.rb → defmastership/modifier/update_def_spec.rb} +22 -20
- data/spec/unit/{def_mastership/update_def_version_modifier_spec.rb → defmastership/modifier/update_def_version_spec.rb} +38 -38
- data/spec/unit/{def_mastership_spec.rb → defmastership_spec.rb} +2 -2
- data/tasks/documentation.rake +19 -0
- data/tasks/package.rake +4 -0
- metadata +63 -43
- data/README.rdoc +0 -6
- data/defmastership.rdoc +0 -5
- data/lib/defmastership/change_ref_modifier.rb +0 -99
- data/lib/defmastership/constants.rb +0 -91
- data/lib/defmastership/csv_formatter.rb +0 -53
- data/lib/defmastership/csv_formatter_body.rb +0 -46
- data/lib/defmastership/csv_formatter_header.rb +0 -41
- data/lib/defmastership/modifier.rb +0 -42
- data/lib/defmastership/modifier_factory.rb +0 -12
- data/lib/defmastership/parsing_state.rb +0 -31
- data/lib/defmastership/rename_included_files_modifier.rb +0 -182
- data/lib/defmastership/update_def_checksum_modifier.rb +0 -16
- data/lib/defmastership/update_def_modifier.rb +0 -49
- data/lib/defmastership/update_def_version_modifier.rb +0 -91
- data/spec/unit/def_mastership/modifier_factory_spec.rb +0 -38
- data/spec/unit/def_mastership/parsing_state_spec.rb +0 -62
- data/tasks/package.task +0 -9
- /data/spec/unit/{def_mastership → defmastership}/string_spec.rb +0 -0
data/spec/unit/{def_mastership/modifier_spec.rb → defmastership/modifier/modifier_common_spec.rb}
RENAMED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Copyright (c) 2023 Jerome Arbez-Gindre
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require('defmastership/modifier')
|
4
|
+
require('defmastership/modifier/modifier_common')
|
5
5
|
|
6
6
|
# just a class for test
|
7
7
|
class DummyClassParent
|
@@ -16,7 +16,7 @@ end
|
|
16
16
|
|
17
17
|
# just a class for test
|
18
18
|
class DummyClass < DummyClassParent
|
19
|
-
include
|
19
|
+
include Defmastership::Modifier::ModifierCommon
|
20
20
|
|
21
21
|
def self.replacement_methods
|
22
22
|
%i[replace_pouet_by_foo replace_foo_by_zoo]
|
@@ -42,7 +42,7 @@ class DummyClass < DummyClassParent
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
RSpec.describe(
|
45
|
+
RSpec.describe(Defmastership::Modifier::ModifierCommon) do
|
46
46
|
subject(:modifier) { DummyClass.new({}) }
|
47
47
|
|
48
48
|
describe '.new' do
|
@@ -65,15 +65,6 @@ RSpec.describe(DefMastership::Modifier) do
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
-
describe '#apply_to_all' do
|
69
|
-
it do
|
70
|
-
texts = { first: "pouet\ntoto\npouet", second: "toto\npouet\ntoto" }
|
71
|
-
|
72
|
-
expect(modifier.apply_to_all(texts, :replace_pouet_by_foo))
|
73
|
-
.to(eq({ first: "foo\ntoto\nfoo", second: "toto\nfoo\ntoto" }))
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
68
|
describe '#do_modifications' do
|
78
69
|
it do
|
79
70
|
adoc_sources = { first: "pouet\ntoto\npouet", second: "toto\npouet\ntoto" }
|
@@ -1,13 +1,13 @@
|
|
1
1
|
# Copyright (c) 2021 Jerome Arbez-Gindre
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require('defmastership/
|
4
|
+
require('defmastership/modifier/rename_included_files')
|
5
5
|
|
6
|
-
RSpec.describe(
|
6
|
+
RSpec.describe(Defmastership::Modifier::RenameIncludedFiles) do
|
7
7
|
subject(:includeschanger) { described_class.new({}) }
|
8
8
|
|
9
9
|
describe '.new' do
|
10
|
-
it { expect(described_class.ancestors).to(include(
|
10
|
+
it { expect(described_class.ancestors).to(include(Defmastership::Modifier::ModifierCommon)) }
|
11
11
|
it { is_expected.not_to(be_nil) }
|
12
12
|
it { is_expected.to(have_attributes(from_regexp: '')) }
|
13
13
|
it { is_expected.to(have_attributes(to_template: '')) }
|
@@ -1,13 +1,13 @@
|
|
1
1
|
# Copyright (c) 2020 Jerome Arbez-Gindre
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require('defmastership/
|
4
|
+
require('defmastership/modifier/update_def_checksum')
|
5
5
|
|
6
|
-
RSpec.describe(
|
6
|
+
RSpec.describe(Defmastership::Modifier::UpdateDefChecksum) do
|
7
7
|
subject(:modifier) { described_class.new({}) }
|
8
8
|
|
9
9
|
describe '.new' do
|
10
|
-
it { expect(described_class.ancestors).to(include(
|
10
|
+
it { expect(described_class.ancestors).to(include(Defmastership::Modifier::ModifierCommon)) }
|
11
11
|
it { is_expected.not_to(be_nil) }
|
12
12
|
it { is_expected.to(have_attributes(def_type: '')) }
|
13
13
|
end
|
@@ -19,8 +19,8 @@ RSpec.describe(DefMastership::UpdateDefChecksumModifier) do
|
|
19
19
|
describe '#do_modifications' do
|
20
20
|
subject(:modifier) { described_class.new({ def_type: 'req' }) }
|
21
21
|
|
22
|
-
let(:document) { instance_double(
|
23
|
-
let(:definition) { instance_double(
|
22
|
+
let(:document) { instance_double(Defmastership::Document, 'document') }
|
23
|
+
let(:definition) { instance_double(Defmastership::Definition, 'definition') }
|
24
24
|
let(:definitions) { { 'REFERENCE' => definition } }
|
25
25
|
let(:adoc_sources) do
|
26
26
|
{
|
@@ -31,7 +31,7 @@ RSpec.describe(DefMastership::UpdateDefChecksumModifier) do
|
|
31
31
|
let(:new_adoc_sources) { nil }
|
32
32
|
|
33
33
|
before do
|
34
|
-
allow(
|
34
|
+
allow(Defmastership::Document).to(receive(:new).and_return(document))
|
35
35
|
allow(document).to(receive(:parse_file_with_preprocessor))
|
36
36
|
allow(document).to(receive(:ref_to_def).with('REFERENCE').and_return(definition))
|
37
37
|
allow(definition).to(receive(:sha256_short).and_return('~abcd1234'))
|
@@ -39,7 +39,7 @@ RSpec.describe(DefMastership::UpdateDefChecksumModifier) do
|
|
39
39
|
modifier.do_modifications(adoc_sources)
|
40
40
|
end
|
41
41
|
|
42
|
-
it { expect(
|
42
|
+
it { expect(Defmastership::Document).to(have_received(:new)) }
|
43
43
|
|
44
44
|
it do
|
45
45
|
expect(document).to(
|
@@ -61,8 +61,8 @@ RSpec.describe(DefMastership::UpdateDefChecksumModifier) do
|
|
61
61
|
)
|
62
62
|
end
|
63
63
|
|
64
|
-
let(:definition) { instance_double(
|
65
|
-
let(:document) { instance_double(
|
64
|
+
let(:definition) { instance_double(Defmastership::Definition, 'definition') }
|
65
|
+
let(:document) { instance_double(Defmastership::Document, 'document') }
|
66
66
|
let(:definitions) { { 'REFERENCE' => definition } }
|
67
67
|
|
68
68
|
before do
|
@@ -78,7 +78,7 @@ RSpec.describe(DefMastership::UpdateDefChecksumModifier) do
|
|
78
78
|
|
79
79
|
context 'when definition has the good type' do
|
80
80
|
before do
|
81
|
-
allow(
|
81
|
+
allow(Defmastership::Document).to(receive(:new).and_return(document))
|
82
82
|
allow(document).to(receive(:ref_to_def).with('REFERENCE').and_return(definition))
|
83
83
|
allow(definition).to(receive(:sha256_short).and_return('~abcd1234'))
|
84
84
|
end
|
@@ -1,25 +1,27 @@
|
|
1
1
|
# Copyright (c) 2020 Jerome Arbez-Gindre
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require('defmastership/
|
4
|
+
require('defmastership/modifier/update_def')
|
5
5
|
|
6
|
-
module
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
module Defmastership
|
7
|
+
module Modifier
|
8
|
+
# Just a class for tests
|
9
|
+
class ConcreteRef < UpdateDef
|
10
|
+
private
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
# This method smells of :reek:UtilityFunction
|
13
|
+
def reference_replacement(reference, match)
|
14
|
+
"#{reference}_something_#{match[:explicit_version]}"
|
15
|
+
end
|
14
16
|
end
|
15
17
|
end
|
16
18
|
end
|
17
19
|
|
18
|
-
RSpec.describe(
|
19
|
-
subject(:modifier) {
|
20
|
+
RSpec.describe(Defmastership::Modifier::UpdateDef) do
|
21
|
+
subject(:modifier) { Defmastership::Modifier::ConcreteRef.new({}) }
|
20
22
|
|
21
23
|
describe '.new' do
|
22
|
-
it { expect(described_class.ancestors).to(include(
|
24
|
+
it { expect(described_class.ancestors).to(include(Defmastership::Modifier::ModifierCommon)) }
|
23
25
|
it { is_expected.not_to(be_nil) }
|
24
26
|
it { is_expected.to(have_attributes(def_type: '')) }
|
25
27
|
end
|
@@ -29,10 +31,10 @@ RSpec.describe(DefMastership::UpdateDefModifier) do
|
|
29
31
|
end
|
30
32
|
|
31
33
|
describe '#do_modifications' do
|
32
|
-
subject(:modifier) {
|
34
|
+
subject(:modifier) { Defmastership::Modifier::ConcreteRef.new({ def_type: 'req' }) }
|
33
35
|
|
34
|
-
let(:document) { instance_double(
|
35
|
-
let(:definition) { instance_double(
|
36
|
+
let(:document) { instance_double(Defmastership::Document, 'document') }
|
37
|
+
let(:definition) { instance_double(Defmastership::Definition, 'definition') }
|
36
38
|
let(:definitions) { { 'REFERENCE' => definition } }
|
37
39
|
let(:adoc_sources) do
|
38
40
|
{
|
@@ -43,14 +45,14 @@ RSpec.describe(DefMastership::UpdateDefModifier) do
|
|
43
45
|
let(:new_adoc_sources) { nil }
|
44
46
|
|
45
47
|
before do
|
46
|
-
allow(
|
48
|
+
allow(Defmastership::Document).to(receive(:new).and_return(document))
|
47
49
|
allow(document).to(receive(:parse_file_with_preprocessor).with('file1.adoc'))
|
48
50
|
allow(document).to(receive(:parse_file_with_preprocessor).with('file2.adoc'))
|
49
51
|
|
50
52
|
modifier.do_modifications(adoc_sources)
|
51
53
|
end
|
52
54
|
|
53
|
-
it { expect(
|
55
|
+
it { expect(Defmastership::Document).to(have_received(:new)) }
|
54
56
|
|
55
57
|
it do
|
56
58
|
expect(document).to(
|
@@ -68,13 +70,13 @@ RSpec.describe(DefMastership::UpdateDefModifier) do
|
|
68
70
|
|
69
71
|
describe '#replace_reference' do
|
70
72
|
subject(:modifier) do
|
71
|
-
|
73
|
+
Defmastership::Modifier::ConcreteRef.new(
|
72
74
|
def_type: 'requirement'
|
73
75
|
)
|
74
76
|
end
|
75
77
|
|
76
|
-
let(:definition) { instance_double(
|
77
|
-
let(:document) { instance_double(
|
78
|
+
let(:definition) { instance_double(Defmastership::Definition, 'definition') }
|
79
|
+
let(:document) { instance_double(Defmastership::Document, 'document') }
|
78
80
|
let(:definitions) { { 'REFERENCE' => definition } }
|
79
81
|
|
80
82
|
before do
|
@@ -97,7 +99,7 @@ RSpec.describe(DefMastership::UpdateDefModifier) do
|
|
97
99
|
|
98
100
|
context 'when definition has the good type' do
|
99
101
|
before do
|
100
|
-
allow(
|
102
|
+
allow(Defmastership::Document).to(receive(:new).and_return(document))
|
101
103
|
allow(document).to(receive(:ref_to_def).with('REFERENCE').and_return(definition))
|
102
104
|
allow(definition).to(receive(:sha256_short).and_return('~abcd1234'))
|
103
105
|
end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# Copyright (c) 2020 Jerome Arbez-Gindre
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require('defmastership/
|
4
|
+
require('defmastership/modifier/update_def_version')
|
5
5
|
require('git')
|
6
6
|
|
7
|
-
RSpec.describe(
|
7
|
+
RSpec.describe(Defmastership::Modifier::UpdateDefVersion) do
|
8
8
|
subject(:modifier) { described_class.new({}) }
|
9
9
|
|
10
10
|
describe '.new' do
|
11
|
-
it { expect(described_class.ancestors).to(include(
|
11
|
+
it { expect(described_class.ancestors).to(include(Defmastership::Modifier::ModifierCommon)) }
|
12
12
|
it { is_expected.not_to(be_nil) }
|
13
13
|
it { is_expected.to(have_attributes(def_type: '')) }
|
14
14
|
it { is_expected.to(have_attributes(ref_document: [])) }
|
@@ -29,10 +29,10 @@ RSpec.describe(DefMastership::UpdateDefVersionModifier) do
|
|
29
29
|
)
|
30
30
|
end
|
31
31
|
|
32
|
-
let(:document) { instance_double(
|
33
|
-
let(:ref_document) { instance_double(
|
34
|
-
let(:definition) { instance_double(
|
35
|
-
let(:ref_definition) { instance_double(
|
32
|
+
let(:document) { instance_double(Defmastership::Document, 'document') }
|
33
|
+
let(:ref_document) { instance_double(Defmastership::Document, 'ref_document') }
|
34
|
+
let(:definition) { instance_double(Defmastership::Definition, 'definition') }
|
35
|
+
let(:ref_definition) { instance_double(Defmastership::Definition, 'ref_definitions') }
|
36
36
|
let(:adoc_sources) do
|
37
37
|
{
|
38
38
|
'file1.adoc' => "[define,req,REFERENCE]\nfile1 line2",
|
@@ -41,7 +41,7 @@ RSpec.describe(DefMastership::UpdateDefVersionModifier) do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
before do
|
44
|
-
allow(
|
44
|
+
allow(Defmastership::Document).to(receive(:new).twice.and_return(ref_document, document))
|
45
45
|
allow(document).to(receive(:parse_file_with_preprocessor).with('file1.adoc'))
|
46
46
|
allow(document).to(receive(:parse_file_with_preprocessor).with('file2.adoc'))
|
47
47
|
allow(ref_document).to(receive(:parse_file_with_preprocessor).with('ref_doc.adoc'))
|
@@ -55,7 +55,7 @@ RSpec.describe(DefMastership::UpdateDefVersionModifier) do
|
|
55
55
|
end
|
56
56
|
|
57
57
|
it { is_expected.to(have_attributes(ref_document: ['ref_doc.adoc'])) }
|
58
|
-
it { expect(
|
58
|
+
it { expect(Defmastership::Document).to(have_received(:new).twice) }
|
59
59
|
it { expect(document).to(have_received(:parse_file_with_preprocessor).twice) }
|
60
60
|
it { expect(ref_document).to(have_received(:parse_file_with_preprocessor).with('ref_doc.adoc')) }
|
61
61
|
|
@@ -73,10 +73,10 @@ RSpec.describe(DefMastership::UpdateDefVersionModifier) do
|
|
73
73
|
)
|
74
74
|
end
|
75
75
|
|
76
|
-
let(:document) { instance_double(
|
77
|
-
let(:ref_document) { instance_double(
|
78
|
-
let(:definition) { instance_double(
|
79
|
-
let(:ref_definition) { instance_double(
|
76
|
+
let(:document) { instance_double(Defmastership::Document, 'document') }
|
77
|
+
let(:ref_document) { instance_double(Defmastership::Document, 'ref_document') }
|
78
|
+
let(:definition) { instance_double(Defmastership::Definition, 'definition') }
|
79
|
+
let(:ref_definition) { instance_double(Defmastership::Definition, 'ref_definitions') }
|
80
80
|
let(:adoc_sources) do
|
81
81
|
{
|
82
82
|
'file1.adoc' => "[define,req,REFERENCE]\nfile1 line2",
|
@@ -85,7 +85,7 @@ RSpec.describe(DefMastership::UpdateDefVersionModifier) do
|
|
85
85
|
end
|
86
86
|
|
87
87
|
before do
|
88
|
-
allow(
|
88
|
+
allow(Defmastership::Document).to(receive(:new).twice.and_return(ref_document, document))
|
89
89
|
allow(document).to(receive(:parse_file_with_preprocessor).with('file1.adoc'))
|
90
90
|
allow(document).to(receive(:parse_file_with_preprocessor).with('file2.adoc'))
|
91
91
|
allow(ref_document).to(receive(:parse_file_with_preprocessor).with('ref_doc1.adoc'))
|
@@ -99,7 +99,7 @@ RSpec.describe(DefMastership::UpdateDefVersionModifier) do
|
|
99
99
|
modifier.do_modifications(adoc_sources)
|
100
100
|
end
|
101
101
|
|
102
|
-
it { expect(
|
102
|
+
it { expect(Defmastership::Document).to(have_received(:new).twice) }
|
103
103
|
it { expect(document).to(have_received(:parse_file_with_preprocessor).twice) }
|
104
104
|
it { expect(ref_document).to(have_received(:parse_file_with_preprocessor).with('ref_doc1.adoc')) }
|
105
105
|
it { expect(ref_document).to(have_received(:parse_file_with_preprocessor).with('ref_doc2.adoc')) }
|
@@ -114,10 +114,10 @@ RSpec.describe(DefMastership::UpdateDefVersionModifier) do
|
|
114
114
|
)
|
115
115
|
end
|
116
116
|
|
117
|
-
let(:document) { instance_double(
|
118
|
-
let(:ref_document) { instance_double(
|
119
|
-
let(:definition) { instance_double(
|
120
|
-
let(:ref_definition) { instance_double(
|
117
|
+
let(:document) { instance_double(Defmastership::Document, 'document') }
|
118
|
+
let(:ref_document) { instance_double(Defmastership::Document, 'ref_document') }
|
119
|
+
let(:definition) { instance_double(Defmastership::Definition, 'definition') }
|
120
|
+
let(:ref_definition) { instance_double(Defmastership::Definition, 'ref_definitions') }
|
121
121
|
let(:adoc_sources) do
|
122
122
|
{
|
123
123
|
'file1.adoc' => "[define,req,REFERENCE]\nfile1 line2",
|
@@ -128,7 +128,7 @@ RSpec.describe(DefMastership::UpdateDefVersionModifier) do
|
|
128
128
|
before do
|
129
129
|
allow(Dir).to(receive(:mktmpdir).and_yield('tmp'))
|
130
130
|
allow(Git).to(receive(:clone))
|
131
|
-
allow(
|
131
|
+
allow(Defmastership::Document).to(receive(:new).twice.and_return(ref_document, document))
|
132
132
|
allow(document).to(receive(:parse_file_with_preprocessor).with('file1.adoc'))
|
133
133
|
allow(document).to(receive(:parse_file_with_preprocessor).with('file2.adoc'))
|
134
134
|
allow(ref_document).to(receive(:parse_file_with_preprocessor).with('tmp/file1.adoc'))
|
@@ -144,7 +144,7 @@ RSpec.describe(DefMastership::UpdateDefVersionModifier) do
|
|
144
144
|
|
145
145
|
it { expect(Dir).to(have_received(:mktmpdir).with('defmastership')) }
|
146
146
|
it { expect(Git).to(have_received(:clone).with('.', 'tmp', branch: 'THE_TAG')) }
|
147
|
-
it { expect(
|
147
|
+
it { expect(Defmastership::Document).to(have_received(:new).twice) }
|
148
148
|
it { expect(ref_document).to(have_received(:parse_file_with_preprocessor).with('tmp/file1.adoc')) }
|
149
149
|
it { expect(ref_document).to(have_received(:parse_file_with_preprocessor).with('tmp/file2.adoc')) }
|
150
150
|
it { expect(ref_document).to(have_received(:parse_file_with_preprocessor).twice) }
|
@@ -164,10 +164,10 @@ RSpec.describe(DefMastership::UpdateDefVersionModifier) do
|
|
164
164
|
)
|
165
165
|
end
|
166
166
|
|
167
|
-
let(:document) { instance_double(
|
168
|
-
let(:ref_document) { instance_double(
|
169
|
-
let(:definition) { instance_double(
|
170
|
-
let(:ref_definition) { instance_double(
|
167
|
+
let(:document) { instance_double(Defmastership::Document, 'document') }
|
168
|
+
let(:ref_document) { instance_double(Defmastership::Document, 'ref_document') }
|
169
|
+
let(:definition) { instance_double(Defmastership::Definition, 'definition') }
|
170
|
+
let(:ref_definition) { instance_double(Defmastership::Definition, 'ref_definitions') }
|
171
171
|
let(:adoc_sources) do
|
172
172
|
{
|
173
173
|
'file1.adoc' => "[define,req,REFERENCE]\nfile1 line2",
|
@@ -178,7 +178,7 @@ RSpec.describe(DefMastership::UpdateDefVersionModifier) do
|
|
178
178
|
before do
|
179
179
|
allow(Dir).to(receive(:mktmpdir).and_yield('tmp'))
|
180
180
|
allow(Git).to(receive(:clone))
|
181
|
-
allow(
|
181
|
+
allow(Defmastership::Document).to(receive(:new).twice.and_return(ref_document, document))
|
182
182
|
allow(document).to(receive(:parse_file_with_preprocessor).with('file1.adoc'))
|
183
183
|
allow(document).to(receive(:parse_file_with_preprocessor).with('file2.adoc'))
|
184
184
|
allow(ref_document).to(receive(:parse_file_with_preprocessor).with('tmp/file1.adoc'))
|
@@ -194,7 +194,7 @@ RSpec.describe(DefMastership::UpdateDefVersionModifier) do
|
|
194
194
|
|
195
195
|
it { expect(Dir).to(have_received(:mktmpdir).with('defmastership')) }
|
196
196
|
it { expect(Git).to(have_received(:clone).with('not dot', 'tmp', branch: 'THE_TAG')) }
|
197
|
-
it { expect(
|
197
|
+
it { expect(Defmastership::Document).to(have_received(:new).twice) }
|
198
198
|
it { expect(ref_document).to(have_received(:parse_file_with_preprocessor).with('tmp/file1.adoc')) }
|
199
199
|
it { expect(ref_document).to(have_received(:parse_file_with_preprocessor).with('tmp/file2.adoc')) }
|
200
200
|
it { expect(ref_document).to(have_received(:parse_file_with_preprocessor).twice) }
|
@@ -214,10 +214,10 @@ RSpec.describe(DefMastership::UpdateDefVersionModifier) do
|
|
214
214
|
)
|
215
215
|
end
|
216
216
|
|
217
|
-
let(:document) { instance_double(
|
218
|
-
let(:ref_document) { instance_double(
|
219
|
-
let(:definition) { instance_double(
|
220
|
-
let(:ref_definition) { instance_double(
|
217
|
+
let(:document) { instance_double(Defmastership::Document, 'document') }
|
218
|
+
let(:ref_document) { instance_double(Defmastership::Document, 'ref_document') }
|
219
|
+
let(:definition) { instance_double(Defmastership::Definition, 'definition') }
|
220
|
+
let(:ref_definition) { instance_double(Defmastership::Definition, 'ref_definitions') }
|
221
221
|
let(:adoc_sources) do
|
222
222
|
{
|
223
223
|
'file1.adoc' => "[define,req,REFERENCE]\nfile1 line2",
|
@@ -228,7 +228,7 @@ RSpec.describe(DefMastership::UpdateDefVersionModifier) do
|
|
228
228
|
before do
|
229
229
|
allow(Dir).to(receive(:mktmpdir).and_yield('tmp'))
|
230
230
|
allow(Git).to(receive(:clone))
|
231
|
-
allow(
|
231
|
+
allow(Defmastership::Document).to(receive(:new).twice.and_return(ref_document, document))
|
232
232
|
allow(document).to(receive(:parse_file_with_preprocessor).with('file1.adoc'))
|
233
233
|
allow(document).to(receive(:parse_file_with_preprocessor).with('file2.adoc'))
|
234
234
|
allow(ref_document).to(receive(:parse_file_with_preprocessor))
|
@@ -243,7 +243,7 @@ RSpec.describe(DefMastership::UpdateDefVersionModifier) do
|
|
243
243
|
|
244
244
|
it { expect(Dir).to(have_received(:mktmpdir).with('defmastership')) }
|
245
245
|
it { expect(Git).to(have_received(:clone).with('.', 'tmp', branch: 'THE_TAG')) }
|
246
|
-
it { expect(
|
246
|
+
it { expect(Defmastership::Document).to(have_received(:new).twice) }
|
247
247
|
it { expect(ref_document).to(have_received(:parse_file_with_preprocessor).with('tmp/./another/doc.adoc')) }
|
248
248
|
it { expect(ref_document).to(have_received(:parse_file_with_preprocessor).once) }
|
249
249
|
|
@@ -261,14 +261,14 @@ RSpec.describe(DefMastership::UpdateDefVersionModifier) do
|
|
261
261
|
)
|
262
262
|
end
|
263
263
|
|
264
|
-
let(:document) { instance_double(
|
265
|
-
let(:ref_document) { instance_double(
|
266
|
-
let(:definition) { instance_double(
|
267
|
-
let(:ref_definition) { instance_double(
|
264
|
+
let(:document) { instance_double(Defmastership::Document, 'document') }
|
265
|
+
let(:ref_document) { instance_double(Defmastership::Document, 'ref_document') }
|
266
|
+
let(:definition) { instance_double(Defmastership::Definition, 'definition') }
|
267
|
+
let(:ref_definition) { instance_double(Defmastership::Definition, 'ref_definitions') }
|
268
268
|
|
269
269
|
before do
|
270
270
|
allow(File).to(receive(:rename))
|
271
|
-
allow(
|
271
|
+
allow(Defmastership::Document).to(receive(:new).with(no_args).and_return(ref_document, document))
|
272
272
|
end
|
273
273
|
|
274
274
|
context 'when definition has not the good type' do
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# Copyright (c) 2020 Jerome Arbez-Gindre
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
RSpec.describe(
|
4
|
+
RSpec.describe(Defmastership) do
|
5
5
|
it 'has a version number' do
|
6
|
-
expect(
|
6
|
+
expect(Defmastership::VERSION).not_to(be_nil)
|
7
7
|
end
|
8
8
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Copyright (c) 2024 Jerome Arbez-Gindre
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
namespace 'documentation' do
|
5
|
+
require('yard')
|
6
|
+
|
7
|
+
YARD::Rake::YardocTask.new do |task|
|
8
|
+
task.files = ['lib/**/*.rb']
|
9
|
+
task.options = ['--fail-on-warning', '--verbose']
|
10
|
+
task.stats_options = ['--list-undoc']
|
11
|
+
end
|
12
|
+
rescue LoadError
|
13
|
+
task(:yard) do
|
14
|
+
puts('Install Yard to run its rake tasks')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
desc 'Synonym for documentation:yard'
|
19
|
+
task(yard: 'documentation:yard')
|
data/tasks/package.rake
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: defmastership
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jérôme Arbez-Gindre
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aasm
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: defmastership-core
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.2.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.2.0
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: git
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,21 +94,33 @@ dependencies:
|
|
80
94
|
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '2'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: ostruct
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
83
111
|
description:
|
84
112
|
email: jeromearbezgindre@gmail.com
|
85
113
|
executables:
|
86
114
|
- defmastership
|
87
115
|
extensions: []
|
88
|
-
extra_rdoc_files:
|
89
|
-
- README.rdoc
|
90
|
-
- defmastership.rdoc
|
116
|
+
extra_rdoc_files: []
|
91
117
|
files:
|
92
118
|
- ".gitignore"
|
93
119
|
- ".gitlab-ci.yml"
|
94
120
|
- Gemfile
|
95
121
|
- Guardfile
|
96
122
|
- LICENSE
|
97
|
-
- README.
|
123
|
+
- README.adoc
|
98
124
|
- Rakefile
|
99
125
|
- bin/defmastership
|
100
126
|
- config/cucumber.yml
|
@@ -103,7 +129,6 @@ files:
|
|
103
129
|
- config/rspec
|
104
130
|
- config/rubocop.yml
|
105
131
|
- defmastership.gemspec
|
106
|
-
- defmastership.rdoc
|
107
132
|
- features/changeref.feature
|
108
133
|
- features/definition_checksum.feature
|
109
134
|
- features/definition_version.feature
|
@@ -116,48 +141,46 @@ files:
|
|
116
141
|
- features/support/env.rb
|
117
142
|
- lib/defmastership.rb
|
118
143
|
- lib/defmastership/batch_modifier.rb
|
119
|
-
- lib/defmastership/change_ref_modifier.rb
|
120
144
|
- lib/defmastership/comment_filter.rb
|
121
|
-
- lib/defmastership/constants.rb
|
122
|
-
- lib/defmastership/csv_formatter.rb
|
123
|
-
- lib/defmastership/csv_formatter_body.rb
|
124
|
-
- lib/defmastership/csv_formatter_header.rb
|
125
145
|
- lib/defmastership/definition.rb
|
126
146
|
- lib/defmastership/definition_parser.rb
|
127
147
|
- lib/defmastership/document.rb
|
148
|
+
- lib/defmastership/export/body_formatter.rb
|
149
|
+
- lib/defmastership/export/csv/formatter.rb
|
150
|
+
- lib/defmastership/export/header_formatter.rb
|
128
151
|
- lib/defmastership/filters.rb
|
129
152
|
- lib/defmastership/matching_line.rb
|
130
|
-
- lib/defmastership/modifier.rb
|
131
|
-
- lib/defmastership/
|
132
|
-
- lib/defmastership/
|
133
|
-
- lib/defmastership/
|
153
|
+
- lib/defmastership/modifier/change_ref.rb
|
154
|
+
- lib/defmastership/modifier/factory.rb
|
155
|
+
- lib/defmastership/modifier/modifier_common.rb
|
156
|
+
- lib/defmastership/modifier/rename_included_files.rb
|
157
|
+
- lib/defmastership/modifier/update_def.rb
|
158
|
+
- lib/defmastership/modifier/update_def_checksum.rb
|
159
|
+
- lib/defmastership/modifier/update_def_version.rb
|
134
160
|
- lib/defmastership/set_join_hack.rb
|
135
|
-
- lib/defmastership/update_def_checksum_modifier.rb
|
136
|
-
- lib/defmastership/update_def_modifier.rb
|
137
|
-
- lib/defmastership/update_def_version_modifier.rb
|
138
161
|
- lib/defmastership/version.rb
|
139
162
|
- spec/spec_helper.rb
|
140
|
-
- spec/unit/
|
141
|
-
- spec/unit/
|
142
|
-
- spec/unit/
|
143
|
-
- spec/unit/
|
144
|
-
- spec/unit/
|
145
|
-
- spec/unit/
|
146
|
-
- spec/unit/
|
147
|
-
- spec/unit/
|
148
|
-
- spec/unit/
|
149
|
-
- spec/unit/
|
150
|
-
- spec/unit/
|
151
|
-
- spec/unit/
|
152
|
-
- spec/unit/
|
153
|
-
- spec/unit/
|
154
|
-
- spec/unit/
|
155
|
-
- spec/unit/
|
156
|
-
- spec/unit/
|
157
|
-
- spec/unit/def_mastership_spec.rb
|
163
|
+
- spec/unit/defmastership/batch_modifier_spec.rb
|
164
|
+
- spec/unit/defmastership/definition_parser_spec.rb
|
165
|
+
- spec/unit/defmastership/definition_spec.rb
|
166
|
+
- spec/unit/defmastership/document_spec.rb
|
167
|
+
- spec/unit/defmastership/export/body_formatter_spec.rb
|
168
|
+
- spec/unit/defmastership/export/csv/formatter_spec.rb
|
169
|
+
- spec/unit/defmastership/export/header_formatter_spec.rb
|
170
|
+
- spec/unit/defmastership/matching_line_spec.rb
|
171
|
+
- spec/unit/defmastership/modifier/change_ref_spec.rb
|
172
|
+
- spec/unit/defmastership/modifier/factory_spec.rb
|
173
|
+
- spec/unit/defmastership/modifier/modifier_common_spec.rb
|
174
|
+
- spec/unit/defmastership/modifier/rename_included_files_spec.rb
|
175
|
+
- spec/unit/defmastership/modifier/update_def_checksum_spec.rb
|
176
|
+
- spec/unit/defmastership/modifier/update_def_spec.rb
|
177
|
+
- spec/unit/defmastership/modifier/update_def_version_spec.rb
|
178
|
+
- spec/unit/defmastership/string_spec.rb
|
179
|
+
- spec/unit/defmastership_spec.rb
|
158
180
|
- tasks/code_quality.rake
|
159
181
|
- tasks/console.rake
|
160
|
-
- tasks/
|
182
|
+
- tasks/documentation.rake
|
183
|
+
- tasks/package.rake
|
161
184
|
- tasks/test.rake
|
162
185
|
homepage: https://gitlab.com/jjag/defmastership/
|
163
186
|
licenses:
|
@@ -165,10 +188,7 @@ licenses:
|
|
165
188
|
metadata:
|
166
189
|
rubygems_mfa_required: 'true'
|
167
190
|
post_install_message:
|
168
|
-
rdoc_options:
|
169
|
-
- "--title defmastership"
|
170
|
-
- "--main README.rdoc"
|
171
|
-
- "-ri"
|
191
|
+
rdoc_options: []
|
172
192
|
require_paths:
|
173
193
|
- lib
|
174
194
|
- lib
|
@@ -183,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
183
203
|
- !ruby/object:Gem::Version
|
184
204
|
version: '0'
|
185
205
|
requirements: []
|
186
|
-
rubygems_version: 3.5.
|
206
|
+
rubygems_version: 3.5.22
|
187
207
|
signing_key:
|
188
208
|
specification_version: 4
|
189
209
|
summary: Handling of references and definitions with asciidoctor
|
data/README.rdoc
DELETED