aruba 1.0.1 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +56 -1
  3. data/CONTRIBUTING.md +11 -23
  4. data/README.md +1 -2
  5. data/exe/aruba +2 -2
  6. data/lib/aruba.rb +1 -1
  7. data/lib/aruba/api.rb +11 -12
  8. data/lib/aruba/api/bundler.rb +18 -3
  9. data/lib/aruba/api/commands.rb +11 -11
  10. data/lib/aruba/api/core.rb +27 -25
  11. data/lib/aruba/api/environment.rb +2 -2
  12. data/lib/aruba/api/filesystem.rb +42 -16
  13. data/lib/aruba/api/text.rb +4 -4
  14. data/lib/aruba/aruba_path.rb +3 -4
  15. data/lib/aruba/basic_configuration.rb +51 -69
  16. data/lib/aruba/cli.rb +7 -7
  17. data/lib/aruba/command.rb +4 -4
  18. data/lib/aruba/config/jruby.rb +9 -9
  19. data/lib/aruba/config_wrapper.rb +2 -2
  20. data/lib/aruba/configuration.rb +36 -46
  21. data/lib/aruba/console.rb +11 -11
  22. data/lib/aruba/console/help.rb +7 -7
  23. data/lib/aruba/contracts/absolute_path.rb +1 -1
  24. data/lib/aruba/contracts/enum.rb +1 -1
  25. data/lib/aruba/contracts/is_power_of_two.rb +1 -1
  26. data/lib/aruba/contracts/relative_path.rb +1 -1
  27. data/lib/aruba/cucumber.rb +7 -7
  28. data/lib/aruba/cucumber/command.rb +41 -49
  29. data/lib/aruba/cucumber/environment.rb +7 -7
  30. data/lib/aruba/cucumber/file.rb +8 -4
  31. data/lib/aruba/cucumber/hooks.rb +29 -29
  32. data/lib/aruba/cucumber/testing_frameworks.rb +18 -18
  33. data/lib/aruba/event_bus.rb +4 -4
  34. data/lib/aruba/event_bus/name_resolver.rb +4 -4
  35. data/lib/aruba/file_size.rb +1 -1
  36. data/lib/aruba/generators/script_file.rb +2 -2
  37. data/lib/aruba/in_config_wrapper.rb +1 -1
  38. data/lib/aruba/initializer.rb +10 -10
  39. data/lib/aruba/matchers/base/base_matcher.rb +1 -1
  40. data/lib/aruba/matchers/base/message_indenter.rb +2 -2
  41. data/lib/aruba/matchers/base/object_formatter.rb +2 -2
  42. data/lib/aruba/matchers/collection.rb +1 -1
  43. data/lib/aruba/matchers/collection/all.rb +1 -1
  44. data/lib/aruba/matchers/collection/include_an_object.rb +2 -2
  45. data/lib/aruba/matchers/command.rb +1 -1
  46. data/lib/aruba/matchers/command/be_successfully_executed.rb +4 -4
  47. data/lib/aruba/matchers/command/have_finished_in_time.rb +1 -1
  48. data/lib/aruba/matchers/command/have_output.rb +1 -1
  49. data/lib/aruba/matchers/directory.rb +1 -1
  50. data/lib/aruba/matchers/directory/be_an_existing_directory.rb +2 -2
  51. data/lib/aruba/matchers/directory/have_sub_directory.rb +3 -3
  52. data/lib/aruba/matchers/environment.rb +1 -1
  53. data/lib/aruba/matchers/file.rb +1 -1
  54. data/lib/aruba/matchers/file/be_a_command_found_in_path.rb +1 -1
  55. data/lib/aruba/matchers/file/be_an_existing_executable.rb +2 -2
  56. data/lib/aruba/matchers/file/be_an_existing_file.rb +2 -2
  57. data/lib/aruba/matchers/file/have_file_content.rb +1 -1
  58. data/lib/aruba/matchers/file/have_file_size.rb +1 -1
  59. data/lib/aruba/matchers/file/have_same_file_content.rb +2 -2
  60. data/lib/aruba/matchers/path.rb +1 -1
  61. data/lib/aruba/matchers/path/a_path_matching_pattern.rb +1 -1
  62. data/lib/aruba/matchers/path/be_an_absolute_path.rb +1 -1
  63. data/lib/aruba/matchers/path/be_an_existing_path.rb +1 -1
  64. data/lib/aruba/matchers/path/have_permissions.rb +5 -4
  65. data/lib/aruba/matchers/string.rb +1 -1
  66. data/lib/aruba/matchers/string/include_output_string.rb +1 -1
  67. data/lib/aruba/matchers/string/match_output_string.rb +1 -1
  68. data/lib/aruba/matchers/string/output_string_eq.rb +1 -1
  69. data/lib/aruba/platform.rb +2 -2
  70. data/lib/aruba/platforms/announcer.rb +15 -15
  71. data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +1 -1
  72. data/lib/aruba/platforms/aruba_logger.rb +11 -10
  73. data/lib/aruba/platforms/command_monitor.rb +6 -8
  74. data/lib/aruba/platforms/determine_disk_usage.rb +2 -4
  75. data/lib/aruba/platforms/filesystem_status.rb +20 -14
  76. data/lib/aruba/platforms/simple_table.rb +3 -3
  77. data/lib/aruba/platforms/unix_command_string.rb +2 -2
  78. data/lib/aruba/platforms/unix_environment_variables.rb +1 -1
  79. data/lib/aruba/platforms/unix_platform.rb +23 -23
  80. data/lib/aruba/platforms/unix_which.rb +1 -1
  81. data/lib/aruba/platforms/windows_command_string.rb +2 -2
  82. data/lib/aruba/platforms/windows_environment_variables.rb +1 -1
  83. data/lib/aruba/platforms/windows_platform.rb +7 -7
  84. data/lib/aruba/platforms/windows_which.rb +5 -5
  85. data/lib/aruba/processes/basic_process.rb +4 -4
  86. data/lib/aruba/processes/debug_process.rb +5 -5
  87. data/lib/aruba/processes/in_process.rb +8 -8
  88. data/lib/aruba/processes/spawn_process.rb +18 -23
  89. data/lib/aruba/rspec.rb +6 -6
  90. data/lib/aruba/runtime.rb +6 -6
  91. data/lib/aruba/setup.rb +3 -3
  92. data/lib/aruba/version.rb +1 -1
  93. metadata +75 -94
  94. data/.cucumberproignore +0 -3
  95. data/.document +0 -5
  96. data/.github/ISSUE_TEMPLATE.md +0 -48
  97. data/.github/PULL_REQUEST_TEMPLATE.md +0 -41
  98. data/.gitignore +0 -38
  99. data/.rspec +0 -3
  100. data/.rubocop.yml +0 -52
  101. data/.rubocop_todo.yml +0 -216
  102. data/.simplecov +0 -36
  103. data/.travis.yml +0 -62
  104. data/.yardopts +0 -11
  105. data/Dockerfile +0 -67
  106. data/Gemfile +0 -14
  107. data/Rakefile +0 -82
  108. data/TODO.md +0 -13
  109. data/appveyor.yml +0 -28
  110. data/aruba.gemspec +0 -57
  111. data/bin/console +0 -7
  112. data/bin/test +0 -9
  113. data/config/.gitignore +0 -1
  114. data/cucumber.yml +0 -6
  115. data/docker-compose.yml +0 -26
  116. data/fixtures/cli-app/.gitignore +0 -9
  117. data/fixtures/cli-app/.rspec +0 -2
  118. data/fixtures/cli-app/README.md +0 -39
  119. data/fixtures/cli-app/Rakefile +0 -1
  120. data/fixtures/cli-app/bin/aruba-test-cli +0 -6
  121. data/fixtures/cli-app/cli-app.gemspec +0 -26
  122. data/fixtures/cli-app/features/support/aruba.rb +0 -1
  123. data/fixtures/cli-app/features/support/env.rb +0 -1
  124. data/fixtures/cli-app/lib/cli/app.rb +0 -9
  125. data/fixtures/cli-app/lib/cli/app/suppress_simple_cov_output.rb +0 -15
  126. data/fixtures/cli-app/lib/cli/app/version.rb +0 -5
  127. data/fixtures/cli-app/script/console +0 -14
  128. data/fixtures/cli-app/spec/spec_helper.rb +0 -8
  129. data/fixtures/cli-app/spec/support/aruba.rb +0 -1
  130. data/fixtures/copy/file.txt +0 -1
  131. data/fixtures/empty-app/.gitignore +0 -9
  132. data/fixtures/empty-app/.rspec +0 -2
  133. data/fixtures/empty-app/README.md +0 -24
  134. data/fixtures/empty-app/Rakefile +0 -1
  135. data/fixtures/empty-app/cli-app.gemspec +0 -26
  136. data/fixtures/empty-app/lib/cli/app.rb +0 -7
  137. data/fixtures/empty-app/lib/cli/app/version.rb +0 -5
  138. data/fixtures/getting-started-app/.gitignore +0 -4
  139. data/fixtures/getting-started-app/Gemfile +0 -4
  140. data/fixtures/getting-started-app/README.md +0 -3
  141. data/fixtures/getting-started-app/features/support/env.rb +0 -1
  142. data/lib/aruba/extensions/string/strip.rb +0 -25
  143. data/lib/aruba/tasks/docker_helpers.rb +0 -156
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 78af1111ebd1c66984dd8ad454318e6eba06e183cfd844bcf1e5e794103ea756
4
- data.tar.gz: a4821903017781b016eb1510833e31c9421e79589a69b804d7fab1bc646e8d1c
3
+ metadata.gz: 447c91b46467e32b757f7ec3edeaacd9ef1f9e5de47d9df4739fffbabee9bb6c
4
+ data.tar.gz: bdd36a4d52ada46fab83ae3d8647f93a8c5526431572c3a627e5feea072b65d0
5
5
  SHA512:
6
- metadata.gz: 11b800a1afc27d83cd804685793e1ddc2cba21151b648a2f62ebc4016566d7cacc7c3f9fef578259ed0a00b50dd5ab6d0fd0a45c11f454b88a4648af3b4138e9
7
- data.tar.gz: af2fc428c1fc809e39e87e7060be821a44a5fcba1b3cc131f7334e8ad2a516dc90375aea4d28b13299b51c5147c820a2bc765c936fee5095182b58a1ac1d3de3
6
+ metadata.gz: ab49be0c20ad8e3ec29df0bad0a1f40403f4a7fbd660e6c820b285279f5766ff6f5b964b2b82b01493b047c5a7dd62b4302b0a74a1663911f299ab3c7b3deb03
7
+ data.tar.gz: 8e6982a29ba7e6b3abf1c1a74e2701b901672a13278ddae8b6a108abbfbeb88782e99c4e512c82aee4be7630471307b30c8fe581b18ee0e7386320e7c0c60f11
data/CHANGELOG.md CHANGED
@@ -6,6 +6,47 @@ 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
+ ## [Unreleased]
10
+
11
+ ## [1.1.1] / 2021-05-14
12
+
13
+ * Loosen dependency on the contracts gem ([#804] by [mvz])
14
+
15
+ ## [1.1.0] / 2021-04-14
16
+
17
+ * Add step and API to add whole lines to a file ([#780] by [mvz])
18
+ * Deprecate file creation when using `append_to_file` ([#781] by [mvz])
19
+ * Update dependencies to cucumber to allow working with incoming major versions
20
+ ([#801] by [mattwynne])
21
+
22
+ ## [1.0.4] / 2021-01-04
23
+
24
+ * Update rubocop and fix new offenses (various pull requests)
25
+ * Turn off Cucumber publish warning in CI ([#737] by [olleolleolle])
26
+ * Move CI from Travis CI to GitHub Actions ([#738] by [mvz])
27
+ * Remove superfluous :each from before hooks in RSpec-related cucumber
28
+ scenarios ([#748] by [mvz])
29
+ * Make disabling Bundler more robust ([#750] by [mvz])
30
+ * Officially support Ruby 3.0 ([#763] by [mvz])
31
+ * Clean up hook methods in configuration ([#751] by [mvz])
32
+ * Speed up RSpec suite ([#767] by [mvz])
33
+ * Speed up Cucumber suite ([#766] and [#771] by [mvz])
34
+ * Remove obsolete `String#strip_heredoc` monkey-patch ([#769] by [mvz])
35
+ * Simplify configuration option specification ([#772] by [mvz])
36
+
37
+ ## [1.0.3]
38
+
39
+ * Loosen Cucumber dependency to allow Cucumber 5.0 ([#727] by [mvz])
40
+ * Update rubocop and fix new offenses ([#719] and [#724] by [mvz])
41
+ * Rework gemspec to avoid dependency on git ([#721] by [utkarsh2102], [#725] by [mvz])
42
+
43
+ ## [1.0.2]
44
+
45
+ * Loosen childprocess dependency
46
+ ([00cb0789](https://github.com/cucumber/aruba/commit/00cb07897c9f99e59bea630ae164cf5aa78fa76c)
47
+ by [mvz]).
48
+ * Various small code cleanups ([#717] by [mvz])
49
+
9
50
  ## [1.0.1]
10
51
 
11
52
  ### Bug fixes
@@ -929,12 +970,21 @@ Note: These are changes w.r.t. Aruba version 0.14.1.
929
970
  [scottj97]: https://github.com/scottj97
930
971
  [stamhankar999]: https://github.com/stamhankar999
931
972
  [taylor]: https://github.com/taylor
973
+ [utkarsh2102]: https://github.com/utkarsh2102
932
974
  [tdreyno]: https://github.com/tdreyno
933
975
  [xtrasimplicity]: https://github.com/xtrasimplicity
934
976
  [y-higuchi]: https://github.com/y-higuchi
935
977
 
936
978
  <!-- issues & pull requests -->
937
979
 
980
+ [#804]: https://github.com/cucumber/aruba/pull/804
981
+ [#801]: https://github.com/cucumber/aruba/pull/801
982
+ [#727]: https://github.com/cucumber/aruba/pull/727
983
+ [#725]: https://github.com/cucumber/aruba/pull/725
984
+ [#724]: https://github.com/cucumber/aruba/pull/724
985
+ [#721]: https://github.com/cucumber/aruba/pull/721
986
+ [#719]: https://github.com/cucumber/aruba/pull/719
987
+ [#717]: https://github.com/cucumber/aruba/pull/717
938
988
  [#715]: https://github.com/cucumber/aruba/pull/715
939
989
  [#712]: https://github.com/cucumber/aruba/pull/712
940
990
  [#711]: https://github.com/cucumber/aruba/pull/711
@@ -1207,7 +1257,12 @@ Note: These are changes w.r.t. Aruba version 0.14.1.
1207
1257
 
1208
1258
  <!-- Releases -->
1209
1259
 
1210
- [Unreleased]: https://github.com/cucumber/aruba/compare/v1.0.1...master
1260
+ [Unreleased]: https://github.com/cucumber/aruba/compare/v1.1.1...main
1261
+ [1.1.1]: https://github.com/cucumber/aruba/compare/v1.1.0...v1.1.1
1262
+ [1.1.0]: https://github.com/cucumber/aruba/compare/v1.0.4...v1.1.0
1263
+ [1.0.4]: https://github.com/cucumber/aruba/compare/v1.0.3...v1.0.4
1264
+ [1.0.3]: https://github.com/cucumber/aruba/compare/v1.0.2...v1.0.3
1265
+ [1.0.2]: https://github.com/cucumber/aruba/compare/v1.0.1...v1.0.2
1211
1266
  [1.0.1]: https://github.com/cucumber/aruba/compare/v1.0.0...v1.0.1
1212
1267
  [1.0.0]: https://github.com/cucumber/aruba/compare/v1.0.0.pre.alpha.5...v1.0.0
1213
1268
  [1.0.0.pre.alpha.5]: https://github.com/cucumber/aruba/compare/v1.0.0.pre.alpha.4...v1.0.0.pre.alpha.5
data/CONTRIBUTING.md CHANGED
@@ -118,22 +118,15 @@ bundle install
118
118
 
119
119
  Run the following command to run the test suite.
120
120
 
121
- ```bash
122
- # Run the test suite
123
- bin/test
124
- ```
125
-
126
- Or use these Rake tasks:
127
-
128
121
  ```bash
129
122
  # Run the whole test suite
130
- rake test
123
+ bundle exec rake
131
124
  # Run RSpec tests
132
- rake spec
125
+ bundle exec rake spec
133
126
  # Run Cucumber features
134
- rake cucumber
127
+ bundle exec rake cucumber
135
128
  # Run Cucumber features which are "WORK IN PROGRESS" and are allowed to fail
136
- rake cucumber:wip
129
+ bundle exec rake cucumber:wip
137
130
  ```
138
131
 
139
132
  If you have problems because our assumptions about your local setup are wrong,
@@ -142,19 +135,14 @@ installed on your local system.
142
135
 
143
136
  ```bash
144
137
  # Build the docker container
145
- bundle exec rake docker:build
146
-
147
- # Alternative: Build with disabled cache
148
- bundle exec rake 'docker:build[false]'
138
+ docker build -t test-aruba .
149
139
 
150
- # Build image with version tag
151
- bundle exec rake 'docker:build[false, 0.1.0]'
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
152
143
 
153
- # Run the whole test suite in "docker"-container
154
- RUN_IN_DOCKER=1 bin/test
155
-
156
- # Run only selected scenario
157
- RUN_IN_DOCKER=1 bin/test cucumber features/steps/command/shell.feature:14
144
+ # Run the test suite
145
+ bundle exec rake
158
146
  ```
159
147
 
160
148
  ### Installing your own gems used for development
@@ -218,7 +206,7 @@ Now release it:
218
206
  bundle update
219
207
 
220
208
  # Run test suite
221
- bin/test
209
+ bundle exec rake
222
210
 
223
211
  # Release gem
224
212
  git commit -m "Version bump"
data/README.md CHANGED
@@ -32,8 +32,7 @@ gem install aruba
32
32
  ### As a user getting started with Aruba
33
33
 
34
34
  Our most current documentation to get started with Aruba as a user can be
35
- found on [Cucumber Jam](https://app.cucumber.pro/projects/aruba).
36
- It is generated from our feature files describing the use of Aruba.
35
+ found in [./features/](https://github.com/cucumber/aruba/tree/master/features/).
37
36
 
38
37
  ### As a user getting started with a ruby testing framework
39
38
 
data/exe/aruba CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- $LOAD_PATH << File.expand_path('../lib', __dir__)
3
+ $LOAD_PATH << File.expand_path("../lib", __dir__)
4
4
 
5
- require 'aruba/cli'
5
+ require "aruba/cli"
6
6
 
7
7
  Aruba::Cli.start
data/lib/aruba.rb CHANGED
@@ -1 +1 @@
1
- require 'aruba/api'
1
+ require "aruba/api"
data/lib/aruba/api.rb CHANGED
@@ -1,19 +1,18 @@
1
- require 'rspec/expectations'
2
- require 'shellwords'
1
+ require "rspec/expectations"
2
+ require "shellwords"
3
3
 
4
- require 'aruba/version'
5
- require 'aruba/extensions/string/strip'
4
+ require "aruba/version"
6
5
 
7
- require 'aruba/platform'
8
- require 'aruba/api/core'
9
- require 'aruba/api/commands'
6
+ require "aruba/platform"
7
+ require "aruba/api/core"
8
+ require "aruba/api/commands"
10
9
 
11
- require 'aruba/api/environment'
12
- require 'aruba/api/filesystem'
13
- require 'aruba/api/text'
14
- require 'aruba/api/bundler'
10
+ require "aruba/api/environment"
11
+ require "aruba/api/filesystem"
12
+ require "aruba/api/text"
13
+ require "aruba/api/bundler"
15
14
 
16
- Aruba.platform.require_matching_files('../matchers/**/*.rb', __FILE__)
15
+ Aruba.platform.require_matching_files("../matchers/**/*.rb", __FILE__)
17
16
 
18
17
  # Aruba
19
18
  module Aruba
@@ -1,4 +1,4 @@
1
- require 'aruba/api/environment'
1
+ require "aruba/api/environment"
2
2
 
3
3
  module Aruba
4
4
  module Api
@@ -7,8 +7,23 @@ module Aruba
7
7
 
8
8
  # Unset variables used by bundler
9
9
  def unset_bundler_env_vars
10
- %w(RUBYOPT BUNDLE_PATH BUNDLE_BIN_PATH BUNDLE_GEMFILE).each do |key|
11
- delete_environment_variable(key)
10
+ empty_env = with_environment { with_unbundled_env { ENV.to_h } }
11
+ aruba_env = aruba.environment.to_h
12
+ (aruba_env.keys - empty_env.keys).each do |key|
13
+ delete_environment_variable key
14
+ end
15
+ empty_env.each do |k, v|
16
+ set_environment_variable k, v
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ def with_unbundled_env(&block)
23
+ if ::Bundler.respond_to?(:with_unbundled_env)
24
+ ::Bundler.with_unbundled_env(&block)
25
+ else
26
+ ::Bundler.with_clean_env(&block)
12
27
  end
13
28
  end
14
29
  end
@@ -1,7 +1,7 @@
1
- require 'pathname'
1
+ require "pathname"
2
2
 
3
- require 'aruba/platform'
4
- require 'aruba/command'
3
+ require "aruba/platform"
4
+ require "aruba/command"
5
5
 
6
6
  # require 'win32/file' if File::ALT_SEPARATOR
7
7
 
@@ -22,7 +22,7 @@ module Aruba
22
22
  def which(program, path = nil)
23
23
  with_environment do
24
24
  # ENV is set within this block
25
- path = ENV['PATH'] if path.nil?
25
+ path = ENV["PATH"] if path.nil?
26
26
 
27
27
  Aruba.platform.which(program, path)
28
28
  end
@@ -35,7 +35,7 @@ module Aruba
35
35
  def pipe_in_file(file_name)
36
36
  file_name = expand_path(file_name)
37
37
 
38
- File.open(file_name, 'r').each_line do |line|
38
+ File.open(file_name, "r").each_line do |line|
39
39
  last_command_started.write(line)
40
40
  end
41
41
  end
@@ -64,7 +64,7 @@ module Aruba
64
64
  # If block is given use it to filter the commands which should be
65
65
  # stoppend.
66
66
  def stop_all_commands(&block)
67
- cmds = if block_given?
67
+ cmds = if block
68
68
  all_commands.select(&block)
69
69
  else
70
70
  all_commands
@@ -81,7 +81,7 @@ module Aruba
81
81
  # If block is given use it to filter the commands which should be
82
82
  # terminated.
83
83
  def terminate_all_commands(&block)
84
- cmds = if block_given?
84
+ cmds = if block
85
85
  all_commands.select(&block)
86
86
  else
87
87
  all_commands
@@ -152,7 +152,7 @@ module Aruba
152
152
 
153
153
  unless command.interactive?
154
154
  raise NotImplementedError,
155
- 'Running interactively is not supported with this process launcher.'
155
+ "Running interactively is not supported with this process launcher."
156
156
  end
157
157
 
158
158
  start_command(command)
@@ -232,7 +232,7 @@ module Aruba
232
232
  @commands << cmd
233
233
 
234
234
  environment = aruba.environment
235
- working_directory = expand_path('.')
235
+ working_directory = expand_path(".")
236
236
  event_bus = aruba.event_bus
237
237
 
238
238
  cmd = Aruba.platform.detect_ruby(cmd)
@@ -256,7 +256,7 @@ module Aruba
256
256
  end
257
257
 
258
258
  def start_command(command)
259
- aruba.config.before(:command, self, command)
259
+ aruba.config.run_before_hook(:command, self, command)
260
260
 
261
261
  in_current_directory do
262
262
  command.start
@@ -265,7 +265,7 @@ module Aruba
265
265
  stop_signal = command.stop_signal
266
266
  aruba.announcer.announce(:stop_signal, command.pid, stop_signal) if stop_signal
267
267
 
268
- aruba.config.after(:command, self, command)
268
+ aruba.config.run_after_hook(:command, self, command)
269
269
  end
270
270
  end
271
271
  end
@@ -1,7 +1,7 @@
1
- require 'rspec/expectations'
2
- require 'aruba/runtime'
3
- require 'aruba/errors'
4
- require 'aruba/setup'
1
+ require "rspec/expectations"
2
+ require "aruba/runtime"
3
+ require "aruba/errors"
4
+ require "aruba/setup"
5
5
 
6
6
  # Aruba
7
7
  module Aruba
@@ -38,8 +38,8 @@ module Aruba
38
38
  # @yield
39
39
  # The block which should be run in current directory
40
40
  def in_current_directory(&block)
41
- create_directory '.' unless directory?('.')
42
- cd('.', &block)
41
+ create_directory "." unless directory?(".")
42
+ cd(".", &block)
43
43
  end
44
44
 
45
45
  # Switch to directory
@@ -57,16 +57,16 @@ module Aruba
57
57
  # result = cd('some-dir') { Dir.getwd }
58
58
  #
59
59
  def cd(dir, &block)
60
- if block_given?
60
+ if block
61
61
  begin
62
62
  unless Aruba.platform.directory?(expand_path(dir))
63
63
  raise ArgumentError,
64
64
  "#{expand_path(dir)} is not a directory or does not exist."
65
65
  end
66
66
 
67
- old_directory = expand_path('.')
67
+ old_directory = expand_path(".")
68
68
  aruba.current_directory << dir
69
- new_directory = expand_path('.')
69
+ new_directory = expand_path(".")
70
70
 
71
71
  aruba.event_bus.notify Events::ChangedWorkingDirectory.new(old: old_directory,
72
72
  new: new_directory)
@@ -78,8 +78,8 @@ module Aruba
78
78
  Aruba.platform.chdir real_new_directory
79
79
 
80
80
  result = with_environment(
81
- 'OLDPWD' => old_dir,
82
- 'PWD' => real_new_directory,
81
+ "OLDPWD" => old_dir,
82
+ "PWD" => real_new_directory,
83
83
  &block
84
84
  )
85
85
  ensure
@@ -94,9 +94,9 @@ module Aruba
94
94
  raise ArgumentError, "#{expand_path(dir)} is not a directory or does not exist."
95
95
  end
96
96
 
97
- old_directory = expand_path('.')
97
+ old_directory = expand_path(".")
98
98
  aruba.current_directory << dir
99
- new_directory = expand_path('.')
99
+ new_directory = expand_path(".")
100
100
 
101
101
  aruba.event_bus.notify Events::ChangedWorkingDirectory.new(old: old_directory,
102
102
  new: new_directory)
@@ -141,41 +141,43 @@ module Aruba
141
141
  # expand_path('/foo/bar')
142
142
  #
143
143
  def expand_path(file_name, dir_string = nil)
144
- message = "Filename #{file_name} needs to be a string." \
145
- ' It cannot be nil or empty either. '\
146
- "Please use `expand_path('.')` if you want the current directory to be expanded."
144
+ unless file_name.is_a?(String) && !file_name.empty?
145
+ message = "Filename #{file_name} needs to be a string." \
146
+ " It cannot be nil or empty either. "\
147
+ "Please use `expand_path('.')` if you want the current directory to be expanded."
147
148
 
148
- raise ArgumentError, message unless file_name.is_a?(String) && !file_name.empty?
149
+ raise ArgumentError, message
150
+ end
149
151
 
150
152
  unless Aruba.platform.directory? File.join(aruba.config.root_directory,
151
153
  aruba.config.working_directory)
152
154
  raise "Aruba's working directory does not exist." \
153
- ' Maybe you forgot to run `setup_aruba` before using its API.'
155
+ " Maybe you forgot to run `setup_aruba` before using its API."
154
156
  end
155
157
 
156
158
  prefix = file_name[0]
157
- rest = file_name[2..-1]
158
159
 
159
160
  if aruba.config.fixtures_path_prefix == prefix
161
+ rest = file_name[2..-1]
160
162
  path = File.join(*[aruba.fixtures_directory, rest].compact)
161
163
  unless Aruba.platform.exist? path
162
164
  aruba_fixture_candidates = aruba.config.fixtures_directories
163
- .map { |p| format('"%s"', p) }.join(', ')
165
+ .map { |p| format('"%s"', p) }.join(", ")
164
166
 
165
167
  raise ArgumentError,
166
168
  "Fixture \"#{rest}\" does not exist" \
167
169
  " in fixtures directory \"#{aruba.fixtures_directory}\"." \
168
- ' This was the one we found first on your system from all possible' \
170
+ " This was the one we found first on your system from all possible" \
169
171
  " candidates: #{aruba_fixture_candidates}."
170
172
  end
171
173
 
172
174
  path
173
- elsif prefix == '~'
175
+ elsif prefix == "~"
174
176
  path = with_environment do
175
177
  File.expand_path(file_name)
176
178
  end
177
179
 
178
- raise ArgumentError, 'Expanding "~/" to "/" is not allowed' if path == '/'
180
+ raise ArgumentError, 'Expanding "~/" to "/" is not allowed' if path == "/"
179
181
 
180
182
  unless Aruba.platform.absolute_path? path
181
183
  raise ArgumentError,
@@ -190,8 +192,8 @@ module Aruba
190
192
  aruba.logger.warn \
191
193
  "Aruba's `expand_path` method was called with an absolute path" \
192
194
  " at #{caller_file_line}, which is not recommended." \
193
- ' Change the call to pass a relative path or set '\
194
- '`config.allow_absolute_paths = true` to silence this warning'
195
+ " Change the call to pass a relative path or set "\
196
+ "`config.allow_absolute_paths = true` to silence this warning"
195
197
  end
196
198
  file_name
197
199
  else