aruba 1.0.2 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +54 -2
- data/CONTRIBUTING.md +18 -22
- data/README.md +7 -8
- data/exe/aruba +2 -2
- data/lib/aruba.rb +1 -1
- data/lib/aruba/api.rb +11 -12
- data/lib/aruba/api/bundler.rb +19 -3
- data/lib/aruba/api/commands.rb +11 -11
- data/lib/aruba/api/core.rb +21 -21
- data/lib/aruba/api/environment.rb +2 -2
- data/lib/aruba/api/filesystem.rb +41 -15
- 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 +7 -3
- 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 +1 -1
- 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 +103 -88
- 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: 310ecfb205a45e39a9822c3d40272f5b1121eaa132ee597589c816b53b478ae2
|
4
|
+
data.tar.gz: 664722acb2e5e82421f25b1a9be77720af6b191935bdc3e177ee4c962697f0fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ddc31e116d5d122e70e4cc95ad0596318ffcfb4955b02b54f64a3800ea6917c461ca0332108e586811931f31253e34cae5ca011f4a7094aa2686f724ff9141a4
|
7
|
+
data.tar.gz: f63cd42a52b764686866d0a9070429830979136927270cd704d47ab7cd5533e656a7fc2b055cbee9d14e3dd8ed27a3ab7c8727a446bee89da9f88ec8e130735a
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,44 @@ 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.2] / 2021-06-20
|
12
|
+
|
13
|
+
* Add Bundler as an explicit runtime dependency ([#810] by [luke-hill])
|
14
|
+
|
15
|
+
## [1.1.1] / 2021-05-14
|
16
|
+
|
17
|
+
* Loosen dependency on the contracts gem ([#804] by [mvz])
|
18
|
+
|
19
|
+
## [1.1.0] / 2021-04-14
|
20
|
+
|
21
|
+
* Add step and API to add whole lines to a file ([#780] by [mvz])
|
22
|
+
* Deprecate file creation when using `append_to_file` ([#781] by [mvz])
|
23
|
+
* Update dependencies to cucumber to allow working with incoming major versions
|
24
|
+
([#801] by [mattwynne])
|
25
|
+
|
26
|
+
## [1.0.4] / 2021-01-04
|
27
|
+
|
28
|
+
* Update rubocop and fix new offenses (various pull requests)
|
29
|
+
* Turn off Cucumber publish warning in CI ([#737] by [olleolleolle])
|
30
|
+
* Move CI from Travis CI to GitHub Actions ([#738] by [mvz])
|
31
|
+
* Remove superfluous :each from before hooks in RSpec-related cucumber
|
32
|
+
scenarios ([#748] by [mvz])
|
33
|
+
* Make disabling Bundler more robust ([#750] by [mvz])
|
34
|
+
* Officially support Ruby 3.0 ([#763] by [mvz])
|
35
|
+
* Clean up hook methods in configuration ([#751] by [mvz])
|
36
|
+
* Speed up RSpec suite ([#767] by [mvz])
|
37
|
+
* Speed up Cucumber suite ([#766] and [#771] by [mvz])
|
38
|
+
* Remove obsolete `String#strip_heredoc` monkey-patch ([#769] by [mvz])
|
39
|
+
* Simplify configuration option specification ([#772] by [mvz])
|
40
|
+
|
41
|
+
## [1.0.3]
|
42
|
+
|
43
|
+
* Loosen Cucumber dependency to allow Cucumber 5.0 ([#727] by [mvz])
|
44
|
+
* Update rubocop and fix new offenses ([#719] and [#724] by [mvz])
|
45
|
+
* Rework gemspec to avoid dependency on git ([#721] by [utkarsh2102], [#725] by [mvz])
|
46
|
+
|
9
47
|
## [1.0.2]
|
10
48
|
|
11
49
|
* Loosen childprocess dependency
|
@@ -936,12 +974,21 @@ Note: These are changes w.r.t. Aruba version 0.14.1.
|
|
936
974
|
[scottj97]: https://github.com/scottj97
|
937
975
|
[stamhankar999]: https://github.com/stamhankar999
|
938
976
|
[taylor]: https://github.com/taylor
|
977
|
+
[utkarsh2102]: https://github.com/utkarsh2102
|
939
978
|
[tdreyno]: https://github.com/tdreyno
|
940
979
|
[xtrasimplicity]: https://github.com/xtrasimplicity
|
941
980
|
[y-higuchi]: https://github.com/y-higuchi
|
942
981
|
|
943
982
|
<!-- issues & pull requests -->
|
944
983
|
|
984
|
+
[#810]: https://github.com/cucumber/aruba/pull/810
|
985
|
+
[#804]: https://github.com/cucumber/aruba/pull/804
|
986
|
+
[#801]: https://github.com/cucumber/aruba/pull/801
|
987
|
+
[#727]: https://github.com/cucumber/aruba/pull/727
|
988
|
+
[#725]: https://github.com/cucumber/aruba/pull/725
|
989
|
+
[#724]: https://github.com/cucumber/aruba/pull/724
|
990
|
+
[#721]: https://github.com/cucumber/aruba/pull/721
|
991
|
+
[#719]: https://github.com/cucumber/aruba/pull/719
|
945
992
|
[#717]: https://github.com/cucumber/aruba/pull/717
|
946
993
|
[#715]: https://github.com/cucumber/aruba/pull/715
|
947
994
|
[#712]: https://github.com/cucumber/aruba/pull/712
|
@@ -1215,7 +1262,12 @@ Note: These are changes w.r.t. Aruba version 0.14.1.
|
|
1215
1262
|
|
1216
1263
|
<!-- Releases -->
|
1217
1264
|
|
1218
|
-
[Unreleased]: https://github.com/cucumber/aruba/compare/v1.
|
1265
|
+
[Unreleased]: https://github.com/cucumber/aruba/compare/v1.1.2...main
|
1266
|
+
[1.1.2]: https://github.com/cucumber/aruba/compare/v1.1.1...v1.1.2
|
1267
|
+
[1.1.1]: https://github.com/cucumber/aruba/compare/v1.1.0...v1.1.1
|
1268
|
+
[1.1.0]: https://github.com/cucumber/aruba/compare/v1.0.4...v1.1.0
|
1269
|
+
[1.0.4]: https://github.com/cucumber/aruba/compare/v1.0.3...v1.0.4
|
1270
|
+
[1.0.3]: https://github.com/cucumber/aruba/compare/v1.0.2...v1.0.3
|
1219
1271
|
[1.0.2]: https://github.com/cucumber/aruba/compare/v1.0.1...v1.0.2
|
1220
1272
|
[1.0.1]: https://github.com/cucumber/aruba/compare/v1.0.0...v1.0.1
|
1221
1273
|
[1.0.0]: https://github.com/cucumber/aruba/compare/v1.0.0.pre.alpha.5...v1.0.0
|
@@ -1318,4 +1370,4 @@ Note: These are changes w.r.t. Aruba version 0.14.1.
|
|
1318
1370
|
|
1319
1371
|
[1]: http://semver.org
|
1320
1372
|
[2]: http://keepachangelog.com
|
1321
|
-
[3]: https://github.com/cucumber/aruba/blob/
|
1373
|
+
[3]: https://github.com/cucumber/aruba/blob/main/CONTRIBUTING.md
|
data/CONTRIBUTING.md
CHANGED
@@ -73,7 +73,7 @@ Please...
|
|
73
73
|
|
74
74
|
* Use pull requests for larger or controversial changes made by yourself or
|
75
75
|
changes you might expected to break the build.
|
76
|
-
* Commit smaller changes directly to
|
76
|
+
* Commit smaller changes directly to `main`, e.g. fixing typos, adding tests or
|
77
77
|
adding documentation.
|
78
78
|
* Update [`CHANGELOG.md`][] when a pull request is merged.
|
79
79
|
* Make sure all tests are green before merging a pull request.
|
@@ -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,22 @@ installed on your local system.
|
|
142
135
|
|
143
136
|
```bash
|
144
137
|
# Build the docker container
|
145
|
-
|
138
|
+
docker build -t test-aruba .
|
146
139
|
|
147
|
-
#
|
148
|
-
|
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
|
149
143
|
|
150
|
-
#
|
151
|
-
bundle exec rake
|
144
|
+
# Run the test suite
|
145
|
+
bundle exec rake
|
146
|
+
```
|
152
147
|
|
153
|
-
|
154
|
-
|
148
|
+
If you want to run the test suite against specific versions of Aruba's
|
149
|
+
dependencies, you can use [appraisal](https://github.com/thoughtbot/appraisal):
|
155
150
|
|
156
|
-
|
157
|
-
|
151
|
+
```bash
|
152
|
+
bundle exec appraisal cucumber_6 bundle install
|
153
|
+
bundle exec appraisal cucumber_6 bundle exec rake
|
158
154
|
```
|
159
155
|
|
160
156
|
### Installing your own gems used for development
|
@@ -218,7 +214,7 @@ Now release it:
|
|
218
214
|
bundle update
|
219
215
|
|
220
216
|
# Run test suite
|
221
|
-
|
217
|
+
bundle exec rake
|
222
218
|
|
223
219
|
# Release gem
|
224
220
|
git commit -m "Version bump"
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/cucumber/aruba/
|
1
|
+
[![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/cucumber/aruba/main/LICENSE)
|
2
2
|
[![Docs](https://img.shields.io/badge/cucumber.pro-aruba-3d10af.svg)](https://app.cucumber.pro/projects/aruba)
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/aruba.svg)](http://badge.fury.io/rb/aruba)
|
4
4
|
[![Code Climate](https://codeclimate.com/github/cucumber/aruba.svg)](https://codeclimate.com/github/cucumber/aruba)
|
@@ -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/main/features/).
|
37
36
|
|
38
37
|
### As a user getting started with a ruby testing framework
|
39
38
|
|
@@ -58,15 +57,15 @@ A full documentation of the API for developers can be found on
|
|
58
57
|
|
59
58
|
## Support
|
60
59
|
|
61
|
-
### Channels
|
62
|
-
|
63
60
|
For support, please have a look at the [support website](https://cucumber.io/support)
|
64
61
|
of Cucumber. You have different options to reach out for help: Recommended for
|
65
62
|
Aruba are using the Slack channels — e.g. `committers-aruba` or `help-cucumber-ruby`
|
66
|
-
— ([register account](https://cucumberbdd-slack-invite.herokuapp.com/))
|
63
|
+
— ([register account](https://cucumberbdd-slack-invite.herokuapp.com/))
|
64
|
+
|
65
|
+
Concrete issues can be reported via the
|
67
66
|
[Issues page on GitHub](https://github.com/cucumber/aruba/issues).
|
68
67
|
|
69
|
-
|
68
|
+
## Maintainers
|
70
69
|
|
71
70
|
Currently, this gem is mainly maintained by this group of people:
|
72
71
|
|
@@ -92,7 +91,7 @@ Please see the [CONTRIBUTING](CONTRIBUTING.md) file.
|
|
92
91
|
|
93
92
|
## Code branches
|
94
93
|
|
95
|
-
Development takes place in the `
|
94
|
+
Development takes place in the `main` branch and currently targets the 1.x
|
96
95
|
releases. If necessary, maintenance of the old 0.14.x releases takes place in
|
97
96
|
the `0-14-stable` branch. Stable branches will not be created until absolutely
|
98
97
|
necessary.
|
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,5 @@
|
|
1
|
-
require
|
1
|
+
require "aruba/api/environment"
|
2
|
+
require "bundler"
|
2
3
|
|
3
4
|
module Aruba
|
4
5
|
module Api
|
@@ -7,8 +8,23 @@ module Aruba
|
|
7
8
|
|
8
9
|
# Unset variables used by bundler
|
9
10
|
def unset_bundler_env_vars
|
10
|
-
|
11
|
-
|
11
|
+
empty_env = with_environment { with_unbundled_env { ENV.to_h } }
|
12
|
+
aruba_env = aruba.environment.to_h
|
13
|
+
(aruba_env.keys - empty_env.keys).each do |key|
|
14
|
+
delete_environment_variable key
|
15
|
+
end
|
16
|
+
empty_env.each do |k, v|
|
17
|
+
set_environment_variable k, v
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def with_unbundled_env(&block)
|
24
|
+
if ::Bundler.respond_to?(:with_unbundled_env)
|
25
|
+
::Bundler.with_unbundled_env(&block)
|
26
|
+
else
|
27
|
+
::Bundler.with_clean_env(&block)
|
12
28
|
end
|
13
29
|
end
|
14
30
|
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)
|
@@ -143,7 +143,7 @@ module Aruba
|
|
143
143
|
def expand_path(file_name, dir_string = nil)
|
144
144
|
unless file_name.is_a?(String) && !file_name.empty?
|
145
145
|
message = "Filename #{file_name} needs to be a string." \
|
146
|
-
|
146
|
+
" It cannot be nil or empty either. "\
|
147
147
|
"Please use `expand_path('.')` if you want the current directory to be expanded."
|
148
148
|
|
149
149
|
raise ArgumentError, message
|
@@ -152,7 +152,7 @@ module Aruba
|
|
152
152
|
unless Aruba.platform.directory? File.join(aruba.config.root_directory,
|
153
153
|
aruba.config.working_directory)
|
154
154
|
raise "Aruba's working directory does not exist." \
|
155
|
-
|
155
|
+
" Maybe you forgot to run `setup_aruba` before using its API."
|
156
156
|
end
|
157
157
|
|
158
158
|
prefix = file_name[0]
|
@@ -162,22 +162,22 @@ module Aruba
|
|
162
162
|
path = File.join(*[aruba.fixtures_directory, rest].compact)
|
163
163
|
unless Aruba.platform.exist? path
|
164
164
|
aruba_fixture_candidates = aruba.config.fixtures_directories
|
165
|
-
.map { |p| format('"%s"', p) }.join(
|
165
|
+
.map { |p| format('"%s"', p) }.join(", ")
|
166
166
|
|
167
167
|
raise ArgumentError,
|
168
168
|
"Fixture \"#{rest}\" does not exist" \
|
169
169
|
" in fixtures directory \"#{aruba.fixtures_directory}\"." \
|
170
|
-
|
170
|
+
" This was the one we found first on your system from all possible" \
|
171
171
|
" candidates: #{aruba_fixture_candidates}."
|
172
172
|
end
|
173
173
|
|
174
174
|
path
|
175
|
-
elsif prefix ==
|
175
|
+
elsif prefix == "~"
|
176
176
|
path = with_environment do
|
177
177
|
File.expand_path(file_name)
|
178
178
|
end
|
179
179
|
|
180
|
-
raise ArgumentError, 'Expanding "~/" to "/" is not allowed' if path ==
|
180
|
+
raise ArgumentError, 'Expanding "~/" to "/" is not allowed' if path == "/"
|
181
181
|
|
182
182
|
unless Aruba.platform.absolute_path? path
|
183
183
|
raise ArgumentError,
|
@@ -192,8 +192,8 @@ module Aruba
|
|
192
192
|
aruba.logger.warn \
|
193
193
|
"Aruba's `expand_path` method was called with an absolute path" \
|
194
194
|
" at #{caller_file_line}, which is not recommended." \
|
195
|
-
|
196
|
-
|
195
|
+
" Change the call to pass a relative path or set "\
|
196
|
+
"`config.allow_absolute_paths = true` to silence this warning"
|
197
197
|
end
|
198
198
|
file_name
|
199
199
|
else
|