defmastership-core 1.5.0 → 1.5.2

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: 2cf64cc0680411a81afd61f49488ffd98981f02f69b9b5298c3bbe4f96ee3cd2
4
- data.tar.gz: 63662e69ecacc62a93d13b0a78e2bd92711f585d7e5a6f8d911feac3a32d02e2
3
+ metadata.gz: 6b95f1ad54d625a1441f1ca0220e944559232bf9f477b56e9a14c32469622928
4
+ data.tar.gz: 060d870d464c07cc9ae12702136d66292e39006af3c617c7bb8f42b4c7e1dc5c
5
5
  SHA512:
6
- metadata.gz: 7320f2beec55cdab8dc55db5f57c3ce8be1fed5f6826cfe43fe2b81bda905057812256ed8a011f69ffccd32f78e652620dadb3beeb8982a43f182fde3eca65e2
7
- data.tar.gz: 5cf045b72a06d4a9b4fe996e79a9aa3dc70d3a1e75d6021e5db253b98f2a3f5a330de324229a276b4ea473bc3043b3d87c2fb72136dae8bc004a260e2d112ea4
6
+ metadata.gz: 84bfd7c8d7b5ce2e15640fd450e0b8375d73608fc8b09e0b0e7cd989d1f4f10eb4d2d20cdefe9d93b1822cd3b71fc1fe63f123e489d65e3d4e281a1dc2bfeecf
7
+ data.tar.gz: 3fadd0ba25f82931f55198c2c0d9c1821e156352e0597ce3e3ca19857bc1ca61bbca7e119f95ea4b95574a485b7b1b455c8f7227731aada5816e068f8152423b
data/.gitlab-ci.yml CHANGED
@@ -28,16 +28,6 @@ yard documentation:
28
28
  paths:
29
29
  - doc
30
30
 
31
- unit tests ruby3.0:
32
- image: ruby:3.0
33
- script:
34
- - bundle exec rake test:spec
35
-
36
- unit tests ruby3.1:
37
- image: ruby:3.1
38
- script:
39
- - bundle exec rake test:spec
40
-
41
31
  unit tests ruby3.2:
42
32
  image: ruby:3.2
43
33
  script:
data/Gemfile CHANGED
@@ -10,10 +10,6 @@ ruby RUBY_VERSION
10
10
  group :development do
11
11
  # needed by yard to render documentation
12
12
  gem 'asciidoctor', '~> 2.0'
13
- # cucumber steps for command line tests
14
- gem 'aruba', '~> 2.3'
15
- # bdd
16
- gem 'cucumber', '~> 9.2'
17
13
  # code duplication
18
14
  gem 'flay', '~> 2.13'
19
15
  # automatic test run
@@ -21,45 +17,37 @@ group :development do
21
17
  # automatic update invocation
22
18
  gem 'guard-bundler', '~> 3.0'
23
19
  # automatic style check
24
- gem 'guard-reek', '~> 1.2'
20
+ gem 'guard-reek', '~> 1.2'
25
21
  # automatic tdd
26
22
  gem 'guard-rspec', '~> 4.7'
27
23
  # automatic style check
28
24
  gem 'guard-rubocop', '~> 1.5'
29
-
30
- # # mutation testing
31
- # plan = 'oss'
32
- # key = '7oac4dMz95cTUuFPtGDfTDSQep6ZhdGW'
33
- # source "https://#{plan}:#{key}@gem.mutant.dev" do
34
- # # license needed
35
- # gem 'mutant-license', '~> 0'
36
- # end
37
- # # mutation testing
38
- # gem 'mutant-rspec', '~> 0'
25
+ # mutation testing
26
+ gem 'mutant-rspec', '~> 0.13'
39
27
  # to parse and execute Rakefile
40
- gem 'rake', '~> 13.2'
28
+ gem 'rake', '~> 13.3'
41
29
  # needed by yard to render documentation
42
- gem 'rdoc', '~> 6.12'
30
+ gem 'rdoc', '~> 6.14'
43
31
  # tdd
44
32
  gem 'rspec', '~> 3.13'
45
33
  # code needs to be clean
46
- gem 'rubocop', '1.72'
34
+ gem 'rubocop', '1.80'
47
35
  # code needs to be clean
48
- gem 'rubocop-performance', '~> 1.23'
36
+ gem 'rubocop-performance', '~> 1.25'
49
37
  # test code needs to be clean
50
- gem 'rubocop-rspec', '~> 3.4'
38
+ gem 'rubocop-rspec', '~> 3.6'
51
39
  # Rakefiles need to be clean
52
- gem 'rubocop-rake', '~> 0.6'
53
- # detect selling code
54
- gem 'reek', '~> 6.4'
40
+ gem 'rubocop-rake', '~> 0.7'
41
+ # detect smelling code
42
+ gem 'reek', '~> 6.5'
55
43
  # my code needs to be critiqued
56
- gem 'rubycritic', '~> 4.9'
44
+ gem 'rubycritic', '~> 4.10'
57
45
  # Doc need to be clean
58
- gem 'rubocop-yard', '~> 0.10'
46
+ gem 'rubocop-yard', '~> 1.0'
59
47
  # What is tdd without code coverage ?
60
- gem 'simplecov', '~> 0.22'
48
+ gem 'simplecov', '~> 0.22'
61
49
  # to document code
62
- gem 'yard', '~> 0.9'
50
+ gem 'yard', '~> 0.9'
63
51
  end
64
52
 
65
53
  group :debugging do
data/config/mutant.yml CHANGED
@@ -8,7 +8,8 @@ integration:
8
8
  - --options=config/rspec
9
9
  - spec
10
10
  requires:
11
- - defmastership
11
+ - defmastership/core/constants
12
+ - defmastership/core/parsing_state
12
13
  matcher:
13
14
  subjects:
14
15
  - 'Defmastership::Core*'
@@ -48,11 +48,15 @@ module Defmastership
48
48
  REFERENCE = an_id('reference').freeze
49
49
  public_constant :REFERENCE
50
50
 
51
+ # [Regexp] match reference with optional version and checksum
52
+ REF_WITH_OPT_VER_CHK = "\\s*#{REFERENCE}#{DEF_VERSION_AND_CHECKSUM}\\s*".freeze
53
+ public_constant :REF_WITH_OPT_VER_CHK
54
+
51
55
  # [Regexp] match defintion summary
52
56
  DEF_SUMMARY = <<~'SUM'
53
57
  \s*
54
58
  (,\s*
55
- ((?<summary>[^\s,\[\]][^,\[\]]*?)|("\s*(?<summary>[^""]*?)\s*"))
59
+ (("\s*(?<summary>[^""]*?)\s*")|(?<summary>[^\s,\[\]][^,\[\]]*?))
56
60
  \s*)?
57
61
  SUM
58
62
  public_constant :DEF_SUMMARY
@@ -79,10 +83,7 @@ module Defmastership
79
83
  #{DEF_KEYWORD}
80
84
  #{DEF_TYPE}
81
85
  ,
82
- \\s*
83
- #{REFERENCE}
84
- #{DEF_VERSION_AND_CHECKSUM}
85
- \\s*
86
+ #{REF_WITH_OPT_VER_CHK}
86
87
  #{DEF_SUMMARY}
87
88
  #{DEF_LABELS}
88
89
  \\s*
@@ -124,7 +125,7 @@ module Defmastership
124
125
  public_constant :IREF_DEF_AFT
125
126
  # [Regexp] match an internal cross reference
126
127
  IREF_DEF = Regexp.new(
127
- "#{IREF_DEF_BEF}#{an_id('intref')}#{IREF_DEF_AFT}",
128
+ "#{IREF_DEF_BEF}#{an_id('intref')}#{DEF_VERSION_AND_CHECKSUM}#{IREF_DEF_AFT}",
128
129
  Regexp::EXTENDED
129
130
  )
130
131
  public_constant :IREF_DEF
@@ -5,7 +5,7 @@ module Defmastership
5
5
  # Common to defmastership and asciidoctor-defmastership
6
6
  module Core
7
7
  # [String] Gem version
8
- VERSION = '1.5.0'
8
+ VERSION = '1.5.2'
9
9
  public_constant :VERSION
10
10
  end
11
11
  end
data/spec/spec_helper.rb CHANGED
@@ -13,9 +13,8 @@ SimpleCov.start do
13
13
  add_filter 'vendor'
14
14
  add_filter 'set_join_hack'
15
15
 
16
- minimum_coverage 100
17
-
18
16
  enable_coverage :branch
17
+ minimum_coverage line: 100, branch: 100
19
18
  end
20
19
 
21
20
  RSpec::Matchers.define(:matchdata_including) do |h|
@@ -132,7 +132,8 @@ RSpec.describe(Defmastership::Core::DMRegexp) do
132
132
  ',[label1]]',
133
133
  ', a nice summary,[label1]]',
134
134
  ', a nice summary]',
135
- ', "a nice summary, with comma"]'
135
+ ', "a nice summary, with comma"]',
136
+ ', "a nice summary with quotation mark"]'
136
137
  ].each do |def_end|
137
138
  it { is_expected.to(match(def_end)) }
138
139
  end
@@ -142,6 +143,7 @@ RSpec.describe(Defmastership::Core::DMRegexp) do
142
143
  it { expect(regexp.match(', a summary ]')[:summary]).to(eq('a summary')) }
143
144
  it { expect(regexp.match(', a summary ]')[:labels]).to(be_nil) }
144
145
  it { expect(regexp.match(', " a, comma " ]')[:summary]).to(eq('a, comma')) }
146
+ it { expect(regexp.match(', " no comma " ]')[:summary]).to(eq('no comma')) }
145
147
  end
146
148
 
147
149
  context 'when invalid definitions end' do
@@ -215,6 +217,39 @@ RSpec.describe(Defmastership::Core::DMRegexp) do
215
217
  end
216
218
  end
217
219
 
220
+ describe 'REF_WITH_OPT_VER_CHK' do
221
+ subject(:regexp) { Regexp.new("^#{described_class::REF_WITH_OPT_VER_CHK}$", Regexp::EXTENDED) }
222
+
223
+ [
224
+ 'abc',
225
+ '_abc_efg_',
226
+ '-abc-efg-',
227
+ 'REFERENCE-0001',
228
+ 'REFERENCE-0001(a)',
229
+ 'REFERENCE-0001(~1234abcd)',
230
+ 'REFERENCE-0001(a~1234abcd)'
231
+ ].each do |line|
232
+ it { is_expected.to(match(line)) }
233
+ end
234
+
235
+ it { expect(regexp.match('the_ref')[:reference]).to(eq('the_ref')) }
236
+ it { expect(regexp.match('the_ref')[:version_and_checksum]).to(be_nil) }
237
+ it { expect(regexp.match('the_ref')[:explicit_version]).to(be_nil) }
238
+ it { expect(regexp.match('the_ref')[:explicit_checksum]).to(be_nil) }
239
+ it { expect(regexp.match('the_ref(a)')[:reference]).to(eq('the_ref')) }
240
+ it { expect(regexp.match('the_ref(a)')[:version_and_checksum]).to(eq('(a)')) }
241
+ it { expect(regexp.match('the_ref(a)')[:explicit_version]).to(eq('a')) }
242
+ it { expect(regexp.match('the_ref(a)')[:explicit_checksum]).to(be_nil) }
243
+ it { expect(regexp.match('the_ref(~abcd)')[:reference]).to(eq('the_ref')) }
244
+ it { expect(regexp.match('the_ref(~abcd)')[:version_and_checksum]).to(eq('(~abcd)')) }
245
+ it { expect(regexp.match('the_ref(~abcd)')[:explicit_version]).to(be_nil) }
246
+ it { expect(regexp.match('the_ref(~abcd)')[:explicit_checksum]).to(eq('~abcd')) }
247
+ it { expect(regexp.match('the_ref(z~abcd)')[:reference]).to(eq('the_ref')) }
248
+ it { expect(regexp.match('the_ref(z~abcd)')[:version_and_checksum]).to(eq('(z~abcd)')) }
249
+ it { expect(regexp.match('the_ref(z~abcd)')[:explicit_version]).to(eq('z')) }
250
+ it { expect(regexp.match('the_ref(z~abcd)')[:explicit_checksum]).to(eq('~abcd')) }
251
+ end
252
+
218
253
  describe 'DEF_SUMMARY' do
219
254
  subject(:regexp) { Regexp.new("^#{described_class::DEF_SUMMARY}$", Regexp::EXTENDED) }
220
255
 
@@ -418,7 +453,7 @@ RSpec.describe(Defmastership::Core::DMRegexp) do
418
453
  describe 'EREF_DEF' do
419
454
  subject(:regexp) { described_class::EREF_DEF }
420
455
 
421
- let(:one_match) { regexp.match('defs:eref[abcdef, [ABC, EDF]]') }
456
+ let(:one_match) { regexp.match('defs:eref[abcdef, [ABC, EDF(a~1234abcd) ]]') }
422
457
 
423
458
  context 'with valid external ref' do
424
459
  [
@@ -428,13 +463,14 @@ RSpec.describe(Defmastership::Core::DMRegexp) do
428
463
  'defs:eref[abcdef,[ABC,EDF]]',
429
464
  'defs:eref[abcdef, [ABC, EDF] ]',
430
465
  'defs:eref[abcdef, [ABC, EDF ]]',
431
- 'defs:eref[abcdef, [ABC]]'
466
+ 'defs:eref[abcdef, [ABC]]',
467
+ 'defs:eref[abcdef, [ABC(a~1234abcd)]]'
432
468
  ].each do |line|
433
469
  it { is_expected.to(match(line)) }
434
470
  end
435
471
 
436
472
  it { expect(one_match[:reference]).to(eq('abcdef')) }
437
- it { expect(one_match[:extrefs]).to(eq('ABC, EDF')) }
473
+ it { expect(one_match[:extrefs]).to(eq('ABC, EDF(a~1234abcd)')) }
438
474
  end
439
475
 
440
476
  context 'with invalid external ref' do
@@ -504,8 +540,17 @@ RSpec.describe(Defmastership::Core::DMRegexp) do
504
540
  it { is_expected.to(match(' defs:iref[ bla_bla]')) }
505
541
  it { is_expected.to(match(' defs:iref[ bla_bla ]')) }
506
542
  it { is_expected.to(match(' defs:iref[ bla_bla ] ')) }
543
+ it { is_expected.to(match(' defs:iref[ bla_bla(c~abcd1234) ] ')) }
507
544
 
508
545
  it { expect(regexp.match(' defs:iref[ bla_bla ] ')[:intref]).to(eq('bla_bla')) }
546
+ it { expect(regexp.match(' defs:iref[ bla_bla ] ')[:version_and_checksum]).to(be_nil) }
547
+ it { expect(regexp.match(' defs:iref[ bla_bla ] ')[:explicit_version]).to(be_nil) }
548
+ it { expect(regexp.match(' defs:iref[ bla_bla ] ')[:explicit_checksum]).to(be_nil) }
549
+
550
+ it { expect(regexp.match('defs:iref[bla(c~abcd1234)]')[:intref]).to(eq('bla')) }
551
+ it { expect(regexp.match('defs:iref[bla(c~abcd1234)]')[:version_and_checksum]).to(eq('(c~abcd1234)')) }
552
+ it { expect(regexp.match('defs:iref[bla(c~abcd1234)]')[:explicit_version]).to(eq('c')) }
553
+ it { expect(regexp.match('defs:iref[bla(c~abcd1234)]')[:explicit_checksum]).to(eq('~abcd1234')) }
509
554
  end
510
555
 
511
556
  context 'with invalid IREF_DEF' do
metadata CHANGED
@@ -1,16 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: defmastership-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jérôme Arbez-Gindre
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-02-15 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies: []
13
- description:
14
12
  email: jeromearbezgindre@gmail.com
15
13
  executables: []
16
14
  extensions: []
@@ -45,7 +43,6 @@ licenses:
45
43
  - MIT
46
44
  metadata:
47
45
  rubygems_mfa_required: 'true'
48
- post_install_message:
49
46
  rdoc_options: []
50
47
  require_paths:
51
48
  - lib
@@ -61,8 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
61
58
  - !ruby/object:Gem::Version
62
59
  version: '0'
63
60
  requirements: []
64
- rubygems_version: 3.5.22
65
- signing_key:
61
+ rubygems_version: 3.7.1
66
62
  specification_version: 4
67
63
  summary: Handling of references and definitions with asciidoctor - common code
68
64
  test_files: []