aruba 2.4.1 → 3.0.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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +87 -7
  3. data/CONTRIBUTING.md +55 -33
  4. data/README.md +11 -9
  5. data/lib/aruba/api/bundler.rb +1 -5
  6. data/lib/aruba/api/commands.rb +29 -40
  7. data/lib/aruba/api/core.rb +2 -13
  8. data/lib/aruba/api/filesystem.rb +24 -44
  9. data/lib/aruba/api/text.rb +5 -2
  10. data/lib/aruba/aruba_logger.rb +3 -6
  11. data/lib/aruba/basic_configuration/option.rb +1 -7
  12. data/lib/aruba/basic_configuration.rb +7 -13
  13. data/lib/aruba/cli.rb +0 -6
  14. data/lib/aruba/command.rb +16 -16
  15. data/lib/aruba/command_monitor.rb +2 -4
  16. data/lib/aruba/configuration.rb +32 -20
  17. data/lib/aruba/cucumber/command.rb +32 -119
  18. data/lib/aruba/cucumber/environment.rb +0 -4
  19. data/lib/aruba/cucumber/file.rb +10 -10
  20. data/lib/aruba/cucumber/hooks.rb +12 -15
  21. data/lib/aruba/cucumber.rb +0 -1
  22. data/lib/aruba/events.rb +50 -14
  23. data/lib/aruba/generators/script_file.rb +5 -5
  24. data/lib/aruba/initializer.rb +7 -2
  25. data/lib/aruba/matchers/command/have_output.rb +1 -1
  26. data/lib/aruba/matchers/command/have_output_on_stderr.rb +1 -1
  27. data/lib/aruba/matchers/command/have_output_on_stdout.rb +1 -1
  28. data/lib/aruba/matchers/command/have_output_size.rb +7 -20
  29. data/lib/aruba/matchers/string/match_output_string.rb +0 -2
  30. data/lib/aruba/platforms/unix_platform.rb +3 -3
  31. data/lib/aruba/platforms/unix_which.rb +2 -4
  32. data/lib/aruba/platforms/windows_which.rb +2 -4
  33. data/lib/aruba/processes/basic_process.rb +4 -4
  34. data/lib/aruba/processes/debug_process.rb +2 -1
  35. data/lib/aruba/processes/in_process.rb +3 -1
  36. data/lib/aruba/processes/spawn_process.rb +32 -21
  37. data/lib/aruba/rspec.rb +18 -25
  38. data/lib/aruba/runtime.rb +39 -21
  39. data/lib/aruba/setup.rb +20 -21
  40. data/lib/aruba/version.rb +1 -1
  41. metadata +76 -63
  42. data/lib/aruba/console/help.rb +0 -34
  43. data/lib/aruba/console.rb +0 -67
  44. data/lib/aruba/contracts/absolute_path.rb +0 -22
  45. data/lib/aruba/contracts/enum.rb +0 -29
  46. data/lib/aruba/contracts/is_power_of_two.rb +0 -24
  47. data/lib/aruba/contracts/relative_path.rb +0 -22
  48. data/lib/aruba/cucumber/testing_frameworks.rb +0 -219
  49. data/lib/aruba/matchers/string/include_output_string.rb +0 -36
  50. data/lib/aruba/matchers/string/output_string_eq.rb +0 -35
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7d2fbde24897343e351c380098a0eef63f3a648a7fe535b08acf07e7c09b3757
4
- data.tar.gz: 23e3d481c4eae0bee6d53c57ce8beb5b7c888c45dbb75b12d5636613f8bbe01f
3
+ metadata.gz: 13ac7e2b40076b3542179c4b56a834f7c453bab91d3c8c5f4657e786b3bdc578
4
+ data.tar.gz: 76f0146af77802c89000ecec744f4a59c00a93499ef535a6b86ee88d53e48dc8
5
5
  SHA512:
6
- metadata.gz: d5b6b7386d562d858581bc219f0ab747edb13e36e202a8868e6ab03ef62b49f3c6e4376775ee6fb30d6c2872408d63b9f5f99e1b653977d5ae5ded67914cd635
7
- data.tar.gz: f5a0031cc12f1a1fa5318b81a86d079b66e6ee89f870189eac414e1ac42494a742a2c71dd2c3bfd99c50ce571d17a67576e382a6c63eae206aba5eb17a5596b7
6
+ metadata.gz: a1afd6bc861903430ed32dd0daeabf217f43d9ca81d38c40fe312ece99e35e8113751c8747d96e6076744f57849f0337e6197c7087bc032f028a2766c44d8c7b
7
+ data.tar.gz: 4e5c6381e055fa3cae6157ea1f2ec9ffdd9adea5caf606690604576f62d8506cda38a9842a3141ef69d40ebebbba775a723fb8935089b1638f9acad8f1b2548e
data/CHANGELOG.md CHANGED
@@ -6,6 +6,82 @@ 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
+ ## [3.0.0] / 2026-10-16
10
+
11
+ ### Breaking changes
12
+
13
+ * Remove Aruba console ([#1034] by [mvz])
14
+ * Do not unescape actual output text in `have_output*` matchers ([#1057] by [mvz])
15
+ * Remove code that was marked deprecated in the previous release ([#1068] by [mvz])
16
+ * Run each scenario in a separate working directory with a unique name.
17
+ * Ensure working directory is safe ([#1053] by [mvz])
18
+ * Always clean up the working directory for the next test or scenario ([#1072] by [mvz])
19
+ * Isolate workspace directories from each other ([#1075] by [mvz])
20
+ * Make testing framework steps internal to Aruba ([#1085] by [mvz])
21
+ * Remove several RSpec matchers. Use RSpec's built-in matchers instead.
22
+ * Drop use of `an_output_string_being_eq` matcher ([#1095] by [mvz])
23
+ * Remove `a_file_name_matching` matcher ([#1097] by [mvz])
24
+ * Remove `include_output_string` matcher ([#1099] by [mvz])
25
+ * Remove `file_content_matching` matcher ([#1100] by [mvz])
26
+ * Remove `output_string_eq matcher` ([#1098] by [mvz])
27
+ * Improve Aruba::Api#which and allow empty path ([#1073] by [mvz])
28
+
29
+ ### Improvements
30
+
31
+ * Make wording for steps waiting for output read better ([#1060] by [mvz])
32
+
33
+ ### Dependencies
34
+
35
+ Aruba 3 supports Ruby 3.2 and above, and Cucumer 11 and 12
36
+
37
+ * Support Ruby 3.2 and above ([#1038] by [mvz])
38
+ * Drop support for Cucumber 8 through 10 ([#1039] by [mvz])
39
+ * Require a bundler version that supports `with_unbundled_env` ([#1041] by [mvz])
40
+ * Depend only on cucumber-core at runtime ([#1049] by [mvz])
41
+ * Add support for Cucumber version 12 ([#1102] by [mvz])
42
+
43
+ ### Bugfixes
44
+
45
+ * Do not announce binary content of command ([#985] by [mvz])
46
+ * Use anonymous temporary files that are unlinked upon creation ([#1059] by [mvz])
47
+ * Ensure Aruba::VERSION is available for aruba init ([87a92c9] by [mvz])
48
+
49
+ ### Documentation
50
+
51
+ * Add OpenSSF Scorecard badge ([#1023] by [mpkorstanje])
52
+ * Improve getting started documentation for minitest and rspec ([#1055] by [mvz])
53
+ * Make most of the process runners' API public ([#1105] by [mvz])
54
+
55
+ [mpkorstanje]: https://github.com/mpkorstanje
56
+
57
+ [87a92c9]: https://github.com/cucumber/aruba/commit/87a92c9af714cd767f6e5926e45e03a62d53f761
58
+ [#985]: https://github.com/cucumber/aruba/pull/985
59
+ [#1023]: https://github.com/cucumber/aruba/pull/1023
60
+ [#1034]: https://github.com/cucumber/aruba/pull/1034
61
+ [#1038]: https://github.com/cucumber/aruba/pull/1038
62
+ [#1039]: https://github.com/cucumber/aruba/pull/1039
63
+ [#1041]: https://github.com/cucumber/aruba/pull/1041
64
+ [#1049]: https://github.com/cucumber/aruba/pull/1049
65
+ [#1053]: https://github.com/cucumber/aruba/pull/1053
66
+ [#1055]: https://github.com/cucumber/aruba/pull/1055
67
+ [#1057]: https://github.com/cucumber/aruba/pull/1057
68
+ [#1059]: https://github.com/cucumber/aruba/pull/1059
69
+ [#1060]: https://github.com/cucumber/aruba/pull/1060
70
+ [#1068]: https://github.com/cucumber/aruba/pull/1068
71
+ [#1072]: https://github.com/cucumber/aruba/pull/1072
72
+ [#1073]: https://github.com/cucumber/aruba/pull/1073
73
+ [#1075]: https://github.com/cucumber/aruba/pull/1075
74
+ [#1085]: https://github.com/cucumber/aruba/pull/1085
75
+ [#1095]: https://github.com/cucumber/aruba/pull/1095
76
+ [#1097]: https://github.com/cucumber/aruba/pull/1097
77
+ [#1098]: https://github.com/cucumber/aruba/pull/1098
78
+ [#1099]: https://github.com/cucumber/aruba/pull/1099
79
+ [#1100]: https://github.com/cucumber/aruba/pull/1100
80
+ [#1102]: https://github.com/cucumber/aruba/pull/1102
81
+ [#1105]: https://github.com/cucumber/aruba/pull/1105
82
+
83
+ [3.0.0]: https://github.com/cucumber/aruba/compare/v2.4.1...v3.0.0
84
+
9
85
  ## [2.4.1] / 2026-05-15
10
86
 
11
87
  * Fix summary text in the gemspec [89dda45]
@@ -16,6 +92,8 @@ This document is formatted according to the principles of [Keep A CHANGELOG][2].
16
92
  [#1015]: https://github.com/cucumber/aruba/pull/1015
17
93
  [#1016]: https://github.com/cucumber/aruba/pull/1016
18
94
 
95
+ [2.4.1]: https://github.com/cucumber/aruba/compare/v2.4.0...v2.4.1
96
+
19
97
  ## [2.4.0] / 2026-05-02
20
98
 
21
99
  * Allow multiple arguments to xProcess#write ([#634] by [mvz])
@@ -623,11 +701,12 @@ Note: These are changes w.r.t. Aruba version 0.14.1.
623
701
 
624
702
  ## [0.10.0.pre]
625
703
 
626
- * Add some new steps to make writing documentation easier using "cucumber",
627
- "rspec", "minitest" together with "aruba" - see [Feature](features/getting_started/supported_testing_frameworks.feature)
628
- for some examples
629
- * Write output of commands directly to disk if SpawnProcess is used
630
- (see [85d74fcc](https://github.com/cucumber/aruba/commit/85d74fcca4fff4e753776925d8b003cddaa8041d))
704
+ * Add some new steps to make writing documentation easier using "cucumber", "rspec",
705
+ "minitest" together with "aruba" - see
706
+ [Feature](features/getting_started/supported_testing_frameworks.feature) for
707
+ some examples
708
+ * Write output of commands directly to disk if SpawnProcess is used (see
709
+ [85d74fcc](https://github.com/cucumber/aruba/commit/85d74fcca4fff4e753776925d8b003cddaa8041d))
631
710
  * Refactored API of cucumber steps to reduce the need for more methods and make
632
711
  it easier for users to write their own steps ([#306])
633
712
  * Added `aruba init` to the cli command to setup environment for aruba (issue
@@ -1057,7 +1136,8 @@ Note: These are changes w.r.t. Aruba version 0.14.1.
1057
1136
  config/aruba-rvm.yml. ([aslakhellesoy])
1058
1137
  * Check for presence of files. ([aslakhellesoy])
1059
1138
  * Allow specification of rvm gemsets. ([aslakhellesoy])
1060
- * Detect ruby commands and use current ruby when rvm is not explicitly used. ([aslakhellesoy])
1139
+ * Detect ruby commands and use current ruby when rvm is not explicitly used.
1140
+ ([aslakhellesoy])
1061
1141
  * Added support for rvm, making it possible to choose Ruby interpreter. ([aslakhellesoy])
1062
1142
  * Added `@announce-cmd`, `@announce-stdout` and `@announce` tags, useful for seeing
1063
1143
  what's executed and outputted. ([aslakhellesoy])
@@ -1556,7 +1636,7 @@ Note: These are changes w.r.t. Aruba version 0.14.1.
1556
1636
  [0.1.3]: https://github.com/cucumber/aruba/compare/v0.1.2...v0.1.3
1557
1637
  [0.1.2]: https://github.com/cucumber/aruba/compare/v0.1.1...v0.1.2
1558
1638
  [0.1.1]: https://github.com/cucumber/aruba/compare/v0.1.0...v0.1.1
1559
- [0.1.0]: https://github.com/cucumber/aruba/compare/ed6a175d23aaff62dbf355706996f276f304ae8b...v0.1.1
1639
+ [0.1.0]:https://github.com/cucumber/aruba/compare/ed6a175d23aaff62dbf355706996f276f304ae8b...v0.1.0
1560
1640
 
1561
1641
  <!-- Other links -->
1562
1642
 
data/CONTRIBUTING.md CHANGED
@@ -1,16 +1,14 @@
1
1
  # Contributing to the Cucumber Aruba Project
2
2
 
3
- ## Introduction
4
-
5
3
  We would love to get help from you as a **user** and a **contributor**.
6
4
 
7
- ### As a **User**
5
+ As a **User**:
8
6
 
9
7
  * Tell us how "Aruba" works for you
10
8
  * Spread the word if you like our work and please tell us if something is (utterly) wrong
11
9
  * Encourage people in testing their code and keep communicating their needs
12
10
 
13
- ### As a **Contributor**
11
+ As a **Contributor**:
14
12
 
15
13
  * Send us bug fixes
16
14
  * Add new features to the code
@@ -48,9 +46,7 @@ please learn our basic rules:
48
46
 
49
47
  ### Pull Requests
50
48
 
51
- #### Contributors
52
-
53
- Please...
49
+ **Contributors**, please
54
50
 
55
51
  * Fork the project. Make a branch for your change.
56
52
  * Make your feature addition or bug fix &mdash; if you're unsure if your
@@ -69,7 +65,7 @@ Please...
69
65
  lines/files relevant for a single change.
70
66
  * Send us a pull request.
71
67
 
72
- #### Maintainers
68
+ **Maintainers**,
73
69
 
74
70
  * Use pull requests for larger or controversial changes made by yourself or
75
71
  changes you might expected to break the build.
@@ -129,29 +125,61 @@ bundle exec rake cucumber
129
125
  bundle exec rake cucumber:wip
130
126
  ```
131
127
 
128
+ If you want to run the test suite against specific versions of Aruba's
129
+ dependencies, you can use [appraisal](https://github.com/thoughtbot/appraisal):
130
+
131
+ ```bash
132
+ bundle exec appraisal cucumber_11 bundle install
133
+ bundle exec appraisal cucumber_11 bundle exec rake
134
+ ```
135
+
136
+ ### Running tests in a container
137
+
132
138
  If you have problems because our assumptions about your local setup are wrong,
133
- perhaps you can use this Docker workflow. This requires [Docker] to be
139
+ perhaps you can use this Docker workflow. This requires [Docker] or [Podman] to be
134
140
  installed on your local system.
135
141
 
136
- ```bash
137
- # Build the docker container
138
- docker build -t test-aruba .
142
+ **Using Docker**
139
143
 
140
- # Open a bash shell inside the container with attached volume so changes to the
141
- # code will be picked up automatically.
142
- docker run -v $PWD:/aruba --rm -it test-aruba:latest bash
144
+ 1. Build the container:
143
145
 
144
- # Run the test suite
145
- bundle exec rake
146
- ```
146
+ ```bash
147
+ docker build -t test-aruba-docker .
148
+ ```
147
149
 
148
- If you want to run the test suite against specific versions of Aruba's
149
- dependencies, you can use [appraisal](https://github.com/thoughtbot/appraisal):
150
+ 2. Open a bash shell inside the container with attached volume so changes to
151
+ the code will be picked up automatically:
150
152
 
151
- ```bash
152
- bundle exec appraisal cucumber_6 bundle install
153
- bundle exec appraisal cucumber_6 bundle exec rake
154
- ```
153
+ ```bash
154
+ docker run -v $PWD:/aruba --rm -it test-aruba-docker:latest bash
155
+ ```
156
+
157
+ 3. Inside the container, run the test suite:
158
+
159
+ ```bash
160
+ bundle exec rake
161
+ ```
162
+
163
+ **Using Podman**
164
+
165
+ 1. Build the container:
166
+
167
+ ```bash
168
+ podman build -t test-aruba-podman -f Dockerfile.podman .
169
+ ```
170
+
171
+ 2. Open a bash shell inside the container with attached volume so changes to
172
+ the code will be picked up automatically:
173
+
174
+ ```bash
175
+ podman run -v $PWD:/aruba --rm -it test-aruba-podman:latest bash
176
+ ```
177
+
178
+ 3. Inside the container, run the test suite:
179
+
180
+ ```bash
181
+ bundle exec rake
182
+ ```
155
183
 
156
184
  ### Installing your own gems used for development
157
185
 
@@ -164,14 +192,6 @@ Example `Gemfile.local`:
164
192
  gem 'byebug'
165
193
  ```
166
194
 
167
- ### Running a developer console
168
-
169
- The interactive Aruba console starts an IRB console with Aruba's API loaded:
170
-
171
- ```bash
172
- bin/console
173
- ```
174
-
175
195
  ### Linting
176
196
 
177
197
  Aruba's Rakefile provides the following linting tasks
@@ -204,10 +224,11 @@ bundle exec rake install:local
204
224
  * No need to add a [`CHANGELOG.md`][changelog] header at this point - this
205
225
  should be done later, when a new change is made.
206
226
 
207
- See [the general Cucumber project release process](https://github.com/cucumber/.github/blob/main/RELEASING.md).
227
+ See [the general Cucumber project release process][releasing].
208
228
 
209
229
  [changelog]: CHANGELOG.md
210
230
  [readme]: README.md
231
+ [releasing]: https://github.com/cucumber/.github/blob/main/RELEASING.md
211
232
 
212
233
  [`rubocop`]: https://github.com/bbatsov/rubocop
213
234
  [Ruby Community Style Guide]: https://github.com/bbatsov/ruby-style-guide
@@ -217,6 +238,7 @@ See [the general Cucumber project release process](https://github.com/cucumber/.
217
238
  [Bundler]: https://bundler.io/
218
239
 
219
240
  [Docker]: https://docs.docker.com/
241
+ [Podman]: https://podman.io/docs
220
242
  [YARD]: http://yardoc.org/
221
243
  ["How to Write a Git Commit Message"]: http://chris.beams.io/posts/git-commit/
222
244
  [cucumber/website]: https://github.com/cucumber/website
data/README.md CHANGED
@@ -3,14 +3,16 @@
3
3
  [![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/cucumber/aruba/main/LICENSE)
4
4
  [![Gem Version](https://badge.fury.io/rb/aruba.svg)](http://badge.fury.io/rb/aruba)
5
5
  [![Support](https://img.shields.io/badge/cucumber-support-orange.svg)](https://cucumber.io/support)
6
- [![CI](https://github.com/cucumber/aruba/actions/workflows/test.yml/badge.svg)](https://github.com/cucumber/aruba/actions/workflows/test.yml)
6
+ [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/cucumber/aruba/badge)](https://scorecard.dev/viewer/?uri=github.com/cucumber/aruba)
7
+
8
+ [![CI](https://github.com/cucumber/aruba/actions/workflows/test-ruby.yaml/badge.svg)](https://github.com/cucumber/aruba/actions/workflows/test-ruby.yaml)
7
9
 
8
10
  ## Install
9
11
 
10
12
  Add this line to your application's `Gemfile`:
11
13
 
12
14
  ```ruby
13
- gem 'aruba', '~> 2.4'
15
+ gem 'aruba', '~> 3.0'
14
16
  ```
15
17
 
16
18
  And then execute:
@@ -78,12 +80,12 @@ bump.
78
80
 
79
81
  ## Supported Ruby versions
80
82
 
81
- Aruba is supported on Ruby 3.0 and up, and tested against CRuby 3.0, 3.1, 3.2,
82
- 3.3, 3.4 and 4.0, and JRuby 9.4 and 10.0.
83
+ Aruba is supported on Ruby 3.2 and up, and tested against CRuby 3.2, 3.3, 3.4
84
+ and 4.0, and JRuby 10.0.
83
85
 
84
86
  ## Supported Cucumber versions
85
87
 
86
- Aruba is supported on and tested with Cucumber versions 8, 9, 10 and 11.
88
+ Aruba is supported on and tested with Cucumber version 11 and 12.
87
89
 
88
90
  ## Supported operating systems
89
91
 
@@ -97,10 +99,10 @@ Please see the [CONTRIBUTING](CONTRIBUTING.md) file.
97
99
 
98
100
  ## Code branches
99
101
 
100
- Development takes place in the `main` branch and currently targets the 2.x
101
- releases. If necessary, maintenance of the old 1.1.x releases will take place
102
- in a `1-1-stable` branch, and of 0.14.x releases in the `0-14-stable` branch.
103
- Stable branches will not be created until absolutely necessary.
102
+ Development takes place in the `main` branch and currently targets bugfixes on
103
+ the 3.0 release. If necessary, maintenance of 2.4.x releases will take place in
104
+ a `2-4-stable` branch. Older releases will not receive updates. Stable branches
105
+ will not be created until absolutely necessary.
104
106
 
105
107
  ## License
106
108
 
@@ -23,11 +23,7 @@ module Aruba
23
23
  private
24
24
 
25
25
  def with_unbundled_env(&block)
26
- if ::Bundler.respond_to?(:with_unbundled_env)
27
- ::Bundler.with_unbundled_env(&block)
28
- else
29
- ::Bundler.with_clean_env(&block)
30
- end
26
+ ::Bundler.with_unbundled_env(&block)
31
27
  end
32
28
  end
33
29
  end
@@ -13,20 +13,26 @@ module Aruba
13
13
  module Api
14
14
  # Command module
15
15
  module Commands
16
- # Resolve path for command using the PATH-environment variable
16
+ # Resolve path for command.
17
+ # - An absolute path resolves to the path itself
18
+ # - A relative path is resolved with respect to the current Aruba working
19
+ # directory
20
+ # - Other paths are resolved using the path
17
21
  #
18
22
  # @param [#to_s] program
19
23
  # The name of the program which should be resolved
20
24
  #
21
25
  # @param [String] path
22
26
  # The PATH, a string concatenated with ":", e.g. /usr/bin/:/bin on a
23
- # UNIX-system
27
+ # UNIX-system, or nil to use the path from the Aruba environment.
24
28
  def which(program, path = nil)
25
29
  with_environment do
26
30
  # ENV is set within this block
27
31
  path = ENV['PATH'] if path.nil?
28
32
 
29
- Aruba.platform.which(program, path)
33
+ in_current_directory do
34
+ Aruba.platform.which(program, path)
35
+ end
30
36
  end
31
37
  end
32
38
 
@@ -131,27 +137,19 @@ module Aruba
131
137
  #
132
138
  # @param [String] cmd
133
139
  # The command which should be executed
134
- #
135
- # @param [Hash] opts
136
- # Options
137
- #
138
- # @option opts [Numeric] exit_timeout
140
+ # @param [Numeric] exit_timeout
139
141
  # If the timeout is reached the command will be killed
140
- #
141
- # @option opts [Numeric] io_wait_timeout
142
+ # @param [Numeric] io_wait_timeout
142
143
  # Wait for IO to finish
143
- #
144
- # @option opts [Numeric] startup_wait_time
144
+ # @param [Numeric] startup_wait_time
145
145
  # Wait for a command to start
146
- #
147
- # @option opts [String] stop_signal
146
+ # @param [String] stop_signal
148
147
  # Use signal to stop command
149
- #
150
148
  # @yield [SpawnProcess]
151
149
  # Run block with process
152
150
  #
153
- def run_command(cmd, opts = {})
154
- command = prepare_command(cmd, opts)
151
+ def run_command(cmd, **)
152
+ command = prepare_command(cmd, **)
155
153
 
156
154
  unless command.interactive?
157
155
  raise NotImplementedError,
@@ -170,27 +168,19 @@ module Aruba
170
168
  #
171
169
  # @param [String] cmd
172
170
  # The command to be executed
173
- #
174
- # @param [Hash] opts
175
- # Options for aruba
176
- #
177
- # @option opts [Boolean] :fail_on_error
171
+ # @param [Boolean] fail_on_error
178
172
  # Should aruba fail on error?
179
- #
180
- # @option opts [Numeric] :exit_timeout
173
+ # @param [Numeric] exit_timeout
181
174
  # Timeout for execution
182
- #
183
- # @option opts [Numeric] :io_wait_timeout
175
+ # @param [Numeric] io_wait_timeout
184
176
  # Timeout for IO - STDERR, STDOUT
177
+ # @param [String] stop_signal
178
+ # Name of signal to send to stop process. E.g. 'HUP'.
179
+ # @param [Numeric] startup_wait_time
180
+ # Timeout for command start-up
185
181
  #
186
- def run_command_and_stop(cmd, opts = {})
187
- fail_on_error = if opts.key?(:fail_on_error)
188
- opts.delete(:fail_on_error) == true
189
- else
190
- true
191
- end
192
-
193
- command = prepare_command(cmd, opts)
182
+ def run_command_and_stop(cmd, fail_on_error: true, **)
183
+ command = prepare_command(cmd, **)
194
184
  start_command(command)
195
185
  command.stop
196
186
 
@@ -223,12 +213,11 @@ module Aruba
223
213
 
224
214
  private
225
215
 
226
- def prepare_command(cmd, opts)
227
- exit_timeout = opts[:exit_timeout] || aruba.config.exit_timeout
228
- io_wait_timeout = opts[:io_wait_timeout] || aruba.config.io_wait_timeout
229
- stop_signal = opts[:stop_signal] || aruba.config.stop_signal
230
- startup_wait_time = opts[:startup_wait_time] || aruba.config.startup_wait_time
231
-
216
+ def prepare_command(cmd,
217
+ exit_timeout: aruba.config.exit_timeout,
218
+ io_wait_timeout: aruba.config.io_wait_timeout,
219
+ stop_signal: aruba.config.stop_signal,
220
+ startup_wait_time: aruba.config.startup_wait_time)
232
221
  @commands ||= []
233
222
  @commands << cmd
234
223
 
@@ -24,17 +24,6 @@ module Aruba
24
24
  @_aruba_runtime ||= Runtime.new
25
25
  end
26
26
 
27
- # Clean the working directory of aruba
28
- #
29
- # This will only clean up aruba's working directory to remove all
30
- # artifacts of your tests. This does NOT clean up the current working
31
- # directory.
32
- def setup_aruba(clobber = true)
33
- Aruba::Setup.new(aruba).call(clobber)
34
-
35
- self
36
- end
37
-
38
27
  # Execute block in Aruba's current directory
39
28
  #
40
29
  # @yield
@@ -154,9 +143,9 @@ module Aruba
154
143
  end
155
144
 
156
145
  unless Aruba.platform.directory? File.join(aruba.config.root_directory,
157
- aruba.config.working_directory)
146
+ aruba.working_directory)
158
147
  raise "Aruba's working directory does not exist. " \
159
- 'Maybe you forgot to run `setup_aruba` before using its API.'
148
+ 'Maybe you forgot to run `aruba.setup` before using its API.'
160
149
  end
161
150
 
162
151
  prefix = file_name[0]
@@ -150,20 +150,16 @@ module Aruba
150
150
 
151
151
  # Create an empty file
152
152
  #
153
- # @param [String] file_name
154
- # The name of the file
155
- def touch(*args)
156
- args = args.flatten
157
-
158
- options = if args.last.is_a? Hash
159
- args.pop
160
- else
161
- {}
162
- end
153
+ # @param [String, Array] list
154
+ # The names of the files
155
+ # @param [Hash] options
156
+ # Options to pass to FileUtils.touch
157
+ def touch(list, **options)
158
+ args = Array(list)
163
159
 
164
160
  args.each { |p| create_directory(File.dirname(p)) }
165
161
 
166
- Aruba.platform.touch(args.map { |p| expand_path(p) }, options)
162
+ Aruba.platform.touch(args.map { |p| expand_path(p) }, **options)
167
163
 
168
164
  self
169
165
  end
@@ -178,11 +174,8 @@ module Aruba
178
174
  # @param [String] destination
179
175
  # A file or directory name. If multiple sources are given the destination
180
176
  # needs to be a directory
181
- def copy(*args)
182
- args = args.flatten
183
- destination = args.pop
184
- source = args
185
-
177
+ def copy(source, destination)
178
+ source = Array(source)
186
179
  source.each do |s|
187
180
  raise ArgumentError, %(The following source "#{s}" does not exist.) unless exist? s
188
181
  end
@@ -221,11 +214,8 @@ module Aruba
221
214
  # @param [String] destination
222
215
  # A file or directory name. If multiple sources are given the destination
223
216
  # needs to be a directory
224
- def move(*args)
225
- args = args.flatten
226
- destination = args.pop
227
- source = args
228
-
217
+ def move(source, destination)
218
+ source = Array(source)
229
219
  source.each do |s|
230
220
  if s.start_with? aruba.config.fixtures_path_prefix
231
221
  raise ArgumentError, "Using a fixture as source (#{source}) is not supported"
@@ -294,22 +284,14 @@ module Aruba
294
284
  #
295
285
  # @param [String] file_name
296
286
  # Name of file to be modified. This file needs to be present to succeed
297
- def chmod(*args)
298
- args = args.flatten
299
-
300
- options = if args.last.is_a? Hash
301
- args.pop
302
- else
303
- {}
304
- end
305
-
306
- mode = args.shift
287
+ def chmod(mode, file_name)
307
288
  mode = mode.to_i(8) if mode.is_a? String
308
289
 
309
- args.each { |path| raise "Expected #{path} to be present" unless exist?(path) }
310
- paths = args.map { |path| expand_path(path) }
290
+ paths = [file_name]
291
+ paths.each { |path| raise "Expected #{path} to be present" unless exist?(path) }
292
+ paths = paths.map { |path| expand_path(path) }
311
293
 
312
- Aruba.platform.chmod(mode, paths, options)
294
+ Aruba.platform.chmod(mode, paths)
313
295
 
314
296
  self
315
297
  end
@@ -362,19 +344,17 @@ module Aruba
362
344
  # Remove file or directory
363
345
  #
364
346
  # @param [Array, String] name
365
- # The name of the file / directory which should be removed
366
- def remove(*args)
367
- args = args.flatten
368
-
369
- options = if args.last.is_a? Hash
370
- args.pop
371
- else
372
- {}
373
- end
347
+ # The name of the file or directory which should be removed,
348
+ # or a list of such names.
349
+ #
350
+ # @param [Hash] options
351
+ # Options to pass to FileUtils.rm_r
352
+ def remove(name, **options)
353
+ args = Array(name)
374
354
 
375
355
  args = args.map { |path| expand_path(path) }
376
356
 
377
- Aruba.platform.rm(args, options)
357
+ Aruba.platform.rm(args, **options)
378
358
  end
379
359
 
380
360
  # Read content of file and yield the content to block
@@ -26,11 +26,14 @@ module Aruba
26
26
  .gsub('\t', "\t")
27
27
  end
28
28
 
29
- # Remove ansi characters from text
29
+ # Remove ansi characters from text. Does nothing if
30
+ # config.remove_ansi_escape_sequences is false
30
31
  #
31
32
  # @param [#to_s] text
32
33
  # Input
33
34
  def extract_text(text)
35
+ return text unless aruba.config.remove_ansi_escape_sequences
36
+
34
37
  text
35
38
  .gsub(/(?:\e|\033)\[\d+(?>(;\d+)*)m/, '')
36
39
  .gsub(/\\\[|\\\]/, '')
@@ -43,7 +46,7 @@ module Aruba
43
46
  # The text to sanitize
44
47
  def sanitize_text(text)
45
48
  text = unescape_text(text)
46
- text = extract_text(text) if aruba.config.remove_ansi_escape_sequences
49
+ text = extract_text(text)
47
50
 
48
51
  text.chomp
49
52
  end
@@ -12,12 +12,9 @@ module Aruba
12
12
 
13
13
  # Create logger
14
14
  #
15
- # @param [Hash] opts
16
- # Options
17
- #
18
- # @option opts [Symbol] :default_mode Log level
19
- def initialize(opts = {})
20
- @mode = opts.fetch(:default_mode, :info)
15
+ # @param [Symbol] default_mode Log level
16
+ def initialize(default_mode: :info)
17
+ @mode = default_mode
21
18
  end
22
19
 
23
20
  # @!method fatal(msg)
@@ -13,13 +13,7 @@ module Aruba
13
13
  attr_reader :default_value
14
14
 
15
15
  # Create option
16
- def initialize(opts = {})
17
- name = opts[:name]
18
- value = opts[:value]
19
-
20
- raise ArgumentError, '"name" is required' unless opts.key? :name
21
- raise ArgumentError, '"value" is required' unless opts.key? :value
22
-
16
+ def initialize(name:, value:)
23
17
  @name = name
24
18
  @value = value
25
19
  @default_value = value