aruba 2.1.0 → 2.2.0

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: 81d7260059ff82a28fa715d2a679f65ac9fbf6952e560b887c1c9a546727e3cd
4
- data.tar.gz: d5aa01763869599dd1b69b66fd6f3504ea781a6b5aa6742c5146eb05c833341b
3
+ metadata.gz: 5ecd6da4e86f63a073bffd882d13902780ca69946de8867aa81cba5a8c6ad118
4
+ data.tar.gz: f588ff00344ee379a877dbbed442d411769516d8f2f53a164b6a219660e0c38a
5
5
  SHA512:
6
- metadata.gz: 5552a1bc0e6fd93e96626a0a8ca6e92d62ab56f17020170fe5156be69c91430497edb20ad096b862b99bda50cff49975c6f2641d1d319ddfe8186a09c225c7be
7
- data.tar.gz: f791bb3f0603fa86661d782e0c6d82a6363a37b4cd9e034783871271574d358031ac3f1d616a8bd6669d06cb1454558e3353384183f1d8f97da905ab6687461e
6
+ metadata.gz: d35cd2c9c3d89085f0a04ad2bf2e7b8b83b1cd10cebb87ed39111d0d3feb39b18ad905c5a02e9773881687574abc4b57c5c1d281d7432b746b8f685bd6862f7a
7
+ data.tar.gz: cd8bbb1369f18078e3d27a56fb43bef2fc3d25c9b17d81921d30ad759d4c8b16ac5c3a49e7e26e5d19a041df7fcb67da6e978b3c2f79198e22f05b585caa90db
data/CHANGELOG.md CHANGED
@@ -6,6 +6,17 @@ This project adheres to [Semantic Versioning][1].
6
6
 
7
7
  This document is formatted according to the principles of [Keep A CHANGELOG][2].
8
8
 
9
+ ## [2.2.0] / 2023-09-02
10
+
11
+ * Drop support for Ruby 2.5 ([#836] by [mvz])
12
+ * Add support for JRuby 9.4 ([#882] by [mvz])
13
+ * Support CRuby 3.2 ([#883] by [mvz])
14
+ * Improve `be_a_command_found_in_path matcher` and its tests ([#895] by [mvz])
15
+ * Replace ChildProcess with Process.spawn ([#891] and [#892] by [mvz])
16
+ * Support Cucumber version 9.0 ([#904] by [mvz])
17
+ * Drop support for Cucumber 4 through 7 ([#906] by [mvz])
18
+ * Drop support for Ruby 2.6 ([#907] by [mvz])
19
+
9
20
  ## [2.1.0] / 2022-05-20
10
21
 
11
22
  * Support Cucumber 8 ([#870] by [mvz] with [dependabot])
@@ -1017,17 +1028,26 @@ Note: These are changes w.r.t. Aruba version 0.14.1.
1017
1028
  [scottj97]: https://github.com/scottj97
1018
1029
  [stamhankar999]: https://github.com/stamhankar999
1019
1030
  [taylor]: https://github.com/taylor
1020
- [utkarsh2102]: https://github.com/utkarsh2102
1021
1031
  [tdreyno]: https://github.com/tdreyno
1032
+ [utkarsh2102]: https://github.com/utkarsh2102
1022
1033
  [xtrasimplicity]: https://github.com/xtrasimplicity
1023
1034
  [y-higuchi]: https://github.com/y-higuchi
1024
1035
 
1025
1036
  <!-- bots -->
1026
1037
 
1038
+ [renovate]: https://github.com/apps/renovate
1027
1039
  [dependabot]: https://github.com/apps/dependabot
1028
1040
 
1029
1041
  <!-- issues & pull requests -->
1030
1042
 
1043
+ [#904]: https://github.com/cucumber/aruba/pull/904
1044
+ [#895]: https://github.com/cucumber/aruba/pull/895
1045
+ [#892]: https://github.com/cucumber/aruba/pull/892
1046
+ [#891]: https://github.com/cucumber/aruba/pull/891
1047
+ [#883]: https://github.com/cucumber/aruba/pull/883
1048
+ [#882]: https://github.com/cucumber/aruba/pull/882
1049
+ [#836]: https://github.com/cucumber/aruba/pull/836
1050
+
1031
1051
  [#870]: https://github.com/cucumber/aruba/pull/870
1032
1052
  [#867]: https://github.com/cucumber/aruba/pull/867
1033
1053
  [#858]: https://github.com/cucumber/aruba/pull/858
@@ -1337,7 +1357,8 @@ Note: These are changes w.r.t. Aruba version 0.14.1.
1337
1357
 
1338
1358
  <!-- Releases -->
1339
1359
 
1340
- [Unreleased]: https://github.com/cucumber/aruba/compare/v2.1.0...main
1360
+ [Unreleased]: https://github.com/cucumber/aruba/compare/v2.2.0...main
1361
+ [2.2.0]: https://github.com/cucumber/aruba/compare/v2.1.0...v2.2.0
1341
1362
  [2.1.0]: https://github.com/cucumber/aruba/compare/v2.0.1...v2.1.0
1342
1363
  [2.0.1]: https://github.com/cucumber/aruba/compare/v2.0.0...v2.0.1
1343
1364
  [2.0.0]: https://github.com/cucumber/aruba/compare/v1.1.2...v2.0.0
data/README.md CHANGED
@@ -77,12 +77,12 @@ bump.
77
77
 
78
78
  ## Supported Ruby versions
79
79
 
80
- Aruba is supported on Ruby 2.5 and up, and tested against CRuby 2.5, 2.6, 2.7,
81
- 3.0 and 3.1, and JRuby 9.2 and 9.2.
80
+ Aruba is supported on Ruby 2.7 and up, and tested against CRuby 2.7, 3.0,
81
+ 3.1 and 3.2, and JRuby 9.4.
82
82
 
83
83
  ## Supported Cucumber versions
84
84
 
85
- Aruba is supported on and tested with Cucumber versions 4 through 8.
85
+ Aruba is supported on and tested with Cucumber versions 8 and 9.
86
86
 
87
87
  ## Supported operating systems
88
88
 
@@ -144,7 +144,7 @@ module Aruba
144
144
  def expand_path(file_name, dir_string = nil)
145
145
  unless file_name.is_a?(String) && !file_name.empty?
146
146
  message = "Filename #{file_name} needs to be a string." \
147
- " It cannot be nil or empty either."\
147
+ " It cannot be nil or empty either." \
148
148
  " Please use `expand_path('.')` if you want" \
149
149
  " the current directory to be expanded."
150
150
 
@@ -160,7 +160,7 @@ module Aruba
160
160
  prefix = file_name[0]
161
161
 
162
162
  if prefix == aruba.config.fixtures_path_prefix
163
- rest = file_name[2..-1]
163
+ rest = file_name[2..]
164
164
  path = File.join(*[aruba.fixtures_directory, rest].compact)
165
165
  unless Aruba.platform.exist? path
166
166
  aruba_fixture_candidates = aruba.config.fixtures_directories
@@ -195,8 +195,8 @@ module Aruba
195
195
  "Aruba's `expand_path` method was called with an absolute path" \
196
196
  " at #{caller_file_line}, which is not recommended." \
197
197
  " The path passed was '#{file_name}'." \
198
- " Change the call to pass a relative path or set "\
199
- "`config.allow_absolute_paths = true` to silence this warning"
198
+ " Change the call to pass a relative path or set" \
199
+ " `config.allow_absolute_paths = true` to silence this warning"
200
200
  raise UserError, message
201
201
  end
202
202
  file_name
@@ -302,11 +302,7 @@ module Aruba
302
302
  end
303
303
 
304
304
  mode = args.shift
305
- mode = if mode.is_a? String
306
- mode.to_i(8)
307
- else
308
- mode
309
- end
305
+ mode = mode.to_i(8) if mode.is_a? String
310
306
 
311
307
  args.each { |path| raise "Expected #{path} to be present" unless exist?(path) }
312
308
  paths = args.map { |path| expand_path(path) }
@@ -81,7 +81,7 @@ When(/^I stop the command(?: started last)? if (output|stdout|stderr) contains:$
81
81
  sleep 0.1
82
82
  end
83
83
  end
84
- rescue ChildProcess::TimeoutError, Timeout::Error
84
+ rescue Timeout::Error
85
85
  last_command_started.terminate
86
86
  end
87
87
 
@@ -10,7 +10,7 @@ module Aruba
10
10
  # Helpers for Resolvers
11
11
  module ResolveHelpers
12
12
  def camel_case(underscored_name)
13
- underscored_name.to_s.split("_").map { |word| word.upcase[0] + word[1..-1] }.join
13
+ underscored_name.to_s.split("_").map { |word| word.upcase[0] + word[1..] }.join
14
14
  end
15
15
 
16
16
  # Thanks ActiveSupport
@@ -15,17 +15,17 @@
15
15
  # end
16
16
  RSpec::Matchers.define :be_a_command_found_in_path do
17
17
  match do |actual|
18
- @actual = Shellwords.split(actual.commandline).first if actual.respond_to? :commandline
19
-
20
- !which(@actual).nil?
18
+ !which(actual).nil?
21
19
  end
22
20
 
23
21
  failure_message do |actual|
24
- format(%(expected that command "%s" can be found in PATH "#{ENV['PATH']}".), actual)
22
+ format(%(expected that command "%s" can be found in PATH "%s".),
23
+ actual, aruba.environment["PATH"])
25
24
  end
26
25
 
27
26
  failure_message_when_negated do |actual|
28
- format(%(expected that command "%s" cannot be found in PATH "#{ENV['PATH']}".), actual)
27
+ format(%(expected that command "%s" cannot be found in PATH "%s".),
28
+ actual, aruba.environment["PATH"])
29
29
  end
30
30
  end
31
31
 
@@ -32,7 +32,7 @@ module Aruba
32
32
  name_size = longest_key.length
33
33
 
34
34
  rows = hash.map do |k, v|
35
- format("# %-#{name_size}s => %s", k, v)
35
+ format("# %-*s => %s", name_size, k, v)
36
36
  end
37
37
 
38
38
  if opts[:sort] == true
@@ -241,6 +241,10 @@ module Aruba
241
241
  def builtin_shell_commands
242
242
  []
243
243
  end
244
+
245
+ def term_signal_supported?
246
+ true
247
+ end
244
248
  end
245
249
  end
246
250
  end
@@ -4,8 +4,6 @@ module Aruba
4
4
  module Platforms
5
5
  # This is a command which should be run
6
6
  #
7
- # This adds `cmd.exec` in front of commmand
8
- #
9
7
  # @private
10
8
  class WindowsCommandString
11
9
  def initialize(command, *arguments)
@@ -15,22 +13,7 @@ module Aruba
15
13
 
16
14
  # Convert to array
17
15
  def to_a
18
- [cmd_path, "/c", [escaped_command, *escaped_arguments].join(" ")]
19
- end
20
-
21
- private
22
-
23
- def escaped_arguments
24
- @arguments.map { |arg| arg.gsub(/"/, '"""') }
25
- .map { |arg| / /.match?(arg) ? "\"#{arg}\"" : arg }
26
- end
27
-
28
- def escaped_command
29
- @command.gsub(/ /, '""" """')
30
- end
31
-
32
- def cmd_path
33
- Aruba.platform.which("cmd.exe")
16
+ [@command, *@arguments]
34
17
  end
35
18
  end
36
19
  end
@@ -39,6 +39,10 @@ module Aruba
39
39
  def builtin_shell_commands
40
40
  %w(cd dir echo exit set type)
41
41
  end
42
+
43
+ def term_signal_supported?
44
+ false
45
+ end
42
46
  end
43
47
  end
44
48
  end
@@ -125,7 +125,7 @@ module Aruba
125
125
  end
126
126
 
127
127
  def arguments
128
- return Shellwords.split(commandline)[1..-1] if Shellwords.split(commandline).size > 1
128
+ return Shellwords.split(commandline)[1..] if Shellwords.split(commandline).size > 1
129
129
 
130
130
  []
131
131
  end
@@ -1,4 +1,3 @@
1
- require "childprocess"
2
1
  require "tempfile"
3
2
  require "shellwords"
4
3
 
@@ -10,6 +9,85 @@ require "aruba/platform"
10
9
  module Aruba
11
10
  # Platforms
12
11
  module Processes
12
+ # Wrapper around Process.spawn that broadly follows the ChildProcess interface
13
+ # @private
14
+ class ProcessRunner
15
+ def initialize(command_array)
16
+ @command_array = command_array
17
+ @exit_status = nil
18
+ end
19
+
20
+ attr_accessor :stdout, :stderr, :cwd, :environment
21
+ attr_reader :command_array, :pid
22
+
23
+ def start
24
+ @stdin_r, @stdin_w = IO.pipe
25
+ @pid = Process.spawn(environment, *command_array,
26
+ unsetenv_others: true,
27
+ in: @stdin_r,
28
+ out: stdout.fileno,
29
+ err: stderr.fileno,
30
+ close_others: true,
31
+ chdir: cwd)
32
+ end
33
+
34
+ def stdin
35
+ @stdin_w
36
+ end
37
+
38
+ def stop
39
+ return if @exit_status
40
+
41
+ if Aruba.platform.term_signal_supported?
42
+ send_signal "TERM"
43
+ return if poll_for_exit(3)
44
+ end
45
+
46
+ send_signal "KILL"
47
+ wait
48
+ end
49
+
50
+ def wait
51
+ _, status = Process.waitpid2 @pid
52
+ @exit_status = status
53
+ end
54
+
55
+ def exited?
56
+ return true if @exit_status
57
+
58
+ pid, status = Process.waitpid2 @pid, Process::WNOHANG | Process::WUNTRACED
59
+
60
+ if pid
61
+ @exit_status = status
62
+ return true
63
+ end
64
+
65
+ false
66
+ end
67
+
68
+ def poll_for_exit(exit_timeout)
69
+ start = Time.now
70
+ wait_until = start + exit_timeout
71
+ loop do
72
+ return true if exited?
73
+ break if Time.now >= wait_until
74
+
75
+ sleep 0.1
76
+ end
77
+ false
78
+ end
79
+
80
+ def exit_code
81
+ @exit_status&.exitstatus
82
+ end
83
+
84
+ private
85
+
86
+ def send_signal(signal)
87
+ Process.kill signal, @pid
88
+ end
89
+ end
90
+
13
91
  # Spawn a process for command
14
92
  #
15
93
  # `SpawnProcess` is not meant for direct use - `SpawnProcess.new` - by
@@ -74,7 +152,8 @@ module Aruba
74
152
 
75
153
  @started = true
76
154
 
77
- @process = ChildProcess.build(*command_string.to_a)
155
+ @process = ProcessRunner.new(command_string.to_a)
156
+
78
157
  @stdout_file = Tempfile.new("aruba-stdout-")
79
158
  @stderr_file = Tempfile.new("aruba-stderr-")
80
159
 
@@ -85,23 +164,19 @@ module Aruba
85
164
  @stderr_file.set_encoding("ASCII-8BIT")
86
165
 
87
166
  @exit_status = nil
88
- @duplex = true
89
167
 
90
168
  before_run
91
169
 
92
- @process.io.stdout = @stdout_file
93
- @process.io.stderr = @stderr_file
94
- @process.duplex = @duplex
95
- @process.cwd = @working_directory
170
+ @process.stdout = @stdout_file
171
+ @process.stderr = @stderr_file
172
+ @process.cwd = @working_directory
96
173
 
97
- @process.environment.update(environment)
174
+ @process.environment = environment
98
175
 
99
176
  begin
100
- Aruba.platform.with_environment(environment) do
101
- @process.start
102
- sleep startup_wait_time
103
- end
104
- rescue ChildProcess::LaunchError => e
177
+ @process.start
178
+ sleep startup_wait_time
179
+ rescue SystemCallError => e
105
180
  raise LaunchError, "It tried to start #{commandline}. " + e.message
106
181
  end
107
182
 
@@ -131,7 +206,7 @@ module Aruba
131
206
  return @stdout_cache if stopped?
132
207
 
133
208
  wait_for_io opts.fetch(:wait_for_io, io_wait_timeout) do
134
- @process.io.stdout.flush
209
+ @process.stdout.flush
135
210
  open(@stdout_file.path).read
136
211
  end
137
212
  end
@@ -150,7 +225,7 @@ module Aruba
150
225
  return @stderr_cache if stopped?
151
226
 
152
227
  wait_for_io opts.fetch(:wait_for_io, io_wait_timeout) do
153
- @process.io.stderr.flush
228
+ @process.stderr.flush
154
229
  open(@stderr_file.path).read
155
230
  end
156
231
  end
@@ -158,8 +233,8 @@ module Aruba
158
233
  def write(input)
159
234
  return if stopped?
160
235
 
161
- @process.io.stdin.write(input)
162
- @process.io.stdin.flush
236
+ @process.stdin.write(input)
237
+ @process.stdin.flush
163
238
 
164
239
  self
165
240
  end
@@ -168,18 +243,14 @@ module Aruba
168
243
  def close_io(name)
169
244
  return if stopped?
170
245
 
171
- @process.io.public_send(name.to_sym).close
246
+ @process.public_send(name.to_sym).close
172
247
  end
173
248
 
174
249
  # Stop command
175
250
  def stop(*)
176
251
  return @exit_status if stopped?
177
252
 
178
- begin
179
- @process.poll_for_exit(@exit_timeout)
180
- rescue ChildProcess::TimeoutError
181
- @timed_out = true
182
- end
253
+ @process.poll_for_exit(@exit_timeout) or @timed_out = true
183
254
 
184
255
  terminate
185
256
  end
data/lib/aruba/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Aruba
2
- VERSION = "2.1.0".freeze
2
+ VERSION = "2.2.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aruba
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aslak Hellesøy, Matt Wynne and other Aruba Contributors
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-20 00:00:00.000000000 Z
11
+ date: 2023-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,26 +30,6 @@ dependencies:
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '3.0'
33
- - !ruby/object:Gem::Dependency
34
- name: childprocess
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- version: '2.0'
40
- - - "<"
41
- - !ruby/object:Gem::Version
42
- version: '5.0'
43
- type: :runtime
44
- prerelease: false
45
- version_requirements: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - ">="
48
- - !ruby/object:Gem::Version
49
- version: '2.0'
50
- - - "<"
51
- - !ruby/object:Gem::Version
52
- version: '5.0'
53
33
  - !ruby/object:Gem::Dependency
54
34
  name: contracts
55
35
  requirement: !ruby/object:Gem::Requirement
@@ -76,20 +56,20 @@ dependencies:
76
56
  requirements:
77
57
  - - ">="
78
58
  - !ruby/object:Gem::Version
79
- version: '4.0'
59
+ version: '8.0'
80
60
  - - "<"
81
61
  - !ruby/object:Gem::Version
82
- version: '9.0'
62
+ version: '10.0'
83
63
  type: :runtime
84
64
  prerelease: false
85
65
  version_requirements: !ruby/object:Gem::Requirement
86
66
  requirements:
87
67
  - - ">="
88
68
  - !ruby/object:Gem::Version
89
- version: '4.0'
69
+ version: '8.0'
90
70
  - - "<"
91
71
  - !ruby/object:Gem::Version
92
- version: '9.0'
72
+ version: '10.0'
93
73
  - !ruby/object:Gem::Dependency
94
74
  name: rspec-expectations
95
75
  requirement: !ruby/object:Gem::Requirement
@@ -194,20 +174,6 @@ dependencies:
194
174
  - - "<"
195
175
  - !ruby/object:Gem::Version
196
176
  version: 0.15.0
197
- - !ruby/object:Gem::Dependency
198
- name: pry-doc
199
- requirement: !ruby/object:Gem::Requirement
200
- requirements:
201
- - - "~>"
202
- - !ruby/object:Gem::Version
203
- version: '1.0'
204
- type: :development
205
- prerelease: false
206
- version_requirements: !ruby/object:Gem::Requirement
207
- requirements:
208
- - - "~>"
209
- - !ruby/object:Gem::Version
210
- version: '1.0'
211
177
  - !ruby/object:Gem::Dependency
212
178
  name: rake
213
179
  requirement: !ruby/object:Gem::Requirement
@@ -327,7 +293,7 @@ dependencies:
327
293
  version: 0.18.0
328
294
  - - "<"
329
295
  - !ruby/object:Gem::Version
330
- version: 0.22.0
296
+ version: 0.23.0
331
297
  type: :development
332
298
  prerelease: false
333
299
  version_requirements: !ruby/object:Gem::Requirement
@@ -337,21 +303,7 @@ dependencies:
337
303
  version: 0.18.0
338
304
  - - "<"
339
305
  - !ruby/object:Gem::Version
340
- version: 0.22.0
341
- - !ruby/object:Gem::Dependency
342
- name: yard-junk
343
- requirement: !ruby/object:Gem::Requirement
344
- requirements:
345
- - - "~>"
346
- - !ruby/object:Gem::Version
347
- version: 0.0.7
348
- type: :development
349
- prerelease: false
350
- version_requirements: !ruby/object:Gem::Requirement
351
- requirements:
352
- - - "~>"
353
- - !ruby/object:Gem::Version
354
- version: 0.0.7
306
+ version: 0.23.0
355
307
  description: |
356
308
  Extension for popular TDD and BDD frameworks like "Cucumber", "RSpec" and "Minitest",
357
309
  to make testing command line applications meaningful, easy and fun.
@@ -486,15 +438,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
486
438
  requirements:
487
439
  - - ">="
488
440
  - !ruby/object:Gem::Version
489
- version: '2.5'
441
+ version: '2.7'
490
442
  required_rubygems_version: !ruby/object:Gem::Requirement
491
443
  requirements:
492
444
  - - ">="
493
445
  - !ruby/object:Gem::Version
494
446
  version: '0'
495
447
  requirements: []
496
- rubygems_version: 3.3.7
448
+ rubygems_version: 3.4.18
497
449
  signing_key:
498
450
  specification_version: 4
499
- summary: aruba-2.1.0
451
+ summary: aruba-2.2.0
500
452
  test_files: []