defmastership 1.0.18 → 1.0.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.gitlab-ci.yml +15 -1
- data/Gemfile +27 -7
- data/Guardfile +44 -0
- data/config/cucumber.yml +3 -0
- data/config/mutant.yml +4 -0
- data/config/reek.yml +129 -105
- data/config/rubocop.yml +72 -28
- data/defmastership.gemspec +5 -3
- data/features/changeref.feature +0 -8
- data/features/definition_checksum.feature +0 -10
- data/features/definition_version.feature +168 -10
- data/features/export.feature +23 -18
- data/features/modify.feature +1 -5
- data/features/rename_included_files.feature +0 -5
- data/features/step_definitions/git_steps.rb +19 -0
- data/lib/defmastership/constants.rb +5 -3
- data/lib/defmastership/definition.rb +2 -2
- data/lib/defmastership/document.rb +6 -14
- data/lib/defmastership/update_def_modifier.rb +1 -1
- data/lib/defmastership/update_def_version_modifier.rb +30 -5
- data/lib/defmastership/version.rb +1 -1
- data/spec/unit/def_mastership/batch_modifier_spec.rb +2 -0
- data/spec/unit/def_mastership/modifier_factory_spec.rb +1 -0
- data/spec/unit/def_mastership/modifier_spec.rb +8 -6
- data/spec/unit/def_mastership/update_def_modifier_spec.rb +2 -0
- data/spec/unit/def_mastership/update_def_version_modifier_spec.rb +225 -33
- data/tasks/code_quality.rake +74 -0
- data/tasks/test.rake +6 -21
- metadata +36 -11
- data/.rubocop.yml +0 -76
- data/config/devtools.yml +0 -2
- data/config/flay.yml +0 -3
- data/config/flog.yml +0 -2
- data/config/yardstick.yml +0 -2
- data/cucumber.yml +0 -2
- data/tasks/smelling_code.rake +0 -38
- /data/{.rspec → config/rspec} +0 -0
@@ -3,6 +3,8 @@
|
|
3
3
|
|
4
4
|
require 'defmastership/constants'
|
5
5
|
require 'defmastership/update_def_modifier'
|
6
|
+
require 'git'
|
7
|
+
require 'tmpdir'
|
6
8
|
|
7
9
|
module DefMastership
|
8
10
|
# modify one line after another
|
@@ -10,7 +12,9 @@ module DefMastership
|
|
10
12
|
def self.default_config
|
11
13
|
{
|
12
14
|
def_type: '',
|
13
|
-
ref_document:
|
15
|
+
ref_document: [],
|
16
|
+
ref_tag: '',
|
17
|
+
ref_repo: '.',
|
14
18
|
first_version: ''
|
15
19
|
}
|
16
20
|
end
|
@@ -18,17 +22,33 @@ module DefMastership
|
|
18
22
|
def initialize(config)
|
19
23
|
@ref_document = Document.new
|
20
24
|
|
21
|
-
|
25
|
+
Helper.normalilize_config(config) if config.key?(:ref_document)
|
26
|
+
|
27
|
+
super
|
22
28
|
end
|
23
29
|
|
24
30
|
def do_modifications(adoc_sources)
|
25
|
-
|
31
|
+
if ref_tag == ''
|
32
|
+
ref_document.each { |ref_doc| @ref_document.parse_file_with_preprocessor(ref_doc) }
|
33
|
+
else
|
34
|
+
Dir.mktmpdir('defmastership') do |tmpdir|
|
35
|
+
parse_ref_files_from_git(adoc_sources, tmpdir)
|
36
|
+
end
|
37
|
+
end
|
26
38
|
|
27
|
-
super
|
39
|
+
super
|
28
40
|
end
|
29
41
|
|
30
42
|
private
|
31
43
|
|
44
|
+
def parse_ref_files_from_git(adoc_sources, tmpdir)
|
45
|
+
Git.clone(ref_repo, tmpdir, branch: ref_tag)
|
46
|
+
ref_sources = ref_document.empty? ? adoc_sources.keys : ref_document
|
47
|
+
ref_sources.each do |adoc_file|
|
48
|
+
@ref_document.parse_file_with_preprocessor("#{tmpdir}/#{adoc_file}")
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
32
52
|
def reference_replacement(reference, match)
|
33
53
|
"#{reference}#{version_and_checksum_str(match)}"
|
34
54
|
end
|
@@ -46,7 +66,7 @@ module DefMastership
|
|
46
66
|
definition = Helper.def_from_match(document, match)
|
47
67
|
return unless ref_definition
|
48
68
|
|
49
|
-
Helper.ref_version(ref_definition, definition,
|
69
|
+
Helper.ref_version(ref_definition, definition, first_version)
|
50
70
|
end
|
51
71
|
|
52
72
|
# Helper functions
|
@@ -61,6 +81,11 @@ module DefMastership
|
|
61
81
|
|
62
82
|
new_ref_version ? new_ref_version.next : first_version
|
63
83
|
end
|
84
|
+
|
85
|
+
def self.normalilize_config(config)
|
86
|
+
ref_docs = config.fetch(:ref_document)
|
87
|
+
config[:ref_document] = [ref_docs] if ref_docs.instance_of?(String)
|
88
|
+
end
|
64
89
|
end
|
65
90
|
end
|
66
91
|
end
|
@@ -3,7 +3,10 @@
|
|
3
3
|
|
4
4
|
require('defmastership/modifier')
|
5
5
|
|
6
|
-
class
|
6
|
+
# just a class for test
|
7
|
+
class DummyClassParent
|
8
|
+
# This method smells of :reek:ControlParameter
|
9
|
+
# This method smells of :reek:UtilityFunction
|
7
10
|
def respond_to_missing?(method_name, *_)
|
8
11
|
return true if method_name == :ploup
|
9
12
|
|
@@ -11,7 +14,8 @@ class DummyclassParrent
|
|
11
14
|
end
|
12
15
|
end
|
13
16
|
|
14
|
-
class
|
17
|
+
# just a class for test
|
18
|
+
class DummyClass < DummyClassParent
|
15
19
|
include DefMastership::Modifier
|
16
20
|
|
17
21
|
def self.replacement_methods
|
@@ -27,19 +31,17 @@ class DummyClass < DummyclassParrent
|
|
27
31
|
super()
|
28
32
|
end
|
29
33
|
|
34
|
+
# This method smells of :reek:UtilityFunction
|
30
35
|
def replace_pouet_by_foo(line)
|
31
36
|
line.gsub('pouet', 'foo')
|
32
37
|
end
|
33
38
|
|
39
|
+
# This method smells of :reek:UtilityFunction
|
34
40
|
def replace_foo_by_zoo(line)
|
35
41
|
line.gsub('foo', 'zoo')
|
36
42
|
end
|
37
43
|
end
|
38
44
|
|
39
|
-
class BadDummyClass < DummyclassParrent
|
40
|
-
include DefMastership::Modifier
|
41
|
-
end
|
42
|
-
|
43
45
|
RSpec.describe(DefMastership::Modifier) do
|
44
46
|
subject(:modifier) { DummyClass.new({}) }
|
45
47
|
|
@@ -4,9 +4,11 @@
|
|
4
4
|
require('defmastership/update_def_modifier')
|
5
5
|
|
6
6
|
module DefMastership
|
7
|
+
# Just a class for tests
|
7
8
|
class ConcreteRefModifier < UpdateDefModifier
|
8
9
|
private
|
9
10
|
|
11
|
+
# This method smells of :reek:UtilityFunction
|
10
12
|
def reference_replacement(reference, match)
|
11
13
|
"#{reference}_something_#{match[:explicit_version]}"
|
12
14
|
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require('defmastership/update_def_version_modifier')
|
5
|
+
require('git')
|
5
6
|
|
6
7
|
RSpec.describe(DefMastership::UpdateDefVersionModifier) do
|
7
8
|
subject(:modifier) { described_class.new({}) }
|
@@ -10,7 +11,7 @@ RSpec.describe(DefMastership::UpdateDefVersionModifier) do
|
|
10
11
|
it { expect(described_class.ancestors).to(include(DefMastership::Modifier)) }
|
11
12
|
it { is_expected.not_to(be_nil) }
|
12
13
|
it { is_expected.to(have_attributes(def_type: '')) }
|
13
|
-
it { is_expected.to(have_attributes(ref_document:
|
14
|
+
it { is_expected.to(have_attributes(ref_document: [])) }
|
14
15
|
it { is_expected.to(have_attributes(first_version: '')) }
|
15
16
|
end
|
16
17
|
|
@@ -19,45 +20,236 @@ RSpec.describe(DefMastership::UpdateDefVersionModifier) do
|
|
19
20
|
end
|
20
21
|
|
21
22
|
describe '#do_modifications' do
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
context 'when only one ref document' do
|
24
|
+
subject(:modifier) do
|
25
|
+
described_class.new(
|
26
|
+
ref_document: 'ref_doc.adoc',
|
27
|
+
def_type: 'req',
|
28
|
+
first_version: 'a'
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
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
|
+
let(:adoc_sources) do
|
37
|
+
{
|
38
|
+
'file1.adoc' => "[define,req,REFERENCE]\nfile1 line2",
|
39
|
+
'file2.adoc' => "file2 line1\nfile2 line2"
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
before do
|
44
|
+
allow(DefMastership::Document).to(receive(:new).twice.and_return(ref_document, document))
|
45
|
+
allow(document).to(receive(:parse_file_with_preprocessor).with('file1.adoc'))
|
46
|
+
allow(document).to(receive(:parse_file_with_preprocessor).with('file2.adoc'))
|
47
|
+
allow(ref_document).to(receive(:parse_file_with_preprocessor).with('ref_doc.adoc'))
|
48
|
+
allow(document).to(receive(:ref_to_def).with('REFERENCE').and_return(definition))
|
49
|
+
allow(ref_document).to(receive(:ref_to_def).with('REFERENCE').and_return(ref_definition))
|
50
|
+
allow(ref_definition).to(receive(:explicit_version).with(no_args).and_return(nil))
|
51
|
+
allow(definition).to(receive(:sha256_short).with(no_args).and_return('something'))
|
52
|
+
allow(ref_definition).to(receive(:sha256_short).with(no_args).and_return('something_else'))
|
53
|
+
|
54
|
+
modifier.do_modifications(adoc_sources)
|
55
|
+
end
|
56
|
+
|
57
|
+
it { is_expected.to(have_attributes(ref_document: ['ref_doc.adoc'])) }
|
58
|
+
it { expect(DefMastership::Document).to(have_received(:new).twice) }
|
59
|
+
it { expect(document).to(have_received(:parse_file_with_preprocessor).twice) }
|
60
|
+
it { expect(ref_document).to(have_received(:parse_file_with_preprocessor).with('ref_doc.adoc')) }
|
61
|
+
|
62
|
+
it do
|
63
|
+
expect(modifier.do_modifications(adoc_sources).fetch('file1.adoc')).to(include('REFERENCE(a)'))
|
64
|
+
end
|
28
65
|
end
|
29
66
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
67
|
+
context 'when more ref document' do
|
68
|
+
subject(:modifier) do
|
69
|
+
described_class.new(
|
70
|
+
ref_document: ['ref_doc1.adoc', 'ref_doc2.adoc'],
|
71
|
+
def_type: 'req',
|
72
|
+
first_version: 'a'
|
73
|
+
)
|
74
|
+
end
|
75
|
+
|
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
|
+
let(:adoc_sources) do
|
81
|
+
{
|
82
|
+
'file1.adoc' => "[define,req,REFERENCE]\nfile1 line2",
|
83
|
+
'file2.adoc' => "file2 line1\nfile2 line2"
|
84
|
+
}
|
85
|
+
end
|
86
|
+
|
87
|
+
before do
|
88
|
+
allow(DefMastership::Document).to(receive(:new).twice.and_return(ref_document, document))
|
89
|
+
allow(document).to(receive(:parse_file_with_preprocessor).with('file1.adoc'))
|
90
|
+
allow(document).to(receive(:parse_file_with_preprocessor).with('file2.adoc'))
|
91
|
+
allow(ref_document).to(receive(:parse_file_with_preprocessor).with('ref_doc1.adoc'))
|
92
|
+
allow(ref_document).to(receive(:parse_file_with_preprocessor).with('ref_doc2.adoc'))
|
93
|
+
allow(document).to(receive(:ref_to_def).with('REFERENCE').and_return(definition))
|
94
|
+
allow(ref_document).to(receive(:ref_to_def).with('REFERENCE').and_return(ref_definition))
|
95
|
+
allow(ref_definition).to(receive(:explicit_version).with(no_args).and_return(nil))
|
96
|
+
allow(definition).to(receive(:sha256_short).with(no_args).and_return('something'))
|
97
|
+
allow(ref_definition).to(receive(:sha256_short).with(no_args).and_return('something_else'))
|
98
|
+
|
99
|
+
modifier.do_modifications(adoc_sources)
|
100
|
+
end
|
101
|
+
|
102
|
+
it { expect(DefMastership::Document).to(have_received(:new).twice) }
|
103
|
+
it { expect(document).to(have_received(:parse_file_with_preprocessor).twice) }
|
104
|
+
it { expect(ref_document).to(have_received(:parse_file_with_preprocessor).with('ref_doc1.adoc')) }
|
105
|
+
it { expect(ref_document).to(have_received(:parse_file_with_preprocessor).with('ref_doc2.adoc')) }
|
39
106
|
end
|
40
107
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
108
|
+
context 'when ref_tag is provided' do
|
109
|
+
subject(:modifier) do
|
110
|
+
described_class.new(
|
111
|
+
ref_tag: 'THE_TAG',
|
112
|
+
def_type: 'req',
|
113
|
+
first_version: 'a'
|
114
|
+
)
|
115
|
+
end
|
116
|
+
|
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
|
+
let(:adoc_sources) do
|
122
|
+
{
|
123
|
+
'file1.adoc' => "[define,req,REFERENCE]\nfile1 line2",
|
124
|
+
'file2.adoc' => "file2 line1\nfile2 line2"
|
125
|
+
}
|
126
|
+
end
|
127
|
+
|
128
|
+
before do
|
129
|
+
allow(Dir).to(receive(:mktmpdir).and_yield('tmp'))
|
130
|
+
allow(Git).to(receive(:clone))
|
131
|
+
allow(DefMastership::Document).to(receive(:new).twice.and_return(ref_document, document))
|
132
|
+
allow(document).to(receive(:parse_file_with_preprocessor).with('file1.adoc'))
|
133
|
+
allow(document).to(receive(:parse_file_with_preprocessor).with('file2.adoc'))
|
134
|
+
allow(ref_document).to(receive(:parse_file_with_preprocessor).with('tmp/file1.adoc'))
|
135
|
+
allow(ref_document).to(receive(:parse_file_with_preprocessor).with('tmp/file2.adoc'))
|
136
|
+
allow(document).to(receive(:ref_to_def).with('REFERENCE').and_return(definition))
|
137
|
+
allow(ref_document).to(receive(:ref_to_def).with('REFERENCE').and_return(ref_definition))
|
138
|
+
allow(ref_definition).to(receive(:explicit_version).with(no_args).and_return(nil))
|
139
|
+
allow(definition).to(receive(:sha256_short).with(no_args).and_return('something'))
|
140
|
+
allow(ref_definition).to(receive(:sha256_short).with(no_args).and_return('something_else'))
|
141
|
+
|
142
|
+
modifier.do_modifications(adoc_sources)
|
143
|
+
end
|
144
|
+
|
145
|
+
it { expect(Dir).to(have_received(:mktmpdir).with('defmastership')) }
|
146
|
+
it { expect(Git).to(have_received(:clone).with('.', 'tmp', branch: 'THE_TAG')) }
|
147
|
+
it { expect(DefMastership::Document).to(have_received(:new).twice) }
|
148
|
+
it { expect(ref_document).to(have_received(:parse_file_with_preprocessor).with('tmp/file1.adoc')) }
|
149
|
+
it { expect(ref_document).to(have_received(:parse_file_with_preprocessor).with('tmp/file2.adoc')) }
|
150
|
+
it { expect(ref_document).to(have_received(:parse_file_with_preprocessor).twice) }
|
151
|
+
|
152
|
+
it do
|
153
|
+
expect(modifier.do_modifications(adoc_sources).fetch('file1.adoc')).to(include('REFERENCE(a)'))
|
154
|
+
end
|
53
155
|
end
|
54
156
|
|
55
|
-
|
56
|
-
|
57
|
-
|
157
|
+
context 'when ref_tag and ref_repo is provided' do
|
158
|
+
subject(:modifier) do
|
159
|
+
described_class.new(
|
160
|
+
ref_tag: 'THE_TAG',
|
161
|
+
ref_repo: 'not dot',
|
162
|
+
def_type: 'req',
|
163
|
+
first_version: 'a'
|
164
|
+
)
|
165
|
+
end
|
166
|
+
|
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
|
+
let(:adoc_sources) do
|
172
|
+
{
|
173
|
+
'file1.adoc' => "[define,req,REFERENCE]\nfile1 line2",
|
174
|
+
'file2.adoc' => "file2 line1\nfile2 line2"
|
175
|
+
}
|
176
|
+
end
|
177
|
+
|
178
|
+
before do
|
179
|
+
allow(Dir).to(receive(:mktmpdir).and_yield('tmp'))
|
180
|
+
allow(Git).to(receive(:clone))
|
181
|
+
allow(DefMastership::Document).to(receive(:new).twice.and_return(ref_document, document))
|
182
|
+
allow(document).to(receive(:parse_file_with_preprocessor).with('file1.adoc'))
|
183
|
+
allow(document).to(receive(:parse_file_with_preprocessor).with('file2.adoc'))
|
184
|
+
allow(ref_document).to(receive(:parse_file_with_preprocessor).with('tmp/file1.adoc'))
|
185
|
+
allow(ref_document).to(receive(:parse_file_with_preprocessor).with('tmp/file2.adoc'))
|
186
|
+
allow(document).to(receive(:ref_to_def).with('REFERENCE').and_return(definition))
|
187
|
+
allow(ref_document).to(receive(:ref_to_def).with('REFERENCE').and_return(ref_definition))
|
188
|
+
allow(ref_definition).to(receive(:explicit_version).with(no_args).and_return(nil))
|
189
|
+
allow(definition).to(receive(:sha256_short).with(no_args).and_return('something'))
|
190
|
+
allow(ref_definition).to(receive(:sha256_short).with(no_args).and_return('something_else'))
|
191
|
+
|
192
|
+
modifier.do_modifications(adoc_sources)
|
193
|
+
end
|
194
|
+
|
195
|
+
it { expect(Dir).to(have_received(:mktmpdir).with('defmastership')) }
|
196
|
+
it { expect(Git).to(have_received(:clone).with('not dot', 'tmp', branch: 'THE_TAG')) }
|
197
|
+
it { expect(DefMastership::Document).to(have_received(:new).twice) }
|
198
|
+
it { expect(ref_document).to(have_received(:parse_file_with_preprocessor).with('tmp/file1.adoc')) }
|
199
|
+
it { expect(ref_document).to(have_received(:parse_file_with_preprocessor).with('tmp/file2.adoc')) }
|
200
|
+
it { expect(ref_document).to(have_received(:parse_file_with_preprocessor).twice) }
|
58
201
|
|
59
|
-
|
60
|
-
|
202
|
+
it do
|
203
|
+
expect(modifier.do_modifications(adoc_sources).fetch('file1.adoc')).to(include('REFERENCE(a)'))
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
context 'when both ref_tag and ref_document are provided' do
|
208
|
+
subject(:modifier) do
|
209
|
+
described_class.new(
|
210
|
+
ref_tag: 'THE_TAG',
|
211
|
+
ref_document: './another/doc.adoc',
|
212
|
+
def_type: 'req',
|
213
|
+
first_version: 'a'
|
214
|
+
)
|
215
|
+
end
|
216
|
+
|
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
|
+
let(:adoc_sources) do
|
222
|
+
{
|
223
|
+
'file1.adoc' => "[define,req,REFERENCE]\nfile1 line2",
|
224
|
+
'file2.adoc' => "file2 line1\nfile2 line2"
|
225
|
+
}
|
226
|
+
end
|
227
|
+
|
228
|
+
before do
|
229
|
+
allow(Dir).to(receive(:mktmpdir).and_yield('tmp'))
|
230
|
+
allow(Git).to(receive(:clone))
|
231
|
+
allow(DefMastership::Document).to(receive(:new).twice.and_return(ref_document, document))
|
232
|
+
allow(document).to(receive(:parse_file_with_preprocessor).with('file1.adoc'))
|
233
|
+
allow(document).to(receive(:parse_file_with_preprocessor).with('file2.adoc'))
|
234
|
+
allow(ref_document).to(receive(:parse_file_with_preprocessor))
|
235
|
+
allow(document).to(receive(:ref_to_def).with('REFERENCE').and_return(definition))
|
236
|
+
allow(ref_document).to(receive(:ref_to_def).with('REFERENCE').and_return(ref_definition))
|
237
|
+
allow(ref_definition).to(receive(:explicit_version).with(no_args).and_return(nil))
|
238
|
+
allow(definition).to(receive(:sha256_short).with(no_args).and_return('something'))
|
239
|
+
allow(ref_definition).to(receive(:sha256_short).with(no_args).and_return('something_else'))
|
240
|
+
|
241
|
+
modifier.do_modifications(adoc_sources)
|
242
|
+
end
|
243
|
+
|
244
|
+
it { expect(Dir).to(have_received(:mktmpdir).with('defmastership')) }
|
245
|
+
it { expect(Git).to(have_received(:clone).with('.', 'tmp', branch: 'THE_TAG')) }
|
246
|
+
it { expect(DefMastership::Document).to(have_received(:new).twice) }
|
247
|
+
it { expect(ref_document).to(have_received(:parse_file_with_preprocessor).with('tmp/./another/doc.adoc')) }
|
248
|
+
it { expect(ref_document).to(have_received(:parse_file_with_preprocessor).once) }
|
249
|
+
|
250
|
+
it do
|
251
|
+
expect(modifier.do_modifications(adoc_sources).fetch('file1.adoc')).to(include('REFERENCE(a)'))
|
252
|
+
end
|
61
253
|
end
|
62
254
|
end
|
63
255
|
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# Copyright (c) 2023 Jerome Arbez-Gindre
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# rubocop:disable Metrics/BlockLength
|
5
|
+
namespace 'quality' do
|
6
|
+
begin
|
7
|
+
require('rubocop/rake_task')
|
8
|
+
|
9
|
+
RuboCop::RakeTask.new do |task|
|
10
|
+
task.options << '--display-cop-names'
|
11
|
+
task.options << '--config=config/rubocop.yml'
|
12
|
+
end
|
13
|
+
rescue LoadError
|
14
|
+
task(:rubocop) do
|
15
|
+
puts('Install rubocop to run its rake tasks')
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
begin
|
20
|
+
require('reek/rake/task')
|
21
|
+
|
22
|
+
Reek::Rake::Task.new do |task|
|
23
|
+
task.fail_on_error = true
|
24
|
+
task.source_files = '{lib,spec}/**/*.rb'
|
25
|
+
task.reek_opts = '--config config/reek.yml --single-line'
|
26
|
+
end
|
27
|
+
rescue LoadError
|
28
|
+
task(:reek) do
|
29
|
+
puts('Install reek to run its rake tasks')
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
begin
|
34
|
+
require('flay_task')
|
35
|
+
|
36
|
+
FlayTask.new(:flay, 200, %w[bin lib]) do |task|
|
37
|
+
task.verbose = true
|
38
|
+
end
|
39
|
+
rescue LoadError
|
40
|
+
task(:flay) do
|
41
|
+
puts('Install flay to run its rake tasks')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
begin
|
46
|
+
require('rubycritic/rake_task')
|
47
|
+
|
48
|
+
RubyCritic::RakeTask.new do |task|
|
49
|
+
task.verbose = true
|
50
|
+
task.options = '--no-browser'
|
51
|
+
end
|
52
|
+
rescue LoadError
|
53
|
+
task(:rubycritic) do
|
54
|
+
puts('Install rubycritic to run its rake tasks')
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
desc 'Runs all quality code check'
|
59
|
+
task(
|
60
|
+
all: [
|
61
|
+
'quality:rubocop',
|
62
|
+
'quality:reek',
|
63
|
+
'quality:flay',
|
64
|
+
'quality:rubycritic'
|
65
|
+
]
|
66
|
+
)
|
67
|
+
end
|
68
|
+
# rubocop:enable Metrics/BlockLength
|
69
|
+
|
70
|
+
desc 'Synonym for quality:rubocop'
|
71
|
+
task(rubocop: 'quality:rubocop')
|
72
|
+
|
73
|
+
desc 'Synonym for quality:reek'
|
74
|
+
task(reek: 'quality:reek')
|
data/tasks/test.rake
CHANGED
@@ -5,30 +5,15 @@ require('cucumber/rake/task')
|
|
5
5
|
require('rspec/core/rake_task')
|
6
6
|
|
7
7
|
namespace 'test' do
|
8
|
-
RSpec::Core::RakeTask.new(:spec)
|
9
|
-
|
10
|
-
cuke_results = 'features_results.html'
|
11
|
-
CLEAN << cuke_results
|
12
|
-
|
13
|
-
Cucumber::Rake::Task.new(:features) do |t|
|
14
|
-
opts = ['features'] +
|
15
|
-
['--format', 'html'] +
|
16
|
-
['-o', cuke_results] +
|
17
|
-
['--format', 'progress'] +
|
18
|
-
['-x']
|
19
|
-
|
20
|
-
opts += ['--tags', ENV.fetch('TAGS').split.join(' or ')] if ENV['TAGS']
|
21
|
-
t.cucumber_opts = opts
|
8
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
9
|
+
t.rspec_opts = ['--options config/rspec']
|
22
10
|
end
|
23
11
|
|
12
|
+
CLEAN << 'features_results.html'
|
13
|
+
|
14
|
+
Cucumber::Rake::Task.new(:features)
|
24
15
|
Cucumber::Rake::Task.new('features:wip') do |t|
|
25
|
-
t.cucumber_opts = ['
|
26
|
-
['--format', 'html'] +
|
27
|
-
['-o', cuke_results] +
|
28
|
-
['--format', 'pretty'] +
|
29
|
-
['-x'] +
|
30
|
-
['-s'] +
|
31
|
-
['--tags', '@wip and not @pending']
|
16
|
+
t.cucumber_opts = ['--profile wip']
|
32
17
|
end
|
33
18
|
|
34
19
|
desc 'Runs all unit tests and acceptance tests'
|
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.0.
|
4
|
+
version: 1.0.19
|
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-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aasm
|
@@ -38,6 +38,34 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: csv
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: git
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1'
|
41
69
|
- !ruby/object:Gem::Dependency
|
42
70
|
name: gli
|
43
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -63,21 +91,17 @@ extra_rdoc_files:
|
|
63
91
|
files:
|
64
92
|
- ".gitignore"
|
65
93
|
- ".gitlab-ci.yml"
|
66
|
-
- ".rspec"
|
67
|
-
- ".rubocop.yml"
|
68
94
|
- Gemfile
|
95
|
+
- Guardfile
|
69
96
|
- LICENSE
|
70
97
|
- README.rdoc
|
71
98
|
- Rakefile
|
72
99
|
- bin/defmastership
|
73
|
-
- config/
|
74
|
-
- config/flay.yml
|
75
|
-
- config/flog.yml
|
100
|
+
- config/cucumber.yml
|
76
101
|
- config/mutant.yml
|
77
102
|
- config/reek.yml
|
103
|
+
- config/rspec
|
78
104
|
- config/rubocop.yml
|
79
|
-
- config/yardstick.yml
|
80
|
-
- cucumber.yml
|
81
105
|
- defmastership.gemspec
|
82
106
|
- defmastership.rdoc
|
83
107
|
- features/changeref.feature
|
@@ -88,6 +112,7 @@ files:
|
|
88
112
|
- features/modify.feature
|
89
113
|
- features/rename_included_files.feature
|
90
114
|
- features/step_definitions/defmastership_steps.rb
|
115
|
+
- features/step_definitions/git_steps.rb
|
91
116
|
- features/support/env.rb
|
92
117
|
- lib/defmastership.rb
|
93
118
|
- lib/defmastership/batch_modifier.rb
|
@@ -130,9 +155,9 @@ files:
|
|
130
155
|
- spec/unit/def_mastership/update_def_modifier_spec.rb
|
131
156
|
- spec/unit/def_mastership/update_def_version_modifier_spec.rb
|
132
157
|
- spec/unit/def_mastership_spec.rb
|
158
|
+
- tasks/code_quality.rake
|
133
159
|
- tasks/console.rake
|
134
160
|
- tasks/package.task
|
135
|
-
- tasks/smelling_code.rake
|
136
161
|
- tasks/test.rake
|
137
162
|
homepage: https://gitlab.com/jjag/defmastership/
|
138
163
|
licenses:
|
@@ -158,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
183
|
- !ruby/object:Gem::Version
|
159
184
|
version: '0'
|
160
185
|
requirements: []
|
161
|
-
rubygems_version: 3.5.
|
186
|
+
rubygems_version: 3.5.9
|
162
187
|
signing_key:
|
163
188
|
specification_version: 4
|
164
189
|
summary: Handling of references and definitions with asciidoctor
|