aruba 2.2.0 → 2.3.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 (102) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +77 -47
  3. data/CONTRIBUTING.md +0 -1
  4. data/LICENSE +19 -17
  5. data/README.md +2 -3
  6. data/exe/aruba +3 -2
  7. data/lib/aruba/api/bundler.rb +4 -2
  8. data/lib/aruba/api/commands.rb +10 -8
  9. data/lib/aruba/api/core.rb +33 -31
  10. data/lib/aruba/api/environment.rb +4 -2
  11. data/lib/aruba/api/filesystem.rb +16 -14
  12. data/lib/aruba/api/text.rb +5 -3
  13. data/lib/aruba/api.rb +13 -11
  14. data/lib/aruba/{platforms/aruba_logger.rb → aruba_logger.rb} +4 -2
  15. data/lib/aruba/aruba_path.rb +4 -2
  16. data/lib/aruba/basic_configuration/option.rb +2 -0
  17. data/lib/aruba/basic_configuration.rb +15 -13
  18. data/lib/aruba/cli.rb +10 -8
  19. data/lib/aruba/colorizer.rb +2 -0
  20. data/lib/aruba/command.rb +10 -6
  21. data/lib/aruba/{platforms/command_monitor.rb → command_monitor.rb} +7 -5
  22. data/lib/aruba/config/jruby.rb +11 -9
  23. data/lib/aruba/config_wrapper.rb +4 -2
  24. data/lib/aruba/configuration.rb +17 -15
  25. data/lib/aruba/console/help.rb +7 -5
  26. data/lib/aruba/console.rb +12 -11
  27. data/lib/aruba/contracts/absolute_path.rb +3 -1
  28. data/lib/aruba/contracts/enum.rb +3 -1
  29. data/lib/aruba/contracts/is_power_of_two.rb +4 -2
  30. data/lib/aruba/contracts/relative_path.rb +3 -1
  31. data/lib/aruba/cucumber/command.rb +107 -98
  32. data/lib/aruba/cucumber/environment.rb +9 -7
  33. data/lib/aruba/cucumber/file.rb +4 -2
  34. data/lib/aruba/cucumber/hooks.rb +31 -29
  35. data/lib/aruba/cucumber/parameter_types.rb +4 -1
  36. data/lib/aruba/cucumber/testing_frameworks.rb +20 -18
  37. data/lib/aruba/cucumber.rb +10 -8
  38. data/lib/aruba/errors.rb +2 -6
  39. data/lib/aruba/event_bus.rb +8 -47
  40. data/lib/aruba/events.rb +15 -7
  41. data/lib/aruba/file_size.rb +3 -1
  42. data/lib/aruba/generators/script_file.rb +4 -2
  43. data/lib/aruba/hooks.rb +2 -0
  44. data/lib/aruba/in_config_wrapper.rb +3 -1
  45. data/lib/aruba/initializer.rb +25 -42
  46. data/lib/aruba/matchers/base/message_indenter.rb +3 -1
  47. data/lib/aruba/matchers/command/be_successfully_executed.rb +6 -4
  48. data/lib/aruba/matchers/command/have_exit_status.rb +2 -0
  49. data/lib/aruba/matchers/command/have_finished_in_time.rb +2 -0
  50. data/lib/aruba/matchers/command/have_output.rb +3 -1
  51. data/lib/aruba/matchers/command/have_output_on_stderr.rb +2 -0
  52. data/lib/aruba/matchers/command/have_output_on_stdout.rb +2 -0
  53. data/lib/aruba/matchers/command/have_output_size.rb +21 -5
  54. data/lib/aruba/matchers/command.rb +3 -1
  55. data/lib/aruba/matchers/directory/be_an_existing_directory.rb +3 -1
  56. data/lib/aruba/matchers/directory/have_sub_directory.rb +4 -2
  57. data/lib/aruba/matchers/directory.rb +3 -1
  58. data/lib/aruba/matchers/environment.rb +3 -1
  59. data/lib/aruba/matchers/file/be_a_command_found_in_path.rb +4 -2
  60. data/lib/aruba/matchers/file/be_an_existing_executable.rb +3 -1
  61. data/lib/aruba/matchers/file/be_an_existing_file.rb +3 -1
  62. data/lib/aruba/matchers/file/have_file_content.rb +2 -0
  63. data/lib/aruba/matchers/file/have_file_size.rb +2 -0
  64. data/lib/aruba/matchers/file/have_same_file_content.rb +3 -1
  65. data/lib/aruba/matchers/file.rb +3 -1
  66. data/lib/aruba/matchers/path/a_path_matching_pattern.rb +2 -0
  67. data/lib/aruba/matchers/path/be_an_absolute_path.rb +2 -0
  68. data/lib/aruba/matchers/path/be_an_existing_path.rb +2 -0
  69. data/lib/aruba/matchers/path/have_permissions.rb +3 -1
  70. data/lib/aruba/matchers/path.rb +3 -1
  71. data/lib/aruba/matchers/string/include_output_string.rb +3 -1
  72. data/lib/aruba/matchers/string/match_output_string.rb +3 -1
  73. data/lib/aruba/matchers/string/output_string_eq.rb +3 -1
  74. data/lib/aruba/matchers/string.rb +3 -1
  75. data/lib/aruba/platform.rb +4 -2
  76. data/lib/aruba/platforms/announcer.rb +16 -14
  77. data/lib/aruba/platforms/aruba_file_creator.rb +2 -0
  78. data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +3 -1
  79. data/lib/aruba/platforms/determine_disk_usage.rb +3 -1
  80. data/lib/aruba/platforms/determine_file_size.rb +2 -0
  81. data/lib/aruba/platforms/filesystem_status.rb +3 -1
  82. data/lib/aruba/platforms/local_environment.rb +9 -1
  83. data/lib/aruba/platforms/simple_table.rb +4 -2
  84. data/lib/aruba/platforms/unix_command_string.rb +4 -2
  85. data/lib/aruba/platforms/unix_environment_variables.rb +4 -2
  86. data/lib/aruba/platforms/unix_platform.rb +28 -26
  87. data/lib/aruba/platforms/unix_which.rb +3 -1
  88. data/lib/aruba/platforms/windows_command_string.rb +2 -0
  89. data/lib/aruba/platforms/windows_environment_variables.rb +3 -1
  90. data/lib/aruba/platforms/windows_platform.rb +8 -6
  91. data/lib/aruba/platforms/windows_which.rb +7 -5
  92. data/lib/aruba/processes/basic_process.rb +4 -2
  93. data/lib/aruba/processes/debug_process.rb +8 -6
  94. data/lib/aruba/processes/in_process.rb +11 -8
  95. data/lib/aruba/processes/spawn_process.rb +18 -16
  96. data/lib/aruba/rspec.rb +8 -6
  97. data/lib/aruba/runtime.rb +9 -7
  98. data/lib/aruba/setup.rb +8 -6
  99. data/lib/aruba/version.rb +3 -1
  100. data/lib/aruba.rb +3 -1
  101. metadata +18 -45
  102. 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: 5ecd6da4e86f63a073bffd882d13902780ca69946de8867aa81cba5a8c6ad118
4
- data.tar.gz: f588ff00344ee379a877dbbed442d411769516d8f2f53a164b6a219660e0c38a
3
+ metadata.gz: f338bc365a1305ee655698c0cb89d6b1cc76f1b8662d57fe62ecf5fe9e0e31da
4
+ data.tar.gz: 30840e51c304a2f0219a85e458271d309725298d04d25933649102f5b96d1ac9
5
5
  SHA512:
6
- metadata.gz: d35cd2c9c3d89085f0a04ad2bf2e7b8b83b1cd10cebb87ed39111d0d3feb39b18ad905c5a02e9773881687574abc4b57c5c1d281d7432b746b8f685bd6862f7a
7
- data.tar.gz: cd8bbb1369f18078e3d27a56fb43bef2fc3d25c9b17d81921d30ad759d4c8b16ac5c3a49e7e26e5d19a041df7fcb67da6e978b3c2f79198e22f05b585caa90db
6
+ metadata.gz: 13d02fa92827f6b566a6119f98307943e93b4adee136c1b2555d250a8c5d1a4e8fdfd4efd84097d8c3236010d0f9dd1fdf7fe6c13e227f6a7930a0bd7ff72c8d
7
+ data.tar.gz: 6074a0e15d6621aa25d5061fb18ee6ce486f5bbb6a8c723990a5e9b7d29e633c703071e77d5c31c679ea8fb9e4a3ce432dee5a399e25bccdece9119c98e4e432
data/CHANGELOG.md CHANGED
@@ -6,17 +6,50 @@ 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.0] / 2024-11-22
10
+
11
+ * Allow passing frozen string as argument to `#type` ([#909] by [mikelkew])
12
+ * Prepare for Ruby 3.3 ([#914] by [mvz])
13
+ * Support Ruby 3.0 and up, dropping support for Ruby 2.7 ([#918] by [mvz])
14
+ * Fix minitest setup code ([#921] by [mvz])
15
+ * Make `#have_output_size` work on a process, and deprecate its use with
16
+ strings ([#924] by [mvz])
17
+ * Freeze string literals by default ([#929] by [mvz])
18
+ * Use core cucumber event bus implementation, dropping Aruba's own
19
+ ([#930] by [mvz])
20
+ * Introduce Cucumber parameter type 'command' ([#941] by [mvz])
21
+ * Improve failure messages for two steps ([#943] by [mvz])
22
+
23
+ [mikelkew]: https://github.com/mikelkew
24
+ [#909]: https://github.com/cucumber/aruba/pull/909
25
+ [#914]: https://github.com/cucumber/aruba/pull/914
26
+ [#918]: https://github.com/cucumber/aruba/pull/918
27
+ [#921]: https://github.com/cucumber/aruba/pull/921
28
+ [#924]: https://github.com/cucumber/aruba/pull/924
29
+ [#929]: https://github.com/cucumber/aruba/pull/929
30
+ [#930]: https://github.com/cucumber/aruba/pull/930
31
+ [#941]: https://github.com/cucumber/aruba/pull/941
32
+ [#943]: https://github.com/cucumber/aruba/pull/943
33
+
9
34
  ## [2.2.0] / 2023-09-02
10
35
 
11
36
  * Drop support for Ruby 2.5 ([#836] by [mvz])
12
37
  * Add support for JRuby 9.4 ([#882] by [mvz])
13
38
  * Support CRuby 3.2 ([#883] by [mvz])
14
- * Improve `be_a_command_found_in_path matcher` and its tests ([#895] by [mvz])
39
+ * Improve `be_a_command_found_in_path` matcher and its tests ([#895] by [mvz])
15
40
  * Replace ChildProcess with Process.spawn ([#891] and [#892] by [mvz])
16
41
  * Support Cucumber version 9.0 ([#904] by [mvz])
17
42
  * Drop support for Cucumber 4 through 7 ([#906] by [mvz])
18
43
  * Drop support for Ruby 2.6 ([#907] by [mvz])
19
44
 
45
+ [#904]: https://github.com/cucumber/aruba/pull/904
46
+ [#895]: https://github.com/cucumber/aruba/pull/895
47
+ [#892]: https://github.com/cucumber/aruba/pull/892
48
+ [#891]: https://github.com/cucumber/aruba/pull/891
49
+ [#883]: https://github.com/cucumber/aruba/pull/883
50
+ [#882]: https://github.com/cucumber/aruba/pull/882
51
+ [#836]: https://github.com/cucumber/aruba/pull/836
52
+
20
53
  ## [2.1.0] / 2022-05-20
21
54
 
22
55
  * Support Cucumber 8 ([#870] by [mvz] with [dependabot])
@@ -198,9 +231,9 @@ Other changes
198
231
  * Fix command spawning when spaces occur in the path ([#520] by [mvz])
199
232
  * Make exit in in-process runner behave like real Kernel#exit ([#594] by [grosser])
200
233
  * Improve compatibility with Windows ([#618] by [mvz])
201
- - Upcase ENV keys on Windows
202
- - Properly escape command and arguments on Windows
203
- - Use correct path separator on Windows
234
+ * Upcase ENV keys on Windows
235
+ * Properly escape command and arguments on Windows
236
+ * Use correct path separator on Windows
204
237
 
205
238
  ### Developer experience and internal changes
206
239
 
@@ -309,23 +342,25 @@ Note: These are changes w.r.t. Aruba version 0.14.1.
309
342
  * The use of `@interactive` is discontinued. You need to use
310
343
  `#last_command_started`-method to get access to the interactively started
311
344
  command.
312
- * If multiple commands have been started, each output has to be check
345
+ * If multiple commands have been started, each output has to be checked
313
346
  separately
314
347
 
315
- Scenario: Detect stdout from all processes
316
- When I run `printf "hello world!\n"`
317
- And I run `cat` interactively
318
- And I type "hola"
319
- And I type ""
320
- Then the stdout should contain:
321
- """
322
- hello world!
323
- """
324
- And the stdout should contain:
325
- """
326
- hola
327
- """
328
- And the stderr should not contain anything
348
+ ```
349
+ Scenario: Detect stdout from all processes
350
+ When I run `printf "hello world!\n"`
351
+ And I run `cat` interactively
352
+ And I type "hola"
353
+ And I type ""
354
+ Then the stdout should contain:
355
+ """
356
+ hello world!
357
+ """
358
+ And the stdout should contain:
359
+ """
360
+ hola
361
+ """
362
+ And the stderr should not contain anything
363
+ ```
329
364
 
330
365
  ## [0.14.14]
331
366
 
@@ -429,9 +464,9 @@ Note: These are changes w.r.t. Aruba version 0.14.1.
429
464
 
430
465
  * Add two new hooks for rspec and cucumber to make troubleshooting feature
431
466
  files easier ([#338]):
432
- * `command_content`: Outputs command content - helpful for scripts
433
- * `command_filesystem_status`: Outputs information like group, owner, mode,
434
- atime, mtime
467
+ * `command_content`: Outputs command content - helpful for scripts
468
+ * `command_filesystem_status`: Outputs information like group, owner, mode,
469
+ atime, mtime
435
470
  * Add generator to create ad hoc script file ([#323], [AdrieanKhisbe])
436
471
  * Colored announcer output similar to the color of `cucumber` tags: cyan
437
472
  * Fixed bug in announcer. It announces infomation several times due to
@@ -906,29 +941,31 @@ Note: These are changes w.r.t. Aruba version 0.14.1.
906
941
  * Added aruba.gemspec. ([dchelimsky])
907
942
  * Several step definitions regarding output have changed. ([#1], [aslakhellesoy])
908
943
 
909
- - /^I should see "([^\"]*)"$/
910
- + /^the output should contain "([^"]*)"$/
944
+ ```diff
945
+ - /^I should see "([^\"]*)"$/
946
+ + /^the output should contain "([^"]*)"$/
911
947
 
912
- - /^I should not see "([^\"]*)"$/
913
- + /^the output should not contain "([^"]*)"$/
948
+ - /^I should not see "([^\"]*)"$/
949
+ + /^the output should not contain "([^"]*)"$/
914
950
 
915
- - /^I should see:$/
916
- + /^the output should contain:$/
951
+ - /^I should see:$/
952
+ + /^the output should contain:$/
917
953
 
918
- - /^I should not see:$/
919
- + /^the output should not contain:$/
954
+ - /^I should not see:$/
955
+ + /^the output should not contain:$/
920
956
 
921
- - /^I should see exactly "([^\"]*)"$/
922
- + /^the output should contain exactly "([^"]*)"$/
957
+ - /^I should see exactly "([^\"]*)"$/
958
+ + /^the output should contain exactly "([^"]*)"$/
923
959
 
924
- - /^I should see exactly:$/
925
- + /^the output should contain exactly:$/
960
+ - /^I should see exactly:$/
961
+ + /^the output should contain exactly:$/
926
962
 
927
- - /^I should see matching \/([^\/]*)\/$/
928
- + /^the output should match \/([^\/]*)\/$/
963
+ - /^I should see matching \/([^\/]*)\/$/
964
+ + /^the output should match \/([^\/]*)\/$/
929
965
 
930
- - /^I should see matching:$/
931
- + /^the output should match:$/
966
+ - /^I should see matching:$/
967
+ + /^the output should match:$/
968
+ ```
932
969
 
933
970
  ## [0.1.9]
934
971
 
@@ -1040,14 +1077,6 @@ Note: These are changes w.r.t. Aruba version 0.14.1.
1040
1077
 
1041
1078
  <!-- issues & pull requests -->
1042
1079
 
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
1080
  [#870]: https://github.com/cucumber/aruba/pull/870
1052
1081
  [#867]: https://github.com/cucumber/aruba/pull/867
1053
1082
  [#858]: https://github.com/cucumber/aruba/pull/858
@@ -1357,7 +1386,8 @@ Note: These are changes w.r.t. Aruba version 0.14.1.
1357
1386
 
1358
1387
  <!-- Releases -->
1359
1388
 
1360
- [Unreleased]: https://github.com/cucumber/aruba/compare/v2.2.0...main
1389
+ [Unreleased]: https://github.com/cucumber/aruba/compare/v2.3.0...HEAD
1390
+ [2.3.0]: https://github.com/cucumber/aruba/compare/v2.2.0...v2.3.0
1361
1391
  [2.2.0]: https://github.com/cucumber/aruba/compare/v2.1.0...v2.2.0
1362
1392
  [2.1.0]: https://github.com/cucumber/aruba/compare/v2.0.1...v2.1.0
1363
1393
  [2.0.1]: https://github.com/cucumber/aruba/compare/v2.0.0...v2.0.1
data/CONTRIBUTING.md CHANGED
@@ -161,7 +161,6 @@ your normal development workflow.
161
161
  Example `Gemfile.local`:
162
162
 
163
163
  ```ruby
164
- gem 'pry-byebug'
165
164
  gem 'byebug'
166
165
  ```
167
166
 
data/LICENSE CHANGED
@@ -1,20 +1,22 @@
1
- Copyright (c) 2010-2020 Aslak Hellesøy, David Chelimsky, Mike Sassak, Jarl Friis, Matt Wynne, Dennis Günnewig and Matijs van Zuijlen
1
+ MIT License
2
2
 
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
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
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
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
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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
@@ -8,7 +8,7 @@
8
8
  Add this line to your application's `Gemfile`:
9
9
 
10
10
  ```ruby
11
- gem 'aruba'
11
+ gem 'aruba', '~> 2.3'
12
12
  ```
13
13
 
14
14
  And then execute:
@@ -56,8 +56,7 @@ A full documentation of the API for developers can be found on
56
56
 
57
57
  For support, please have a look at the [support website](https://cucumber.io/support)
58
58
  of Cucumber. You have different options to reach out for help: Recommended for
59
- Aruba are using the Slack channels &mdash; e.g. `committers-aruba` or `help-cucumber-ruby`
60
- &mdash; ([register account](https://cucumberbdd-slack-invite.herokuapp.com/))
59
+ Aruba would be using the [Community Discord](https://github.com/cucumber#get-in-touch).
61
60
 
62
61
  Concrete issues can be reported via the
63
62
  [Issues page on GitHub](https://github.com/cucumber/aruba/issues).
data/exe/aruba CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- $LOAD_PATH << File.expand_path("../lib", __dir__)
4
+ $LOAD_PATH << File.expand_path('../lib', __dir__)
4
5
 
5
- require "aruba/cli"
6
+ require 'aruba/cli'
6
7
 
7
8
  Aruba::Cli.start
@@ -1,5 +1,7 @@
1
- require "aruba/api/environment"
2
- require "bundler"
1
+ # frozen_string_literal: true
2
+
3
+ require 'aruba/api/environment'
4
+ require 'bundler'
3
5
 
4
6
  module Aruba
5
7
  module Api
@@ -1,7 +1,9 @@
1
- require "pathname"
1
+ # frozen_string_literal: true
2
2
 
3
- require "aruba/platform"
4
- require "aruba/command"
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["PATH"] if path.nil?
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, "r").each_line do |line|
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
- "Running interactively is not supported with this process launcher."
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 << "\n")
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)
@@ -1,7 +1,9 @@
1
- require "rspec/expectations"
2
- require "aruba/runtime"
3
- require "aruba/errors"
4
- require "aruba/setup"
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 "." unless directory?(".")
42
- cd(".", &block)
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
- "OLDPWD" => old_dir,
82
- "PWD" => real_new_directory,
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
- " It cannot be nil or empty either." \
148
- " Please use `expand_path('.')` if you want" \
149
- " the current directory to be expanded."
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
- " Maybe you forgot to run `setup_aruba` before using its API."
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
- " in fixtures directory \"#{aruba.fixtures_directory}\"." \
172
- " This was the one we found first on your system from all possible" \
173
- " candidates: #{aruba_fixture_candidates}."
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
- " at #{caller_file_line}, which is not recommended." \
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"
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.with_environment nested_env.to_h, &block
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
- require "aruba/platform"
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
@@ -1,10 +1,12 @@
1
- require "pathname"
1
+ # frozen_string_literal: true
2
2
 
3
- require "aruba/platform"
3
+ require 'pathname'
4
4
 
5
- Aruba.platform.require_matching_files("../matchers/file/*.rb", __FILE__)
6
- Aruba.platform.require_matching_files("../matchers/directory/*.rb", __FILE__)
7
- Aruba.platform.require_matching_files("../matchers/path/*.rb", __FILE__)
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(".").map { |path| expand_path(path) }
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(".").select { |p| file? p }.map { |p| expand_path(p) }
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(".").select { |p| directory? p }.map { |p| expand_path(p) }
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, "Multiples sources can only be copied to a directory"
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, "Multiple sources can only be copied to a directory"
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, "a") { |f| f << file_content }
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, "a") do |f|
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
@@ -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
data/lib/aruba/api.rb CHANGED
@@ -1,18 +1,20 @@
1
- require "rspec/expectations"
2
- require "shellwords"
1
+ # frozen_string_literal: true
3
2
 
4
- require "aruba/version"
3
+ require 'rspec/expectations'
4
+ require 'shellwords'
5
5
 
6
- require "aruba/platform"
7
- require "aruba/api/core"
8
- require "aruba/api/commands"
6
+ require 'aruba/version'
9
7
 
10
- require "aruba/api/environment"
11
- require "aruba/api/filesystem"
12
- require "aruba/api/text"
13
- require "aruba/api/bundler"
8
+ require 'aruba/platform'
9
+ require 'aruba/api/core'
10
+ require 'aruba/api/commands'
14
11
 
15
- Aruba.platform.require_matching_files("../matchers/**/*.rb", __FILE__)
12
+ require 'aruba/api/environment'
13
+ require 'aruba/api/filesystem'
14
+ require 'aruba/api/text'
15
+ require 'aruba/api/bundler'
16
+
17
+ Aruba.platform.require_matching_files('../matchers/**/*.rb', __FILE__)
16
18
 
17
19
  # Aruba
18
20
  module Aruba