cuke_modeler 3.18.0 → 3.19.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7ce5182bc247dd91ecfc20e43a317871507326558424d0637ab1035b9b7661fe
4
- data.tar.gz: 04b7b4ca30fdfc6fa76e2251179d0b10eb6a7032ba6420e88c345491367f6590
3
+ metadata.gz: 215d7b396a27b9dec6e5ce4bad0692446e754fd88021f85b570605f33854a324
4
+ data.tar.gz: 748e499b4bfe721cc8953d5e733652222b7fb019fd0ac232fb85621eb05c9f1a
5
5
  SHA512:
6
- metadata.gz: f7c314712bb69bd700686c04c92a58abcf7cc1f6bd1bc609caeb0bd51e6444c9932eef6e9f88ee0d827359cdc2c0d2b867182d609cf5c8eb9727436cebbe50f6
7
- data.tar.gz: 3615b14eabb2e9117a37c805957425d7814a69cc1e0e72398608e2a5bd1c101f55f4bbf75cfc3432c9f4687511f36d42096b76bfd020dfd9b461d00768a21b63
6
+ metadata.gz: aa017464c7b23bfffc33a1e37c92c8823e0a5fd42c2505e251c36f9d092e444ff04d61457957d56a2a197f56030d5de0e73a4071226fc38e2e801ffd646bd2fd
7
+ data.tar.gz: 2c5a264af86979e6250d4763e5572e93a2136855f1c3c3572019d18374e7dfd7bf37669f814667c4c308e98553e2bb2287bf6aadddd9a04d98e59fe155b716e8
data/CHANGELOG.md CHANGED
@@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
 
9
9
  Nothing yet...
10
10
 
11
+ ## [3.19.0] - 2023-1-22
12
+
13
+ ### Added
14
+ - Support added for more versions of the `cucumber-gherkin` gem
15
+ - 26.x
16
+
11
17
  ## [3.18.0] - 2022-11-16
12
18
 
13
19
  ### Added
@@ -436,7 +442,8 @@ Nothing yet...
436
442
  - Initial release
437
443
 
438
444
 
439
- [Unreleased]: https://github.com/enkessler/cuke_modeler/compare/v3.18.0...HEAD
445
+ [Unreleased]: https://github.com/enkessler/cuke_modeler/compare/v3.19.0...HEAD
446
+ [3.19.0]: https://github.com/enkessler/cuke_modeler/compare/v3.18.0...v3.19.0
440
447
  [3.18.0]: https://github.com/enkessler/cuke_modeler/compare/v3.17.0...v3.18.0
441
448
  [3.17.0]: https://github.com/enkessler/cuke_modeler/compare/v3.16.0...v3.17.0
442
449
  [3.16.0]: https://github.com/enkessler/cuke_modeler/compare/v3.15.0...v3.16.0
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014-2022 Eric Kessler, et al
1
+ Copyright (c) 2014-2023 Eric Kessler, et al
2
2
 
3
3
  MIT License
4
4
 
data/cuke_modeler.gemspec CHANGED
@@ -18,11 +18,12 @@ Gem::Specification.new do |spec|
18
18
  spec.license = 'MIT'
19
19
 
20
20
  spec.metadata = {
21
- 'bug_tracker_uri' => 'https://github.com/enkessler/cuke_modeler/issues',
22
- 'changelog_uri' => 'https://github.com/enkessler/cuke_modeler/blob/master/CHANGELOG.md',
23
- 'documentation_uri' => 'https://www.rubydoc.info/gems/cuke_modeler',
24
- 'homepage_uri' => 'https://github.com/enkessler/cuke_modeler',
25
- 'source_code_uri' => 'https://github.com/enkessler/cuke_modeler'
21
+ 'bug_tracker_uri' => 'https://github.com/enkessler/cuke_modeler/issues',
22
+ 'changelog_uri' => 'https://github.com/enkessler/cuke_modeler/blob/master/CHANGELOG.md',
23
+ 'documentation_uri' => 'https://www.rubydoc.info/gems/cuke_modeler',
24
+ 'homepage_uri' => 'https://github.com/enkessler/cuke_modeler',
25
+ 'source_code_uri' => 'https://github.com/enkessler/cuke_modeler',
26
+ 'rubygems_mfa_required' => 'true'
26
27
  }
27
28
 
28
29
  # Specify which files should be added to the gem when it is released.
@@ -36,7 +37,7 @@ Gem::Specification.new do |spec|
36
37
 
37
38
  spec.required_ruby_version = '>= 2.3', '< 4.0'
38
39
 
39
- spec.add_runtime_dependency 'cucumber-gherkin', '< 26.0'
40
+ spec.add_runtime_dependency 'cucumber-gherkin', '< 27.0'
40
41
 
41
42
  spec.add_development_dependency 'bundler', '< 3.0'
42
43
  spec.add_development_dependency 'childprocess', '< 5.0'
@@ -46,9 +47,8 @@ Gem::Specification.new do |spec|
46
47
  spec.add_development_dependency 'rainbow', '< 4.0.0'
47
48
  spec.add_development_dependency 'rake', '< 14.0.0'
48
49
  spec.add_development_dependency 'rspec', '~> 3.0'
49
- # RuboCop drops Ruby 2.3 support after this version and we need to maintain Ruby 2.3 compatibility when writing code
50
- # for this gem
51
- spec.add_development_dependency 'rubocop', '< 0.82.0'
50
+ # Running recent RuboCop versions requires a recent version of Ruby but it can still lint against Ruby 2.3 styles
51
+ spec.add_development_dependency 'rubocop', '< 2.0'
52
52
  spec.add_development_dependency 'simplecov', '< 1.0'
53
53
  spec.add_development_dependency 'simplecov-lcov', '< 1.0'
54
54
  spec.add_development_dependency 'test-unit', '< 4.0.0'
@@ -327,14 +327,23 @@ module CukeModeler
327
327
 
328
328
  def clear_child_elements(ast, child_paths)
329
329
  # rubocop:disable Security/Eval - This is not blind data
330
+ # rubocop:disable Style/DocumentDynamicEvalDefinition - Nice idea but bad detection ability
330
331
  child_paths.each do |traversal_path|
331
- # Wipe the value if it's there but don't add any attributes to the object if it didn't already have them
332
- if eval("ast['cuke_modeler_parsing_data'].#{traversal_path.join('.')}", binding, __FILE__, __LINE__)
333
- property_path = traversal_path[0..-2].join('.')
334
- eval("ast['cuke_modeler_parsing_data']#{property_path.empty? ? '' : '.' + property_path}.instance_variable_set(\"@#{traversal_path.last}\", nil)", binding, __FILE__, __LINE__) # rubocop:disable Layout/LineLength
335
- end
332
+ # Don't add any properties to the object if it didn't already have them
333
+ # e.g. ast['cuke_modeler_parsing_data'].background.steps
334
+ # e.g. ast['cuke_modeler_parsing_data'].data_table
335
+ next unless eval("ast['cuke_modeler_parsing_data'].#{traversal_path.join('.')}", binding, __FILE__, __LINE__)
336
+
337
+
338
+ # Determine the path to the property and wipe it
339
+ property_path = traversal_path[0..-2].join('.')
340
+ property_path = property_path.empty? ? '' : ".#{property_path}"
341
+
342
+ # e.g. ast['cuke_modeler_parsing_data'].scenario.instance_variable_set("@steps", nil)
343
+ # e.g. ast['cuke_modeler_parsing_data'].instance_variable_set("@tags", nil)
344
+ eval("ast['cuke_modeler_parsing_data']#{property_path}.instance_variable_set(\"@#{traversal_path.last}\", nil)", binding, __FILE__, __LINE__) # rubocop:disable Layout/LineLength
336
345
  end
337
- # rubocop:enable Security/Eval
346
+ # rubocop:enable Security/Eval, Style/DocumentDynamicEvalDefinition
338
347
  end
339
348
 
340
349
  def test_has_examples?(ast_node)
@@ -0,0 +1,13 @@
1
+ require_relative 'gherkin_20_adapter'
2
+
3
+
4
+ module CukeModeler
5
+
6
+ # NOT A PART OF THE PUBLIC API
7
+ # An adapter that can convert the output of version 26.x of the *cucumber-gherkin* gem into input that is consumable
8
+ # by this gem.
9
+
10
+ class Gherkin26Adapter < Gherkin20Adapter
11
+
12
+ end
13
+ end
@@ -52,7 +52,7 @@ module CukeModeler
52
52
  end
53
53
 
54
54
  def trim_leading_spaces(description)
55
- non_blank_lines = description.select { |line| line =~ /\S/ }
55
+ non_blank_lines = description.grep(/\S/)
56
56
 
57
57
  fewest_spaces = non_blank_lines.collect { |line| line[/^\s*/].length }.min || 0
58
58
 
@@ -34,8 +34,6 @@ module CukeModeler
34
34
  private
35
35
 
36
36
 
37
- # It's only considered complex because of how deeply nested cells are in the tree. It's not REALLY complex.
38
- # rubocop:disable Metrics/AbcSize
39
37
  def parse_source(source_text)
40
38
  base_file_string = "# language: #{Parsing.dialect}
41
39
  #{dialect_feature_keyword}: Fake feature to parse
@@ -47,7 +45,6 @@ module CukeModeler
47
45
 
48
46
  parsed_file['feature']['elements'].first['steps'].first['table']['rows'].first['cells'].first
49
47
  end
50
- # rubocop:enable Metrics/AbcSize
51
48
 
52
49
  end
53
50
 
@@ -75,12 +75,10 @@ module CukeModeler
75
75
  end
76
76
 
77
77
  def process_feature_file(file_path)
78
- source_text = IO.read(file_path)
79
-
78
+ source_text = File.read(file_path)
80
79
  feature_file_data = Parsing.parse_text(source_text, file_path)
81
- feature_file_data = feature_file_data.merge({ 'path' => file_path })
82
80
 
83
- feature_file_data
81
+ feature_file_data.merge({ 'path' => file_path })
84
82
  end
85
83
 
86
84
  end
@@ -55,7 +55,7 @@ module CukeModeler
55
55
  end
56
56
 
57
57
  def content_output_string
58
- content.nil? || content.empty? ? '' : content.gsub('"""', '\"\"\"') + "\n"
58
+ content.nil? || content.empty? ? '' : "#{content.gsub('"""', '\"\"\"')}\n"
59
59
  end
60
60
 
61
61
  end
@@ -44,7 +44,7 @@ module CukeModeler
44
44
  # A quick 'deep clone' so that the input isn't modified
45
45
  row = Marshal.load(Marshal.dump(row))
46
46
 
47
- values = if row.is_a?(Array)
47
+ values = if row.is_a?(Array) # rubocop:disable Style/CaseLikeIf # False positive
48
48
  row
49
49
  elsif row.is_a?(Hash)
50
50
  # There is no guarantee that the user built up their hash with the keys in the same order as
@@ -64,7 +64,7 @@ module CukeModeler
64
64
  def remove_row(row_removed)
65
65
  return if argument_rows.empty?
66
66
 
67
- values = if row_removed.is_a?(Array)
67
+ values = if row_removed.is_a?(Array) # rubocop:disable Style/CaseLikeIf # False positive
68
68
  row_removed
69
69
  elsif row_removed.is_a?(Hash)
70
70
  # There is no guarantee that the user built up their hash with the keys in the same order as
@@ -99,7 +99,7 @@ module CukeModeler
99
99
  end
100
100
 
101
101
  # Building strings just isn't pretty
102
- # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
102
+ # rubocop:disable Metrics/AbcSize
103
103
 
104
104
  # Returns a string representation of this model. For an example model,
105
105
  # this will be Gherkin text that is equivalent to the example being modeled.
@@ -116,7 +116,7 @@ module CukeModeler
116
116
  text
117
117
  end
118
118
 
119
- # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity
119
+ # rubocop:enable Metrics/AbcSize
120
120
 
121
121
 
122
122
  private
@@ -52,12 +52,10 @@ module CukeModeler
52
52
 
53
53
 
54
54
  def process_feature_file(file_path)
55
- source_text = IO.read(file_path)
56
-
55
+ source_text = File.read(file_path)
57
56
  feature_file_data = Parsing.parse_text(source_text, file_path)
58
- feature_file_data = feature_file_data.merge({ 'path' => file_path })
59
57
 
60
- feature_file_data
58
+ feature_file_data.merge({ 'path' => file_path })
61
59
  end
62
60
 
63
61
  end
@@ -16,12 +16,17 @@ module CukeModeler
16
16
  # This should be overridden by a child class
17
17
  end
18
18
 
19
+ # It's a lazy implementation but it's mandatory for the class to define this method
20
+ # rubocop:disable Lint/UselessMethodDefinition
21
+
19
22
  # Returns a string representation of this model.
20
23
  def to_s
21
24
  # This should be overridden by a child class
22
25
  super
23
26
  end
24
27
 
28
+ # rubocop:enable Lint/UselessMethodDefinition
29
+
25
30
  # Returns the model objects that belong to this model.
26
31
  def children
27
32
  []
@@ -47,7 +47,7 @@ module CukeModeler
47
47
  end
48
48
 
49
49
  # Building strings just isn't pretty
50
- # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
50
+ # rubocop:disable Metrics/AbcSize
51
51
 
52
52
  # Returns a string representation of this model. For an outline model,
53
53
  # this will be Gherkin text that is equivalent to the outline being modeled.
@@ -64,7 +64,7 @@ module CukeModeler
64
64
  text
65
65
  end
66
66
 
67
- # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity
67
+ # rubocop:enable Metrics/AbcSize
68
68
 
69
69
 
70
70
  private
@@ -60,9 +60,6 @@ module CukeModeler
60
60
  models
61
61
  end
62
62
 
63
- # Building strings just isn't pretty
64
- # rubocop:disable Metrics/AbcSize
65
-
66
63
  # Returns a string representation of this model. For a rule model,
67
64
  # this will be Gherkin text that is equivalent to the rule being modeled.
68
65
  def to_s
@@ -76,7 +73,6 @@ module CukeModeler
76
73
 
77
74
  text
78
75
  end
79
- # rubocop:enable Metrics/AbcSize
80
76
 
81
77
 
82
78
  private
@@ -9,7 +9,7 @@ require 'gherkin'
9
9
  # an 'adapter' appropriate to the version of the *cucumber-gherkin* gem that has been activated.
10
10
  gherkin_version = Gem.loaded_specs['cucumber-gherkin'].version.version
11
11
  gherkin_major_version = gherkin_version.match(/^(\d+)\./)[1].to_i
12
- supported_gherkin_versions = (9..25)
12
+ supported_gherkin_versions = (9..26)
13
13
 
14
14
  raise("Unknown Gherkin version: '#{gherkin_version}'") unless supported_gherkin_versions.include?(gherkin_major_version)
15
15
 
@@ -63,7 +63,7 @@ module CukeModeler
63
63
  # inside of it, so I'm leaving this here in case it changes again
64
64
  # rubocop:disable Lint/DuplicateMethods
65
65
  case gherkin_major_version
66
- when 20, 21, 22, 23, 24, 25
66
+ when 20, 21, 22, 23, 24, 25, 26
67
67
  # TODO: make these methods private?
68
68
  # NOT A PART OF THE PUBLIC API
69
69
  # The method to use for parsing Gherkin text
@@ -1,4 +1,4 @@
1
1
  module CukeModeler
2
2
  # The gem version
3
- VERSION = '3.18.0'.freeze
3
+ VERSION = '3.19.0'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cuke_modeler
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.18.0
4
+ version: 3.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Kessler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-16 00:00:00.000000000 Z
11
+ date: 2023-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber-gherkin
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "<"
18
18
  - !ruby/object:Gem::Version
19
- version: '26.0'
19
+ version: '27.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "<"
25
25
  - !ruby/object:Gem::Version
26
- version: '26.0'
26
+ version: '27.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -134,14 +134,14 @@ dependencies:
134
134
  requirements:
135
135
  - - "<"
136
136
  - !ruby/object:Gem::Version
137
- version: 0.82.0
137
+ version: '2.0'
138
138
  type: :development
139
139
  prerelease: false
140
140
  version_requirements: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - "<"
143
143
  - !ruby/object:Gem::Version
144
- version: 0.82.0
144
+ version: '2.0'
145
145
  - !ruby/object:Gem::Dependency
146
146
  name: simplecov
147
147
  requirement: !ruby/object:Gem::Requirement
@@ -232,6 +232,7 @@ files:
232
232
  - lib/cuke_modeler/adapters/gherkin_23_adapter.rb
233
233
  - lib/cuke_modeler/adapters/gherkin_24_adapter.rb
234
234
  - lib/cuke_modeler/adapters/gherkin_25_adapter.rb
235
+ - lib/cuke_modeler/adapters/gherkin_26_adapter.rb
235
236
  - lib/cuke_modeler/adapters/gherkin_9_adapter.rb
236
237
  - lib/cuke_modeler/adapters/gherkin_base_adapter.rb
237
238
  - lib/cuke_modeler/containing.rb
@@ -303,6 +304,7 @@ metadata:
303
304
  documentation_uri: https://www.rubydoc.info/gems/cuke_modeler
304
305
  homepage_uri: https://github.com/enkessler/cuke_modeler
305
306
  source_code_uri: https://github.com/enkessler/cuke_modeler
307
+ rubygems_mfa_required: 'true'
306
308
  post_install_message:
307
309
  rdoc_options: []
308
310
  require_paths:
@@ -321,7 +323,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
321
323
  - !ruby/object:Gem::Version
322
324
  version: '0'
323
325
  requirements: []
324
- rubygems_version: 3.2.32
326
+ rubygems_version: 3.3.7
325
327
  signing_key:
326
328
  specification_version: 4
327
329
  summary: A gem providing functionality to model Gherkin based test suites.