aruba 2.2.0 → 2.3.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 +4 -4
- data/CHANGELOG.md +89 -47
- data/CONTRIBUTING.md +0 -1
- data/LICENSE +19 -17
- data/README.md +6 -5
- data/exe/aruba +3 -2
- data/lib/aruba/api/bundler.rb +4 -2
- data/lib/aruba/api/commands.rb +10 -8
- data/lib/aruba/api/core.rb +33 -31
- data/lib/aruba/api/environment.rb +4 -2
- data/lib/aruba/api/filesystem.rb +16 -14
- data/lib/aruba/api/text.rb +5 -3
- data/lib/aruba/api.rb +13 -11
- data/lib/aruba/{platforms/aruba_logger.rb → aruba_logger.rb} +4 -2
- data/lib/aruba/aruba_path.rb +4 -2
- data/lib/aruba/basic_configuration/option.rb +2 -0
- data/lib/aruba/basic_configuration.rb +15 -13
- data/lib/aruba/cli.rb +10 -8
- data/lib/aruba/colorizer.rb +2 -0
- data/lib/aruba/command.rb +10 -6
- data/lib/aruba/{platforms/command_monitor.rb → command_monitor.rb} +7 -5
- data/lib/aruba/config/jruby.rb +11 -9
- data/lib/aruba/config_wrapper.rb +4 -2
- data/lib/aruba/configuration.rb +17 -15
- data/lib/aruba/console/help.rb +7 -5
- data/lib/aruba/console.rb +12 -11
- data/lib/aruba/contracts/absolute_path.rb +3 -1
- data/lib/aruba/contracts/enum.rb +3 -1
- data/lib/aruba/contracts/is_power_of_two.rb +4 -2
- data/lib/aruba/contracts/relative_path.rb +3 -1
- data/lib/aruba/cucumber/command.rb +107 -98
- data/lib/aruba/cucumber/environment.rb +9 -7
- data/lib/aruba/cucumber/file.rb +4 -2
- data/lib/aruba/cucumber/hooks.rb +31 -29
- data/lib/aruba/cucumber/parameter_types.rb +4 -1
- data/lib/aruba/cucumber/testing_frameworks.rb +20 -18
- data/lib/aruba/cucumber.rb +10 -8
- data/lib/aruba/errors.rb +2 -6
- data/lib/aruba/event_bus.rb +8 -47
- data/lib/aruba/events.rb +15 -7
- data/lib/aruba/file_size.rb +3 -1
- data/lib/aruba/generators/script_file.rb +4 -2
- data/lib/aruba/hooks.rb +2 -0
- data/lib/aruba/in_config_wrapper.rb +3 -1
- data/lib/aruba/initializer.rb +25 -42
- data/lib/aruba/matchers/base/message_indenter.rb +3 -1
- data/lib/aruba/matchers/command/be_successfully_executed.rb +6 -4
- data/lib/aruba/matchers/command/have_exit_status.rb +2 -0
- data/lib/aruba/matchers/command/have_finished_in_time.rb +2 -0
- data/lib/aruba/matchers/command/have_output.rb +3 -1
- data/lib/aruba/matchers/command/have_output_on_stderr.rb +2 -0
- data/lib/aruba/matchers/command/have_output_on_stdout.rb +2 -0
- data/lib/aruba/matchers/command/have_output_size.rb +21 -5
- data/lib/aruba/matchers/command.rb +3 -1
- data/lib/aruba/matchers/directory/be_an_existing_directory.rb +3 -1
- data/lib/aruba/matchers/directory/have_sub_directory.rb +4 -2
- data/lib/aruba/matchers/directory.rb +3 -1
- data/lib/aruba/matchers/environment.rb +3 -1
- data/lib/aruba/matchers/file/be_a_command_found_in_path.rb +4 -2
- data/lib/aruba/matchers/file/be_an_existing_executable.rb +3 -1
- data/lib/aruba/matchers/file/be_an_existing_file.rb +3 -1
- data/lib/aruba/matchers/file/have_file_content.rb +2 -0
- data/lib/aruba/matchers/file/have_file_size.rb +2 -0
- data/lib/aruba/matchers/file/have_same_file_content.rb +3 -1
- data/lib/aruba/matchers/file.rb +3 -1
- data/lib/aruba/matchers/path/a_path_matching_pattern.rb +2 -0
- data/lib/aruba/matchers/path/be_an_absolute_path.rb +2 -0
- data/lib/aruba/matchers/path/be_an_existing_path.rb +2 -0
- data/lib/aruba/matchers/path/have_permissions.rb +3 -1
- data/lib/aruba/matchers/path.rb +3 -1
- data/lib/aruba/matchers/string/include_output_string.rb +3 -1
- data/lib/aruba/matchers/string/match_output_string.rb +3 -1
- data/lib/aruba/matchers/string/output_string_eq.rb +3 -1
- data/lib/aruba/matchers/string.rb +3 -1
- data/lib/aruba/platform.rb +4 -2
- data/lib/aruba/platforms/announcer.rb +16 -14
- data/lib/aruba/platforms/aruba_file_creator.rb +2 -0
- data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +3 -1
- data/lib/aruba/platforms/determine_disk_usage.rb +3 -1
- data/lib/aruba/platforms/determine_file_size.rb +2 -0
- data/lib/aruba/platforms/filesystem_status.rb +3 -1
- data/lib/aruba/platforms/local_environment.rb +9 -1
- data/lib/aruba/platforms/simple_table.rb +4 -2
- data/lib/aruba/platforms/unix_command_string.rb +4 -2
- data/lib/aruba/platforms/unix_environment_variables.rb +4 -2
- data/lib/aruba/platforms/unix_platform.rb +28 -26
- data/lib/aruba/platforms/unix_which.rb +3 -1
- data/lib/aruba/platforms/windows_command_string.rb +2 -0
- data/lib/aruba/platforms/windows_environment_variables.rb +3 -1
- data/lib/aruba/platforms/windows_platform.rb +8 -6
- data/lib/aruba/platforms/windows_which.rb +7 -5
- data/lib/aruba/processes/basic_process.rb +4 -2
- data/lib/aruba/processes/debug_process.rb +8 -6
- data/lib/aruba/processes/in_process.rb +11 -8
- data/lib/aruba/processes/spawn_process.rb +18 -16
- data/lib/aruba/rspec.rb +8 -6
- data/lib/aruba/runtime.rb +9 -7
- data/lib/aruba/setup.rb +8 -6
- data/lib/aruba/version.rb +3 -1
- data/lib/aruba.rb +3 -1
- metadata +29 -42
- data/lib/aruba/event_bus/name_resolver.rb +0 -158
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 489603317f21265d108a719429e4d210d38ccc6aa07a27e237837e44c3878a82
|
4
|
+
data.tar.gz: bfbbc2d57481383aefc859fb2014d5644dab731ef3fbb0ba87d6eda2f2e56b17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87b80ec19e672f782ddb6bb3aa7bd242b8bb029c8a72b1502e2a023d3932454161cd6469ef2fe288f3ade44fa252b26925f5853bf8ce95d4a9528f641fd01387
|
7
|
+
data.tar.gz: '070759999d9ca9d11148b43b07400210024b8db091f6d9eea6db8191b2c011ab45b0a6fad08d7cfaa350b44bcfdf7bf3e619e67385019e62681c366864f5fbab'
|
data/CHANGELOG.md
CHANGED
@@ -6,17 +6,62 @@ 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.3.1] / 2025-06-13
|
10
|
+
|
11
|
+
* Remove traces of legacy tag expressions (`~@tag` is now `not @tag`) ([#935]
|
12
|
+
by [luke-hill])
|
13
|
+
* Officially support Ruby 3.4 ([#945] by [mvz])
|
14
|
+
* Support Cucumber 10 ([#951] by [mvz])
|
15
|
+
|
16
|
+
[#935]: https://github.com/cucumber/aruba/pull/935
|
17
|
+
[#945]: https://github.com/cucumber/aruba/pull/945
|
18
|
+
[#951]: https://github.com/cucumber/aruba/pull/951
|
19
|
+
|
20
|
+
## [2.3.0] / 2024-11-22
|
21
|
+
|
22
|
+
* Allow passing frozen string as argument to `#type` ([#909] by [mikelkew])
|
23
|
+
* Prepare for Ruby 3.3 ([#914] by [mvz])
|
24
|
+
* Support Ruby 3.0 and up, dropping support for Ruby 2.7 ([#918] by [mvz])
|
25
|
+
* Fix minitest setup code ([#921] by [mvz])
|
26
|
+
* Make `#have_output_size` work on a process, and deprecate its use with
|
27
|
+
strings ([#924] by [mvz])
|
28
|
+
* Freeze string literals by default ([#929] by [mvz])
|
29
|
+
* Use core cucumber event bus implementation, dropping Aruba's own
|
30
|
+
([#930] by [mvz])
|
31
|
+
* Introduce Cucumber parameter type 'command' ([#941] by [mvz])
|
32
|
+
* Improve failure messages for two steps ([#943] by [mvz])
|
33
|
+
|
34
|
+
[mikelkew]: https://github.com/mikelkew
|
35
|
+
[#909]: https://github.com/cucumber/aruba/pull/909
|
36
|
+
[#914]: https://github.com/cucumber/aruba/pull/914
|
37
|
+
[#918]: https://github.com/cucumber/aruba/pull/918
|
38
|
+
[#921]: https://github.com/cucumber/aruba/pull/921
|
39
|
+
[#924]: https://github.com/cucumber/aruba/pull/924
|
40
|
+
[#929]: https://github.com/cucumber/aruba/pull/929
|
41
|
+
[#930]: https://github.com/cucumber/aruba/pull/930
|
42
|
+
[#941]: https://github.com/cucumber/aruba/pull/941
|
43
|
+
[#943]: https://github.com/cucumber/aruba/pull/943
|
44
|
+
|
9
45
|
## [2.2.0] / 2023-09-02
|
10
46
|
|
11
47
|
* Drop support for Ruby 2.5 ([#836] by [mvz])
|
12
48
|
* Add support for JRuby 9.4 ([#882] by [mvz])
|
13
49
|
* Support CRuby 3.2 ([#883] by [mvz])
|
14
|
-
* Improve `be_a_command_found_in_path matcher
|
50
|
+
* Improve `be_a_command_found_in_path` matcher and its tests ([#895] by [mvz])
|
15
51
|
* Replace ChildProcess with Process.spawn ([#891] and [#892] by [mvz])
|
16
52
|
* Support Cucumber version 9.0 ([#904] by [mvz])
|
17
53
|
* Drop support for Cucumber 4 through 7 ([#906] by [mvz])
|
18
54
|
* Drop support for Ruby 2.6 ([#907] by [mvz])
|
19
55
|
|
56
|
+
[#906]: https://github.com/cucumber/aruba/pull/906
|
57
|
+
[#904]: https://github.com/cucumber/aruba/pull/904
|
58
|
+
[#895]: https://github.com/cucumber/aruba/pull/895
|
59
|
+
[#892]: https://github.com/cucumber/aruba/pull/892
|
60
|
+
[#891]: https://github.com/cucumber/aruba/pull/891
|
61
|
+
[#883]: https://github.com/cucumber/aruba/pull/883
|
62
|
+
[#882]: https://github.com/cucumber/aruba/pull/882
|
63
|
+
[#836]: https://github.com/cucumber/aruba/pull/836
|
64
|
+
|
20
65
|
## [2.1.0] / 2022-05-20
|
21
66
|
|
22
67
|
* Support Cucumber 8 ([#870] by [mvz] with [dependabot])
|
@@ -198,9 +243,9 @@ Other changes
|
|
198
243
|
* Fix command spawning when spaces occur in the path ([#520] by [mvz])
|
199
244
|
* Make exit in in-process runner behave like real Kernel#exit ([#594] by [grosser])
|
200
245
|
* Improve compatibility with Windows ([#618] by [mvz])
|
201
|
-
|
202
|
-
|
203
|
-
|
246
|
+
* Upcase ENV keys on Windows
|
247
|
+
* Properly escape command and arguments on Windows
|
248
|
+
* Use correct path separator on Windows
|
204
249
|
|
205
250
|
### Developer experience and internal changes
|
206
251
|
|
@@ -309,23 +354,25 @@ Note: These are changes w.r.t. Aruba version 0.14.1.
|
|
309
354
|
* The use of `@interactive` is discontinued. You need to use
|
310
355
|
`#last_command_started`-method to get access to the interactively started
|
311
356
|
command.
|
312
|
-
* If multiple commands have been started, each output has to be
|
357
|
+
* If multiple commands have been started, each output has to be checked
|
313
358
|
separately
|
314
359
|
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
360
|
+
```
|
361
|
+
Scenario: Detect stdout from all processes
|
362
|
+
When I run `printf "hello world!\n"`
|
363
|
+
And I run `cat` interactively
|
364
|
+
And I type "hola"
|
365
|
+
And I type ""
|
366
|
+
Then the stdout should contain:
|
367
|
+
"""
|
368
|
+
hello world!
|
369
|
+
"""
|
370
|
+
And the stdout should contain:
|
371
|
+
"""
|
372
|
+
hola
|
373
|
+
"""
|
374
|
+
And the stderr should not contain anything
|
375
|
+
```
|
329
376
|
|
330
377
|
## [0.14.14]
|
331
378
|
|
@@ -429,9 +476,9 @@ Note: These are changes w.r.t. Aruba version 0.14.1.
|
|
429
476
|
|
430
477
|
* Add two new hooks for rspec and cucumber to make troubleshooting feature
|
431
478
|
files easier ([#338]):
|
432
|
-
|
433
|
-
|
434
|
-
|
479
|
+
* `command_content`: Outputs command content - helpful for scripts
|
480
|
+
* `command_filesystem_status`: Outputs information like group, owner, mode,
|
481
|
+
atime, mtime
|
435
482
|
* Add generator to create ad hoc script file ([#323], [AdrieanKhisbe])
|
436
483
|
* Colored announcer output similar to the color of `cucumber` tags: cyan
|
437
484
|
* Fixed bug in announcer. It announces infomation several times due to
|
@@ -906,29 +953,31 @@ Note: These are changes w.r.t. Aruba version 0.14.1.
|
|
906
953
|
* Added aruba.gemspec. ([dchelimsky])
|
907
954
|
* Several step definitions regarding output have changed. ([#1], [aslakhellesoy])
|
908
955
|
|
909
|
-
|
910
|
-
|
956
|
+
```diff
|
957
|
+
- /^I should see "([^\"]*)"$/
|
958
|
+
+ /^the output should contain "([^"]*)"$/
|
911
959
|
|
912
|
-
|
913
|
-
|
960
|
+
- /^I should not see "([^\"]*)"$/
|
961
|
+
+ /^the output should not contain "([^"]*)"$/
|
914
962
|
|
915
|
-
|
916
|
-
|
963
|
+
- /^I should see:$/
|
964
|
+
+ /^the output should contain:$/
|
917
965
|
|
918
|
-
|
919
|
-
|
966
|
+
- /^I should not see:$/
|
967
|
+
+ /^the output should not contain:$/
|
920
968
|
|
921
|
-
|
922
|
-
|
969
|
+
- /^I should see exactly "([^\"]*)"$/
|
970
|
+
+ /^the output should contain exactly "([^"]*)"$/
|
923
971
|
|
924
|
-
|
925
|
-
|
972
|
+
- /^I should see exactly:$/
|
973
|
+
+ /^the output should contain exactly:$/
|
926
974
|
|
927
|
-
|
928
|
-
|
975
|
+
- /^I should see matching \/([^\/]*)\/$/
|
976
|
+
+ /^the output should match \/([^\/]*)\/$/
|
929
977
|
|
930
|
-
|
931
|
-
|
978
|
+
- /^I should see matching:$/
|
979
|
+
+ /^the output should match:$/
|
980
|
+
```
|
932
981
|
|
933
982
|
## [0.1.9]
|
934
983
|
|
@@ -1040,14 +1089,6 @@ Note: These are changes w.r.t. Aruba version 0.14.1.
|
|
1040
1089
|
|
1041
1090
|
<!-- issues & pull requests -->
|
1042
1091
|
|
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
|
-
|
1051
1092
|
[#870]: https://github.com/cucumber/aruba/pull/870
|
1052
1093
|
[#867]: https://github.com/cucumber/aruba/pull/867
|
1053
1094
|
[#858]: https://github.com/cucumber/aruba/pull/858
|
@@ -1357,7 +1398,8 @@ Note: These are changes w.r.t. Aruba version 0.14.1.
|
|
1357
1398
|
|
1358
1399
|
<!-- Releases -->
|
1359
1400
|
|
1360
|
-
[
|
1401
|
+
[2.3.1]: https://github.com/cucumber/aruba/compare/v2.3.0...v2.3.1
|
1402
|
+
[2.3.0]: https://github.com/cucumber/aruba/compare/v2.2.0...v2.3.0
|
1361
1403
|
[2.2.0]: https://github.com/cucumber/aruba/compare/v2.1.0...v2.2.0
|
1362
1404
|
[2.1.0]: https://github.com/cucumber/aruba/compare/v2.0.1...v2.1.0
|
1363
1405
|
[2.0.1]: https://github.com/cucumber/aruba/compare/v2.0.0...v2.0.1
|
data/CONTRIBUTING.md
CHANGED
data/LICENSE
CHANGED
@@ -1,20 +1,22 @@
|
|
1
|
-
|
1
|
+
MIT License
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
3
|
+
Copyright (c) 2010 Aslak Hellesøy, David Chelimsky, Mike Sassak, Jarl Friis, Matt Wynne, Dennis Günnewig and Matijs van Zuijlen
|
4
|
+
Copyright (c) 2020 Cucumber Ltd and contributors
|
10
5
|
|
11
|
-
|
12
|
-
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
14
|
+
copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# Aruba
|
2
|
+
|
1
3
|
[](https://raw.githubusercontent.com/cucumber/aruba/main/LICENSE)
|
2
4
|
[](http://badge.fury.io/rb/aruba)
|
3
5
|
[](https://cucumber.io/support)
|
@@ -8,7 +10,7 @@
|
|
8
10
|
Add this line to your application's `Gemfile`:
|
9
11
|
|
10
12
|
```ruby
|
11
|
-
gem 'aruba'
|
13
|
+
gem 'aruba', '~> 2.3'
|
12
14
|
```
|
13
15
|
|
14
16
|
And then execute:
|
@@ -56,8 +58,7 @@ A full documentation of the API for developers can be found on
|
|
56
58
|
|
57
59
|
For support, please have a look at the [support website](https://cucumber.io/support)
|
58
60
|
of Cucumber. You have different options to reach out for help: Recommended for
|
59
|
-
Aruba
|
60
|
-
— ([register account](https://cucumberbdd-slack-invite.herokuapp.com/))
|
61
|
+
Aruba would be using the [Community Discord](https://github.com/cucumber#get-in-touch).
|
61
62
|
|
62
63
|
Concrete issues can be reported via the
|
63
64
|
[Issues page on GitHub](https://github.com/cucumber/aruba/issues).
|
@@ -77,8 +78,8 @@ bump.
|
|
77
78
|
|
78
79
|
## Supported Ruby versions
|
79
80
|
|
80
|
-
Aruba is supported on Ruby
|
81
|
-
3.
|
81
|
+
Aruba is supported on Ruby 3.0 and up, and tested against CRuby 3.0, 3.1, 3.2,
|
82
|
+
3.3 and 3.4, and JRuby 9.4.
|
82
83
|
|
83
84
|
## Supported Cucumber versions
|
84
85
|
|
data/exe/aruba
CHANGED
data/lib/aruba/api/bundler.rb
CHANGED
data/lib/aruba/api/commands.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
|
3
|
+
require 'pathname'
|
4
|
+
|
5
|
+
require 'aruba/platform'
|
6
|
+
require 'aruba/command'
|
5
7
|
|
6
8
|
# require 'win32/file' if File::ALT_SEPARATOR
|
7
9
|
|
@@ -22,7 +24,7 @@ module Aruba
|
|
22
24
|
def which(program, path = nil)
|
23
25
|
with_environment do
|
24
26
|
# ENV is set within this block
|
25
|
-
path = ENV[
|
27
|
+
path = ENV['PATH'] if path.nil?
|
26
28
|
|
27
29
|
Aruba.platform.which(program, path)
|
28
30
|
end
|
@@ -35,7 +37,7 @@ module Aruba
|
|
35
37
|
def pipe_in_file(file_name)
|
36
38
|
file_name = expand_path(file_name)
|
37
39
|
|
38
|
-
File.open(file_name,
|
40
|
+
File.open(file_name, 'r').each_line do |line|
|
39
41
|
last_command_started.write(line)
|
40
42
|
end
|
41
43
|
end
|
@@ -152,7 +154,7 @@ module Aruba
|
|
152
154
|
|
153
155
|
unless command.interactive?
|
154
156
|
raise NotImplementedError,
|
155
|
-
|
157
|
+
'Running interactively is not supported with this process launcher.'
|
156
158
|
end
|
157
159
|
|
158
160
|
start_command(command)
|
@@ -210,7 +212,7 @@ module Aruba
|
|
210
212
|
def type(input)
|
211
213
|
return close_input if input == "\u0004"
|
212
214
|
|
213
|
-
last_command_started.write(input
|
215
|
+
last_command_started.write("#{input}\n")
|
214
216
|
end
|
215
217
|
|
216
218
|
# Close stdin
|
@@ -230,7 +232,7 @@ module Aruba
|
|
230
232
|
@commands << cmd
|
231
233
|
|
232
234
|
environment = aruba.environment
|
233
|
-
working_directory = expand_path(
|
235
|
+
working_directory = expand_path('.')
|
234
236
|
event_bus = aruba.event_bus
|
235
237
|
|
236
238
|
cmd = Aruba.platform.detect_ruby(cmd)
|
data/lib/aruba/api/core.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
4
|
-
require
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rspec/expectations'
|
4
|
+
require 'aruba/runtime'
|
5
|
+
require 'aruba/errors'
|
6
|
+
require 'aruba/setup'
|
5
7
|
|
6
8
|
# Aruba
|
7
9
|
module Aruba
|
@@ -38,8 +40,8 @@ module Aruba
|
|
38
40
|
# @yield
|
39
41
|
# The block which should be run in current directory
|
40
42
|
def in_current_directory(&block)
|
41
|
-
create_directory
|
42
|
-
cd(
|
43
|
+
create_directory '.' unless directory?('.')
|
44
|
+
cd('.', &block)
|
43
45
|
end
|
44
46
|
|
45
47
|
# Switch to directory
|
@@ -64,9 +66,9 @@ module Aruba
|
|
64
66
|
"#{expand_path(dir)} is not a directory or does not exist."
|
65
67
|
end
|
66
68
|
|
67
|
-
old_directory = expand_path(
|
69
|
+
old_directory = expand_path('.')
|
68
70
|
aruba.current_directory << dir
|
69
|
-
new_directory = expand_path(
|
71
|
+
new_directory = expand_path('.')
|
70
72
|
|
71
73
|
aruba.event_bus.notify Events::ChangedWorkingDirectory.new(old: old_directory,
|
72
74
|
new: new_directory)
|
@@ -78,8 +80,8 @@ module Aruba
|
|
78
80
|
Aruba.platform.chdir real_new_directory
|
79
81
|
|
80
82
|
result = with_environment(
|
81
|
-
|
82
|
-
|
83
|
+
'OLDPWD' => old_dir,
|
84
|
+
'PWD' => real_new_directory,
|
83
85
|
&block
|
84
86
|
)
|
85
87
|
ensure
|
@@ -94,9 +96,9 @@ module Aruba
|
|
94
96
|
raise ArgumentError, "#{expand_path(dir)} is not a directory or does not exist."
|
95
97
|
end
|
96
98
|
|
97
|
-
old_directory = expand_path(
|
99
|
+
old_directory = expand_path('.')
|
98
100
|
aruba.current_directory << dir
|
99
|
-
new_directory = expand_path(
|
101
|
+
new_directory = expand_path('.')
|
100
102
|
|
101
103
|
aruba.event_bus.notify Events::ChangedWorkingDirectory.new(old: old_directory,
|
102
104
|
new: new_directory)
|
@@ -143,18 +145,18 @@ module Aruba
|
|
143
145
|
#
|
144
146
|
def expand_path(file_name, dir_string = nil)
|
145
147
|
unless file_name.is_a?(String) && !file_name.empty?
|
146
|
-
message = "Filename #{file_name} needs to be a string." \
|
147
|
-
|
148
|
-
"
|
149
|
-
|
148
|
+
message = "Filename #{file_name} needs to be a string. " \
|
149
|
+
'It cannot be nil or empty either. ' \
|
150
|
+
"Please use `expand_path('.')` if you want " \
|
151
|
+
'the current directory to be expanded.'
|
150
152
|
|
151
153
|
raise ArgumentError, message
|
152
154
|
end
|
153
155
|
|
154
156
|
unless Aruba.platform.directory? File.join(aruba.config.root_directory,
|
155
157
|
aruba.config.working_directory)
|
156
|
-
raise "Aruba's working directory does not exist." \
|
157
|
-
|
158
|
+
raise "Aruba's working directory does not exist. " \
|
159
|
+
'Maybe you forgot to run `setup_aruba` before using its API.'
|
158
160
|
end
|
159
161
|
|
160
162
|
prefix = file_name[0]
|
@@ -164,22 +166,22 @@ module Aruba
|
|
164
166
|
path = File.join(*[aruba.fixtures_directory, rest].compact)
|
165
167
|
unless Aruba.platform.exist? path
|
166
168
|
aruba_fixture_candidates = aruba.config.fixtures_directories
|
167
|
-
.map { |p| format('"%s"', p) }.join(
|
169
|
+
.map { |p| format('"%s"', p) }.join(', ')
|
168
170
|
|
169
171
|
raise ArgumentError,
|
170
|
-
"Fixture \"#{rest}\" does not exist" \
|
171
|
-
"
|
172
|
-
|
173
|
-
"
|
172
|
+
"Fixture \"#{rest}\" does not exist " \
|
173
|
+
"in fixtures directory \"#{aruba.fixtures_directory}\". " \
|
174
|
+
'This was the one we found first on your system from all possible ' \
|
175
|
+
"candidates: #{aruba_fixture_candidates}."
|
174
176
|
end
|
175
177
|
|
176
178
|
path
|
177
|
-
elsif prefix ==
|
179
|
+
elsif prefix == '~'
|
178
180
|
path = with_environment do
|
179
181
|
File.expand_path(file_name)
|
180
182
|
end
|
181
183
|
|
182
|
-
raise ArgumentError, 'Expanding "~/" to "/" is not allowed' if path ==
|
184
|
+
raise ArgumentError, 'Expanding "~/" to "/" is not allowed' if path == '/'
|
183
185
|
|
184
186
|
unless Aruba.platform.absolute_path? path
|
185
187
|
raise ArgumentError,
|
@@ -192,11 +194,11 @@ module Aruba
|
|
192
194
|
caller_location = caller_locations(1, 1).first
|
193
195
|
caller_file_line = "#{caller_location.path}:#{caller_location.lineno}"
|
194
196
|
message =
|
195
|
-
"Aruba's `expand_path` method was called with an absolute path" \
|
196
|
-
"
|
197
|
-
"
|
198
|
-
|
199
|
-
|
197
|
+
"Aruba's `expand_path` method was called with an absolute path " \
|
198
|
+
"at #{caller_file_line}, which is not recommended. " \
|
199
|
+
"The path passed was '#{file_name}'. " \
|
200
|
+
'Change the call to pass a relative path or set ' \
|
201
|
+
'`config.allow_absolute_paths = true` to silence this warning'
|
200
202
|
raise UserError, message
|
201
203
|
end
|
202
204
|
file_name
|
@@ -219,7 +221,7 @@ module Aruba
|
|
219
221
|
def with_environment(env = {}, &block)
|
220
222
|
aruba.environment.nest do |nested_env|
|
221
223
|
nested_env.update(env)
|
222
|
-
Aruba.platform.
|
224
|
+
Aruba.platform.with_replaced_environment nested_env.to_h, &block
|
223
225
|
end
|
224
226
|
end
|
225
227
|
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'aruba/platform'
|
2
4
|
|
3
5
|
# Aruba
|
4
6
|
module Aruba
|
@@ -96,7 +98,7 @@ module Aruba
|
|
96
98
|
|
97
99
|
environment_change = { old: old_environment,
|
98
100
|
new: new_environment,
|
99
|
-
changed: { name: name, value:
|
101
|
+
changed: { name: name, value: '' } }
|
100
102
|
aruba.event_bus.notify Events::ChangedEnvironmentVariable.new(environment_change)
|
101
103
|
|
102
104
|
self
|
data/lib/aruba/api/filesystem.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require 'pathname'
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
Aruba.platform.require_matching_files(
|
5
|
+
require 'aruba/platform'
|
6
|
+
|
7
|
+
Aruba.platform.require_matching_files('../matchers/file/*.rb', __FILE__)
|
8
|
+
Aruba.platform.require_matching_files('../matchers/directory/*.rb', __FILE__)
|
9
|
+
Aruba.platform.require_matching_files('../matchers/path/*.rb', __FILE__)
|
8
10
|
|
9
11
|
# Aruba
|
10
12
|
module Aruba
|
@@ -67,7 +69,7 @@ module Aruba
|
|
67
69
|
# @return [Array]
|
68
70
|
# List of files and directories
|
69
71
|
def all_paths
|
70
|
-
list(
|
72
|
+
list('.').map { |path| expand_path(path) }
|
71
73
|
end
|
72
74
|
|
73
75
|
# Return all existing files in current directory
|
@@ -75,7 +77,7 @@ module Aruba
|
|
75
77
|
# @return [Array]
|
76
78
|
# List of files
|
77
79
|
def all_files
|
78
|
-
list(
|
80
|
+
list('.').select { |p| file? p }.map { |p| expand_path(p) }
|
79
81
|
end
|
80
82
|
|
81
83
|
# Return all existing directories in current directory
|
@@ -83,7 +85,7 @@ module Aruba
|
|
83
85
|
# @return [Array]
|
84
86
|
# List of files
|
85
87
|
def all_directories
|
86
|
-
list(
|
88
|
+
list('.').select { |p| directory? p }.map { |p| expand_path(p) }
|
87
89
|
end
|
88
90
|
|
89
91
|
# Create directory object
|
@@ -108,8 +110,8 @@ module Aruba
|
|
108
110
|
%(Only directories are supported. Path "#{name}" is not a directory.)
|
109
111
|
end
|
110
112
|
|
111
|
-
existing_files = Dir.glob(expand_path(File.join(name,
|
112
|
-
current_working_directory = Pathname.new(expand_path(
|
113
|
+
existing_files = Dir.glob(expand_path(File.join(name, '**', '*')))
|
114
|
+
current_working_directory = Pathname.new(expand_path('.'))
|
113
115
|
|
114
116
|
existing_files.map do |d|
|
115
117
|
Pathname.new(d).relative_path_from(current_working_directory).to_s
|
@@ -191,7 +193,7 @@ module Aruba
|
|
191
193
|
end
|
192
194
|
|
193
195
|
if source.count > 1 && exist?(destination) && !directory?(destination)
|
194
|
-
raise ArgumentError,
|
196
|
+
raise ArgumentError, 'Multiples sources can only be copied to a directory'
|
195
197
|
end
|
196
198
|
|
197
199
|
source_paths = source.map { |f| expand_path(f) }
|
@@ -240,7 +242,7 @@ module Aruba
|
|
240
242
|
end
|
241
243
|
|
242
244
|
if source.count > 1 && exist?(destination) && !directory?(destination)
|
243
|
-
raise ArgumentError,
|
245
|
+
raise ArgumentError, 'Multiple sources can only be copied to a directory'
|
244
246
|
end
|
245
247
|
|
246
248
|
source_paths = source.map { |f| expand_path(f) }
|
@@ -322,7 +324,7 @@ module Aruba
|
|
322
324
|
def append_to_file(file_name, file_content)
|
323
325
|
file_name = expand_path(file_name)
|
324
326
|
|
325
|
-
File.open(file_name,
|
327
|
+
File.open(file_name, 'a') { |f| f << file_content }
|
326
328
|
end
|
327
329
|
|
328
330
|
# Append lines to a (text) file. This will make sure a newline is present
|
@@ -341,7 +343,7 @@ module Aruba
|
|
341
343
|
f.read
|
342
344
|
end
|
343
345
|
|
344
|
-
File.open(file_name,
|
346
|
+
File.open(file_name, 'a') do |f|
|
345
347
|
f << "\n" unless last.end_with? "\n"
|
346
348
|
f << file_content
|
347
349
|
end
|
data/lib/aruba/api/text.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Aruba
|
2
4
|
module Aruba
|
3
5
|
# Api
|
@@ -30,9 +32,9 @@ module Aruba
|
|
30
32
|
# Input
|
31
33
|
def extract_text(text)
|
32
34
|
text
|
33
|
-
.gsub(/(?:\e|\033)\[\d+(?>(;\d+)*)m/,
|
34
|
-
.gsub(/\\\[|\\\]/,
|
35
|
-
.gsub(/\007|\016|\017/,
|
35
|
+
.gsub(/(?:\e|\033)\[\d+(?>(;\d+)*)m/, '')
|
36
|
+
.gsub(/\\\[|\\\]/, '')
|
37
|
+
.gsub(/\007|\016|\017/, '')
|
36
38
|
end
|
37
39
|
|
38
40
|
# Unescape special characters and remove ANSI characters
|