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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +56 -1
- data/CONTRIBUTING.md +11 -23
- data/README.md +1 -2
- data/exe/aruba +2 -2
- data/lib/aruba.rb +1 -1
- data/lib/aruba/api.rb +11 -12
- data/lib/aruba/api/bundler.rb +18 -3
- data/lib/aruba/api/commands.rb +11 -11
- data/lib/aruba/api/core.rb +27 -25
- data/lib/aruba/api/environment.rb +2 -2
- data/lib/aruba/api/filesystem.rb +42 -16
- data/lib/aruba/api/text.rb +4 -4
- data/lib/aruba/aruba_path.rb +3 -4
- data/lib/aruba/basic_configuration.rb +51 -69
- data/lib/aruba/cli.rb +7 -7
- data/lib/aruba/command.rb +4 -4
- data/lib/aruba/config/jruby.rb +9 -9
- data/lib/aruba/config_wrapper.rb +2 -2
- data/lib/aruba/configuration.rb +36 -46
- data/lib/aruba/console.rb +11 -11
- data/lib/aruba/console/help.rb +7 -7
- data/lib/aruba/contracts/absolute_path.rb +1 -1
- data/lib/aruba/contracts/enum.rb +1 -1
- data/lib/aruba/contracts/is_power_of_two.rb +1 -1
- data/lib/aruba/contracts/relative_path.rb +1 -1
- data/lib/aruba/cucumber.rb +7 -7
- data/lib/aruba/cucumber/command.rb +41 -49
- data/lib/aruba/cucumber/environment.rb +7 -7
- data/lib/aruba/cucumber/file.rb +8 -4
- data/lib/aruba/cucumber/hooks.rb +29 -29
- data/lib/aruba/cucumber/testing_frameworks.rb +18 -18
- data/lib/aruba/event_bus.rb +4 -4
- data/lib/aruba/event_bus/name_resolver.rb +4 -4
- data/lib/aruba/file_size.rb +1 -1
- data/lib/aruba/generators/script_file.rb +2 -2
- data/lib/aruba/in_config_wrapper.rb +1 -1
- data/lib/aruba/initializer.rb +10 -10
- data/lib/aruba/matchers/base/base_matcher.rb +1 -1
- data/lib/aruba/matchers/base/message_indenter.rb +2 -2
- data/lib/aruba/matchers/base/object_formatter.rb +2 -2
- data/lib/aruba/matchers/collection.rb +1 -1
- data/lib/aruba/matchers/collection/all.rb +1 -1
- data/lib/aruba/matchers/collection/include_an_object.rb +2 -2
- data/lib/aruba/matchers/command.rb +1 -1
- data/lib/aruba/matchers/command/be_successfully_executed.rb +4 -4
- data/lib/aruba/matchers/command/have_finished_in_time.rb +1 -1
- data/lib/aruba/matchers/command/have_output.rb +1 -1
- data/lib/aruba/matchers/directory.rb +1 -1
- data/lib/aruba/matchers/directory/be_an_existing_directory.rb +2 -2
- data/lib/aruba/matchers/directory/have_sub_directory.rb +3 -3
- data/lib/aruba/matchers/environment.rb +1 -1
- data/lib/aruba/matchers/file.rb +1 -1
- data/lib/aruba/matchers/file/be_a_command_found_in_path.rb +1 -1
- data/lib/aruba/matchers/file/be_an_existing_executable.rb +2 -2
- data/lib/aruba/matchers/file/be_an_existing_file.rb +2 -2
- data/lib/aruba/matchers/file/have_file_content.rb +1 -1
- data/lib/aruba/matchers/file/have_file_size.rb +1 -1
- data/lib/aruba/matchers/file/have_same_file_content.rb +2 -2
- data/lib/aruba/matchers/path.rb +1 -1
- data/lib/aruba/matchers/path/a_path_matching_pattern.rb +1 -1
- data/lib/aruba/matchers/path/be_an_absolute_path.rb +1 -1
- data/lib/aruba/matchers/path/be_an_existing_path.rb +1 -1
- data/lib/aruba/matchers/path/have_permissions.rb +5 -4
- data/lib/aruba/matchers/string.rb +1 -1
- data/lib/aruba/matchers/string/include_output_string.rb +1 -1
- data/lib/aruba/matchers/string/match_output_string.rb +1 -1
- data/lib/aruba/matchers/string/output_string_eq.rb +1 -1
- data/lib/aruba/platform.rb +2 -2
- data/lib/aruba/platforms/announcer.rb +15 -15
- data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +1 -1
- data/lib/aruba/platforms/aruba_logger.rb +11 -10
- data/lib/aruba/platforms/command_monitor.rb +6 -8
- data/lib/aruba/platforms/determine_disk_usage.rb +2 -4
- data/lib/aruba/platforms/filesystem_status.rb +20 -14
- data/lib/aruba/platforms/simple_table.rb +3 -3
- data/lib/aruba/platforms/unix_command_string.rb +2 -2
- data/lib/aruba/platforms/unix_environment_variables.rb +1 -1
- data/lib/aruba/platforms/unix_platform.rb +23 -23
- data/lib/aruba/platforms/unix_which.rb +1 -1
- data/lib/aruba/platforms/windows_command_string.rb +2 -2
- data/lib/aruba/platforms/windows_environment_variables.rb +1 -1
- data/lib/aruba/platforms/windows_platform.rb +7 -7
- data/lib/aruba/platforms/windows_which.rb +5 -5
- data/lib/aruba/processes/basic_process.rb +4 -4
- data/lib/aruba/processes/debug_process.rb +5 -5
- data/lib/aruba/processes/in_process.rb +8 -8
- data/lib/aruba/processes/spawn_process.rb +18 -23
- data/lib/aruba/rspec.rb +6 -6
- data/lib/aruba/runtime.rb +6 -6
- data/lib/aruba/setup.rb +3 -3
- data/lib/aruba/version.rb +1 -1
- metadata +75 -94
- data/.cucumberproignore +0 -3
- data/.document +0 -5
- data/.github/ISSUE_TEMPLATE.md +0 -48
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -41
- data/.gitignore +0 -38
- data/.rspec +0 -3
- data/.rubocop.yml +0 -52
- data/.rubocop_todo.yml +0 -216
- data/.simplecov +0 -36
- data/.travis.yml +0 -62
- data/.yardopts +0 -11
- data/Dockerfile +0 -67
- data/Gemfile +0 -14
- data/Rakefile +0 -82
- data/TODO.md +0 -13
- data/appveyor.yml +0 -28
- data/aruba.gemspec +0 -57
- data/bin/console +0 -7
- data/bin/test +0 -9
- data/config/.gitignore +0 -1
- data/cucumber.yml +0 -6
- data/docker-compose.yml +0 -26
- data/fixtures/cli-app/.gitignore +0 -9
- data/fixtures/cli-app/.rspec +0 -2
- data/fixtures/cli-app/README.md +0 -39
- data/fixtures/cli-app/Rakefile +0 -1
- data/fixtures/cli-app/bin/aruba-test-cli +0 -6
- data/fixtures/cli-app/cli-app.gemspec +0 -26
- data/fixtures/cli-app/features/support/aruba.rb +0 -1
- data/fixtures/cli-app/features/support/env.rb +0 -1
- data/fixtures/cli-app/lib/cli/app.rb +0 -9
- data/fixtures/cli-app/lib/cli/app/suppress_simple_cov_output.rb +0 -15
- data/fixtures/cli-app/lib/cli/app/version.rb +0 -5
- data/fixtures/cli-app/script/console +0 -14
- data/fixtures/cli-app/spec/spec_helper.rb +0 -8
- data/fixtures/cli-app/spec/support/aruba.rb +0 -1
- data/fixtures/copy/file.txt +0 -1
- data/fixtures/empty-app/.gitignore +0 -9
- data/fixtures/empty-app/.rspec +0 -2
- data/fixtures/empty-app/README.md +0 -24
- data/fixtures/empty-app/Rakefile +0 -1
- data/fixtures/empty-app/cli-app.gemspec +0 -26
- data/fixtures/empty-app/lib/cli/app.rb +0 -7
- data/fixtures/empty-app/lib/cli/app/version.rb +0 -5
- data/fixtures/getting-started-app/.gitignore +0 -4
- data/fixtures/getting-started-app/Gemfile +0 -4
- data/fixtures/getting-started-app/README.md +0 -3
- data/fixtures/getting-started-app/features/support/env.rb +0 -1
- data/lib/aruba/extensions/string/strip.rb +0 -25
- data/lib/aruba/tasks/docker_helpers.rb +0 -156
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 447c91b46467e32b757f7ec3edeaacd9ef1f9e5de47d9df4739fffbabee9bb6c
|
4
|
+
data.tar.gz: bdd36a4d52ada46fab83ae3d8647f93a8c5526431572c3a627e5feea072b65d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
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
|
-
|
146
|
-
|
147
|
-
# Alternative: Build with disabled cache
|
148
|
-
bundle exec rake 'docker:build[false]'
|
138
|
+
docker build -t test-aruba .
|
149
139
|
|
150
|
-
#
|
151
|
-
|
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
|
154
|
-
|
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
|
-
|
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
|
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
data/lib/aruba.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require
|
1
|
+
require "aruba/api"
|
data/lib/aruba/api.rb
CHANGED
@@ -1,19 +1,18 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "rspec/expectations"
|
2
|
+
require "shellwords"
|
3
3
|
|
4
|
-
require
|
5
|
-
require 'aruba/extensions/string/strip'
|
4
|
+
require "aruba/version"
|
6
5
|
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
6
|
+
require "aruba/platform"
|
7
|
+
require "aruba/api/core"
|
8
|
+
require "aruba/api/commands"
|
10
9
|
|
11
|
-
require
|
12
|
-
require
|
13
|
-
require
|
14
|
-
require
|
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(
|
15
|
+
Aruba.platform.require_matching_files("../matchers/**/*.rb", __FILE__)
|
17
16
|
|
18
17
|
# Aruba
|
19
18
|
module Aruba
|
data/lib/aruba/api/bundler.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
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
|
-
|
11
|
-
|
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
|
data/lib/aruba/api/commands.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
require
|
1
|
+
require "pathname"
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
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[
|
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,
|
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
|
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
|
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
|
-
|
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.
|
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.
|
268
|
+
aruba.config.run_after_hook(:command, self, command)
|
269
269
|
end
|
270
270
|
end
|
271
271
|
end
|
data/lib/aruba/api/core.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
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
|
42
|
-
cd(
|
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
|
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
|
-
|
82
|
-
|
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
|
-
|
145
|
-
|
146
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
194
|
-
|
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
|