cucumber 10.1.0 → 10.1.1

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: 293ae4064952767ef9757ab38d7254572343e7db49ce570a04457107b5e4465d
4
- data.tar.gz: 11055cae2a8a1749db0c7ec2eada2f48738f437ad69ceeafb65562cdbd35c2ce
3
+ metadata.gz: d0ba9798f9d27614a636414022be62327aa2e867109ec98c35bb5d0c81e99bad
4
+ data.tar.gz: bcfae06fccac44f122583a8f48a96ef08cd22ab3e1120202142adde143ba31ab
5
5
  SHA512:
6
- metadata.gz: 42cdf6c218130aa6fa707adf02f9b61a4154ae8fb10a2ef8cd295d593bc8d3d361ab9192c4cb9594e14b7174a6f685b809c25cd9e0a69670d064880c27143774
7
- data.tar.gz: 70377b9bbfb753f21f19aca5bddb2e3048389ba5f96d74f576f6813fb6004cc92730c81e37bd76af64aee3b073dbd0048116f01e5a4fa7931e595e2efd3a4683
6
+ metadata.gz: 24aca341a620f6bda83917c9b4138334b30e50eb3ec0148d7e5cfc430f1fd739a3c54a9f1b0253e19654a842b4230fe3338fd6124352a7a09f802e145d7e6ff8
7
+ data.tar.gz: 78ea1f1fec7f2390a5544d8090cdf9fe6225af2e5130a1802095e49faeaee420f8252930014bc8b593116fdc2fcaa7ab507b1f95e6462f1e7ab4e1d65570f78e
data/README.md CHANGED
@@ -49,7 +49,6 @@ Later in this document, bundler is considered being used so all commands are usi
49
49
  - Ruby 3.3
50
50
  - Ruby 3.2
51
51
  - Ruby 3.1
52
- - Ruby 3.0
53
52
  - TruffleRuby 24.0.0+
54
53
  - JRuby 9.4+ (with [some limitations](https://github.com/cucumber/cucumber-ruby/blob/main/docs/jruby-limitations.md))
55
54
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 10.1.0
1
+ 10.1.1
@@ -8,11 +8,9 @@ require 'cucumber'
8
8
 
9
9
  module Cucumber
10
10
  module Cli
11
- class YmlLoadError < StandardError; end
12
-
13
- class ProfilesNotDefinedError < YmlLoadError; end
14
-
15
- class ProfileNotFound < StandardError; end
11
+ YmlLoadError = Class.new(StandardError)
12
+ ProfilesNotDefinedError = Class.new(YmlLoadError)
13
+ ProfileNotFound = Class.new(StandardError)
16
14
 
17
15
  class Configuration
18
16
  include Constantize
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'yaml'
4
+ require 'erb'
4
5
 
5
6
  module Cucumber
6
7
  module Cli
@@ -11,12 +12,12 @@ module Cucumber
11
12
 
12
13
  def args_from(profile)
13
14
  unless cucumber_yml.key?(profile)
14
- raise(ProfileNotFound, <<~END_OF_ERROR)
15
+ raise(ProfileNotFound, <<~ERROR_MESSAGE)
15
16
  Could not find profile: '#{profile}'
16
17
 
17
18
  Defined profiles in cucumber.yml:
18
19
  * #{cucumber_yml.keys.sort.join("\n * ")}
19
- END_OF_ERROR
20
+ ERROR_MESSAGE
20
21
  end
21
22
 
22
23
  args_from_yml = cucumber_yml[profile] || ''
@@ -56,9 +57,12 @@ module Cucumber
56
57
  process_configuration_file_with_erb
57
58
  load_configuration
58
59
 
59
- if @cucumber_yml.nil? || !@cucumber_yml.is_a?(Hash)
60
- raise(YmlLoadError, 'cucumber.yml was found, but was blank or malformed. ' \
61
- "Please refer to cucumber's documentation on correct profile usage.\n")
60
+ unless @cucumber_yml.is_a?(Hash)
61
+ raise(YmlLoadError, <<~ERROR_MESSAGE)
62
+ cucumber.yml was found, but was blank or malformed.
63
+ Please refer to cucumber's documentation on correct profile usage.
64
+ Type 'cucumber --help' for usage.
65
+ ERROR_MESSAGE
62
66
  end
63
67
 
64
68
  @cucumber_yml
@@ -67,32 +71,26 @@ module Cucumber
67
71
  def ensure_configuration_file_exists
68
72
  return if cucumber_yml_defined?
69
73
 
70
- raise(ProfilesNotDefinedError, "cucumber.yml was not found. Current directory is #{Dir.pwd}." \
71
- "Please refer to cucumber's documentation on defining profiles in cucumber.yml. You must define" \
72
- "a 'default' profile to use the cucumber command without any arguments.\nType 'cucumber --help' for usage.\n")
74
+ raise(ProfilesNotDefinedError, <<~ERROR_MESSAGE)
75
+ cucumber.yml was not found. Current directory is #{Dir.pwd}.
76
+ Please refer to cucumber's documentation on defining profiles in cucumber.yml.
77
+ You must define a 'default' profile to use the cucumber command without any arguments.
78
+ Type 'cucumber --help' for usage.
79
+ ERROR_MESSAGE
73
80
  end
74
81
 
75
82
  def process_configuration_file_with_erb
76
- require 'erb'
77
- begin
78
- @cucumber_erb = ERB.new(IO.read(cucumber_file), trim_mode: '%').result(binding)
79
- rescue StandardError
80
- raise(YmlLoadError, "cucumber.yml was found, but could not be parsed with ERB. Please refer to cucumber's documentation on correct profile usage.\n#{$ERROR_INFO.inspect}")
81
- end
83
+ @cucumber_erb = ERB.new(IO.read(cucumber_file), trim_mode: '%').result(binding)
84
+ rescue StandardError
85
+ raise(YmlLoadError, "cucumber.yml was found, but could not be parsed with ERB. Please refer to cucumber's documentation on correct profile usage.\n#{$ERROR_INFO.inspect}")
82
86
  end
83
87
 
84
88
  def load_configuration
85
- require 'yaml'
86
- begin
87
- @cucumber_yml = YAML.load(@cucumber_erb)
88
- rescue StandardError
89
- raise(YmlLoadError, "cucumber.yml was found, but could not be parsed. Please refer to cucumber's documentation on correct profile usage.\n")
90
- end
89
+ @cucumber_yml = YAML.load(@cucumber_erb)
90
+ rescue StandardError
91
+ raise(YmlLoadError, "cucumber.yml was found, but could not be parsed. Please refer to cucumber's documentation on correct profile usage.")
91
92
  end
92
93
 
93
- # Locates cucumber.yml file. The file can end in .yml or .yaml,
94
- # and be located in the current directory (eg. project root) or
95
- # in a .config/ or config/ subdirectory of the current directory.
96
94
  def cucumber_file
97
95
  @cucumber_file ||= Dir.glob('{,.config/,config/}cucumber{.yml,.yaml}').first
98
96
  end
@@ -38,6 +38,9 @@ module Cucumber
38
38
  end
39
39
 
40
40
  class FindMatch
41
+ attr_reader :step_match_search, :configuration, :test_step
42
+ private :step_match_search, :configuration, :test_step
43
+
41
44
  def initialize(step_match_search, configuration, test_step)
42
45
  @step_match_search = step_match_search
43
46
  @configuration = configuration
@@ -58,9 +61,6 @@ module Cucumber
58
61
 
59
62
  private
60
63
 
61
- attr_reader :step_match_search, :configuration, :test_step
62
- private :step_match_search, :configuration, :test_step
63
-
64
64
  def match
65
65
  matches.first
66
66
  end
@@ -53,20 +53,16 @@ module Cucumber
53
53
  file_name: filename
54
54
  }
55
55
 
56
- if media_type.start_with?('text/')
56
+ if media_type&.start_with?('text/')
57
57
  attachment_data[:content_encoding] = Cucumber::Messages::AttachmentContentEncoding::IDENTITY
58
58
  attachment_data[:body] = src
59
59
  else
60
60
  body = src.respond_to?(:read) ? src.read : src
61
-
62
61
  attachment_data[:content_encoding] = Cucumber::Messages::AttachmentContentEncoding::BASE64
63
62
  attachment_data[:body] = Base64.strict_encode64(body)
64
63
  end
65
64
 
66
- message = Cucumber::Messages::Envelope.new(
67
- attachment: Cucumber::Messages::Attachment.new(**attachment_data)
68
- )
69
-
65
+ message = Cucumber::Messages::Envelope.new(attachment: Cucumber::Messages::Attachment.new(**attachment_data))
70
66
  output_envelope(message)
71
67
  end
72
68
 
@@ -8,8 +8,22 @@ module Cucumber
8
8
  module Formatter
9
9
  class Usage < Progress
10
10
  include Console
11
- class StepDefKey < StepDefinitionLight
11
+ class StepDefKey
12
12
  attr_accessor :mean_duration, :status
13
+ attr_reader :regexp_source, :location
14
+
15
+ def initialize(regexp_source, location)
16
+ @regexp_source = regexp_source
17
+ @location = location
18
+ end
19
+
20
+ def eql?(other)
21
+ regexp_source == other.regexp_source && location == other.location
22
+ end
23
+
24
+ def hash
25
+ regexp_source.hash + 31 * location.to_s.hash
26
+ end
13
27
  end
14
28
 
15
29
  def initialize(config)
@@ -90,12 +90,11 @@ module Cucumber
90
90
  # This is only needed in situations where you want to rename a PDF download e.t.c. - In most situations
91
91
  # you should not need to pass a filename
92
92
  def attach(file, media_type = nil, filename = nil)
93
- return super unless File.file?(file)
94
-
95
- content = File.read(file, mode: 'rb')
96
- media_type = MiniMime.lookup_by_filename(file)&.content_type if media_type.nil?
97
-
98
- super(content, media_type.to_s, filename)
93
+ if File.file?(file)
94
+ media_type = MiniMime.lookup_by_filename(file)&.content_type if media_type.nil?
95
+ file = File.read(file, mode: 'rb')
96
+ end
97
+ super
99
98
  rescue StandardError
100
99
  super
101
100
  end
@@ -4,7 +4,6 @@ require 'cucumber/cucumber_expressions/parameter_type_registry'
4
4
  require 'cucumber/cucumber_expressions/cucumber_expression'
5
5
  require 'cucumber/cucumber_expressions/regular_expression'
6
6
  require 'cucumber/cucumber_expressions/cucumber_expression_generator'
7
- require 'cucumber/deprecate'
8
7
  require 'cucumber/glue/dsl'
9
8
  require 'cucumber/glue/snippet'
10
9
  require 'cucumber/glue/hook'
@@ -4,7 +4,6 @@ require 'forwardable'
4
4
  require 'cucumber/gherkin/data_table_parser'
5
5
  require 'cucumber/gherkin/formatter/escaping'
6
6
  require 'cucumber/multiline_argument/data_table/diff_matrices'
7
- require 'cucumber/deprecate'
8
7
 
9
8
  module Cucumber
10
9
  module MultilineArgument
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Detect the platform we're running on so we can tweak behaviour in various places.
4
3
  require 'rbconfig'
5
4
  require 'cucumber/core/platform'
6
5
 
@@ -11,12 +10,14 @@ module Cucumber
11
10
  RUBY_BINARY = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])
12
11
 
13
12
  class << self
14
- attr_accessor :use_full_backtrace
13
+ attr_writer :use_full_backtrace
14
+
15
+ def use_full_backtrace
16
+ @use_full_backtrace ||= false
17
+ end
15
18
 
16
- # @private
17
19
  def file_mode(mode, encoding = 'UTF-8')
18
20
  "#{mode}:#{encoding}"
19
21
  end
20
22
  end
21
- self.use_full_backtrace = false
22
23
  end
@@ -12,33 +12,21 @@ module Cucumber
12
12
 
13
13
  private
14
14
 
15
- def create_directory(dir_name)
16
- create_directory_or_file dir_name, true
15
+ def create_directory(directory_name)
16
+ create_directory_or_file(directory_name, command: :mkdir_p)
17
17
  end
18
18
 
19
- def create_file(file_name)
20
- create_directory_or_file file_name, false
19
+ def create_file(filename)
20
+ create_directory_or_file(filename, command: :touch)
21
21
  end
22
22
 
23
- def create_directory_or_file(file_name, directory)
24
- file_type = if directory
25
- :mkdir_p
26
- else
27
- :touch
28
- end
29
-
30
- report_exists(file_name) || return if File.exist?(file_name)
31
-
32
- report_creating(file_name)
33
- FileUtils.send file_type, file_name
34
- end
35
-
36
- def report_exists(file)
37
- puts " exist #{file}"
38
- end
39
-
40
- def report_creating(file)
41
- puts " create #{file}"
23
+ def create_directory_or_file(name, command:)
24
+ if File.exist?(name)
25
+ puts "#{name} already exists"
26
+ else
27
+ puts "creating #{name}"
28
+ FileUtils.send(command, name)
29
+ end
42
30
  end
43
31
  end
44
32
  end
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'fileutils'
4
4
  require 'cucumber/configuration'
5
- require 'cucumber/deprecate'
6
5
  require 'cucumber/load_path'
7
6
  require 'cucumber/formatter/duration'
8
7
  require 'cucumber/file_specs'
data/lib/cucumber.rb CHANGED
@@ -13,6 +13,14 @@ module Cucumber
13
13
  attr_accessor :wants_to_quit
14
14
  attr_reader :use_legacy_autoloader
15
15
 
16
+ def deprecate(message, method, remove_after_version)
17
+ Kernel.warn(
18
+ "\nWARNING: #{method} is deprecated" \
19
+ " and will be removed after version #{remove_after_version}. #{message}.\n" \
20
+ "(Called from #{caller(3..3).first})"
21
+ )
22
+ end
23
+
16
24
  def logger
17
25
  return @log if @log
18
26
 
metadata CHANGED
@@ -1,16 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.1.0
4
+ version: 10.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aslak Hellesøy
8
8
  - Matt Wynne
9
9
  - Steve Tooke
10
+ - Luke Hill
10
11
  autorequire:
11
12
  bindir: bin
12
13
  cert_chain: []
13
- date: 2025-08-20 00:00:00.000000000 Z
14
+ date: 2025-10-08 00:00:00.000000000 Z
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
16
17
  name: base64
@@ -349,7 +350,6 @@ files:
349
350
  - lib/cucumber/cli/rerun_file.rb
350
351
  - lib/cucumber/configuration.rb
351
352
  - lib/cucumber/constantize.rb
352
- - lib/cucumber/deprecate.rb
353
353
  - lib/cucumber/encoding.rb
354
354
  - lib/cucumber/errors.rb
355
355
  - lib/cucumber/events.rb
@@ -495,5 +495,5 @@ requirements: []
495
495
  rubygems_version: 3.4.20
496
496
  signing_key:
497
497
  specification_version: 4
498
- summary: cucumber-10.1.0
498
+ summary: cucumber-10.1.1
499
499
  test_files: []
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'cucumber/platform'
4
- require 'cucumber/gherkin/formatter/ansi_escapes'
5
-
6
- module Cucumber
7
- def self.deprecate(message, method, remove_after_version)
8
- $stderr.puts(
9
- "\nWARNING: #{method} is deprecated" \
10
- " and will be removed after version #{remove_after_version}. #{message}.\n" \
11
- "(Called from #{caller(3..3).first})"
12
- )
13
- end
14
- end