aruba 1.0.4 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +60 -2
- data/CONTRIBUTING.md +18 -22
- data/README.md +13 -18
- data/exe/aruba +2 -2
- data/lib/aruba.rb +1 -1
- data/lib/aruba/api.rb +11 -11
- data/lib/aruba/api/bundler.rb +2 -1
- data/lib/aruba/api/commands.rb +7 -7
- data/lib/aruba/api/core.rb +33 -29
- data/lib/aruba/api/environment.rb +2 -2
- data/lib/aruba/api/filesystem.rb +35 -14
- data/lib/aruba/api/text.rb +4 -4
- data/lib/aruba/aruba_path.rb +2 -2
- data/lib/aruba/basic_configuration.rb +11 -11
- 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 +14 -14
- data/lib/aruba/console.rb +11 -11
- data/lib/aruba/console/help.rb +5 -5
- 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 +8 -7
- data/lib/aruba/cucumber/command.rb +187 -143
- 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/parameter_types.rb +1 -0
- 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 +5 -5
- 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 +1 -1
- 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 +2 -2
- 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 +14 -14
- data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +1 -1
- data/lib/aruba/platforms/aruba_logger.rb +1 -1
- data/lib/aruba/platforms/command_monitor.rb +5 -5
- data/lib/aruba/platforms/determine_disk_usage.rb +1 -1
- data/lib/aruba/platforms/filesystem_status.rb +1 -1
- data/lib/aruba/platforms/simple_table.rb +1 -1
- data/lib/aruba/platforms/unix_command_string.rb +2 -2
- 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 +2 -2
- data/lib/aruba/platforms/windows_platform.rb +6 -8
- data/lib/aruba/platforms/windows_which.rb +5 -5
- data/lib/aruba/processes/basic_process.rb +2 -2
- data/lib/aruba/processes/debug_process.rb +5 -5
- data/lib/aruba/processes/in_process.rb +7 -7
- data/lib/aruba/processes/spawn_process.rb +17 -22
- 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 -29
- 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: 274e6609a41e03eb74e7fa94a41c6165f5db84e5cff6787c8793afdde8c56cef
|
4
|
+
data.tar.gz: 1252caf02a2a758f334ce58e8da97c21015e7477cfb8266695ae7b54b2db6e57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afa76ddef7027ba2e46f5db09114a9430b520f970ef03a8fb4989ffd383abece8629f20e3ea0ca657037b9a68b1a7cb8fff383342fced0ea4841a204c6b4389d
|
7
|
+
data.tar.gz: c3c7ef6f78b7a67e8a8cb44edd7ca7c72ee5fda00601ceee4eceba5663fb782a575933949b89389242454cef176e6ca89579380943c98a363e76db54fde5ba2c
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,36 @@ 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.0.0] / 2021-07-26
|
10
|
+
|
11
|
+
Potentially breaking changes:
|
12
|
+
|
13
|
+
* Bump miminum cucumber version to 4 ([#814] by [mvz])
|
14
|
+
* Drop support for Ruby 2.4 ([#820] by [mvz])
|
15
|
+
* Remove deprecated ability to append to non-existent file ([#829] by [mvz])
|
16
|
+
* Make absolute file name warning an error ([#783] by [mvz])
|
17
|
+
|
18
|
+
Other changes
|
19
|
+
|
20
|
+
* Use Ruby's built-in windows platform detection ([#813] by [mvz])
|
21
|
+
* Update some step definitions to use Cucumber Expression syntax ([#822] by [mvz])
|
22
|
+
* Update cucumber dependency to allow use of cucumber 7 ([#828] by [dependabot])
|
23
|
+
|
24
|
+
## [1.1.2] / 2021-06-20
|
25
|
+
|
26
|
+
* Add Bundler as an explicit runtime dependency ([#810] by [luke-hill])
|
27
|
+
|
28
|
+
## [1.1.1] / 2021-05-14
|
29
|
+
|
30
|
+
* Loosen dependency on the contracts gem ([#804] by [mvz])
|
31
|
+
|
32
|
+
## [1.1.0] / 2021-04-14
|
33
|
+
|
34
|
+
* Add step and API to add whole lines to a file ([#780] by [mvz])
|
35
|
+
* Deprecate file creation when using `append_to_file` ([#781] by [mvz])
|
36
|
+
* Update dependencies to cucumber to allow working with incoming major versions
|
37
|
+
([#801] by [mattwynne])
|
38
|
+
|
9
39
|
## [1.0.4] / 2021-01-04
|
10
40
|
|
11
41
|
* Update rubocop and fix new offenses (various pull requests)
|
@@ -964,6 +994,29 @@ Note: These are changes w.r.t. Aruba version 0.14.1.
|
|
964
994
|
|
965
995
|
<!-- issues & pull requests -->
|
966
996
|
|
997
|
+
[#829]: https://github.com/cucumber/aruba/pull/829
|
998
|
+
[#828]: https://github.com/cucumber/aruba/pull/828
|
999
|
+
[#822]: https://github.com/cucumber/aruba/pull/822
|
1000
|
+
[#820]: https://github.com/cucumber/aruba/pull/820
|
1001
|
+
[#814]: https://github.com/cucumber/aruba/pull/814
|
1002
|
+
[#813]: https://github.com/cucumber/aruba/pull/813
|
1003
|
+
[#810]: https://github.com/cucumber/aruba/pull/810
|
1004
|
+
[#804]: https://github.com/cucumber/aruba/pull/804
|
1005
|
+
[#801]: https://github.com/cucumber/aruba/pull/801
|
1006
|
+
[#783]: https://github.com/cucumber/aruba/pull/783
|
1007
|
+
[#781]: https://github.com/cucumber/aruba/pull/781
|
1008
|
+
[#780]: https://github.com/cucumber/aruba/pull/780
|
1009
|
+
[#772]: https://github.com/cucumber/aruba/pull/772
|
1010
|
+
[#771]: https://github.com/cucumber/aruba/pull/771
|
1011
|
+
[#769]: https://github.com/cucumber/aruba/pull/769
|
1012
|
+
[#767]: https://github.com/cucumber/aruba/pull/767
|
1013
|
+
[#766]: https://github.com/cucumber/aruba/pull/766
|
1014
|
+
[#763]: https://github.com/cucumber/aruba/pull/763
|
1015
|
+
[#751]: https://github.com/cucumber/aruba/pull/751
|
1016
|
+
[#750]: https://github.com/cucumber/aruba/pull/750
|
1017
|
+
[#748]: https://github.com/cucumber/aruba/pull/748
|
1018
|
+
[#738]: https://github.com/cucumber/aruba/pull/738
|
1019
|
+
[#737]: https://github.com/cucumber/aruba/pull/737
|
967
1020
|
[#727]: https://github.com/cucumber/aruba/pull/727
|
968
1021
|
[#725]: https://github.com/cucumber/aruba/pull/725
|
969
1022
|
[#724]: https://github.com/cucumber/aruba/pull/724
|
@@ -1242,7 +1295,12 @@ Note: These are changes w.r.t. Aruba version 0.14.1.
|
|
1242
1295
|
|
1243
1296
|
<!-- Releases -->
|
1244
1297
|
|
1245
|
-
[Unreleased]: https://github.com/cucumber/aruba/compare/
|
1298
|
+
[Unreleased]: https://github.com/cucumber/aruba/compare/v2.0.0...main
|
1299
|
+
[2.0.0]: https://github.com/cucumber/aruba/compare/v1.1.2...v2.0.0
|
1300
|
+
[1.1.2]: https://github.com/cucumber/aruba/compare/v1.1.1...v1.1.2
|
1301
|
+
[1.1.1]: https://github.com/cucumber/aruba/compare/v1.1.0...v1.1.1
|
1302
|
+
[1.1.0]: https://github.com/cucumber/aruba/compare/v1.0.4...v1.1.0
|
1303
|
+
[1.0.4]: https://github.com/cucumber/aruba/compare/v1.0.3...v1.0.4
|
1246
1304
|
[1.0.3]: https://github.com/cucumber/aruba/compare/v1.0.2...v1.0.3
|
1247
1305
|
[1.0.2]: https://github.com/cucumber/aruba/compare/v1.0.1...v1.0.2
|
1248
1306
|
[1.0.1]: https://github.com/cucumber/aruba/compare/v1.0.0...v1.0.1
|
@@ -1346,4 +1404,4 @@ Note: These are changes w.r.t. Aruba version 0.14.1.
|
|
1346
1404
|
|
1347
1405
|
[1]: http://semver.org
|
1348
1406
|
[2]: http://keepachangelog.com
|
1349
|
-
[3]: https://github.com/cucumber/aruba/blob/
|
1407
|
+
[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,11 +1,7 @@
|
|
1
|
-
[![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/cucumber/aruba/
|
2
|
-
[![Docs](https://img.shields.io/badge/cucumber.pro-aruba-3d10af.svg)](https://app.cucumber.pro/projects/aruba)
|
1
|
+
[![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/cucumber/aruba/main/LICENSE)
|
3
2
|
[![Gem Version](https://badge.fury.io/rb/aruba.svg)](http://badge.fury.io/rb/aruba)
|
4
|
-
[![Code Climate](https://codeclimate.com/github/cucumber/aruba.svg)](https://codeclimate.com/github/cucumber/aruba)
|
5
3
|
[![Support](https://img.shields.io/badge/cucumber-support-orange.svg)](https://cucumber.io/support)
|
6
|
-
|
7
|
-
[![Travis CI build status](https://travis-ci.org/cucumber/aruba.svg)](https://travis-ci.org/cucumber/aruba)
|
8
|
-
[![Appveyor build status](https://ci.appveyor.com/api/projects/status/jfo2tkqhnrqqcivl?svg=true)](https://ci.appveyor.com/project/cucumberbdd/aruba)
|
4
|
+
[![Build Status](https://github.com/cucumber/aruba/actions/workflows/ruby.yml/badge.svg)](https://github.com/cucumber/aruba/actions/workflows/ruby.yml)
|
9
5
|
|
10
6
|
## Install
|
11
7
|
|
@@ -32,8 +28,7 @@ gem install aruba
|
|
32
28
|
### As a user getting started with Aruba
|
33
29
|
|
34
30
|
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.
|
31
|
+
found in [./features/](https://github.com/cucumber/aruba/tree/main/features/).
|
37
32
|
|
38
33
|
### As a user getting started with a ruby testing framework
|
39
34
|
|
@@ -58,15 +53,15 @@ A full documentation of the API for developers can be found on
|
|
58
53
|
|
59
54
|
## Support
|
60
55
|
|
61
|
-
### Channels
|
62
|
-
|
63
56
|
For support, please have a look at the [support website](https://cucumber.io/support)
|
64
57
|
of Cucumber. You have different options to reach out for help: Recommended for
|
65
58
|
Aruba are using the Slack channels — e.g. `committers-aruba` or `help-cucumber-ruby`
|
66
|
-
— ([register account](https://cucumberbdd-slack-invite.herokuapp.com/))
|
59
|
+
— ([register account](https://cucumberbdd-slack-invite.herokuapp.com/))
|
60
|
+
|
61
|
+
Concrete issues can be reported via the
|
67
62
|
[Issues page on GitHub](https://github.com/cucumber/aruba/issues).
|
68
63
|
|
69
|
-
|
64
|
+
## Maintainers
|
70
65
|
|
71
66
|
Currently, this gem is mainly maintained by this group of people:
|
72
67
|
|
@@ -78,8 +73,8 @@ We try to comply with [Semantic Versioning 2.0.0](http://semver.org/spec/v2.0.0.
|
|
78
73
|
|
79
74
|
## Supported Ruby versions
|
80
75
|
|
81
|
-
Aruba is supported on Ruby 2.
|
82
|
-
|
76
|
+
Aruba is supported on Ruby 2.5 and up, and tested against CRuby 2.5, 2.6 and
|
77
|
+
2.7, and JRuby 9.2.
|
83
78
|
|
84
79
|
## Supported operating systems
|
85
80
|
|
@@ -92,10 +87,10 @@ Please see the [CONTRIBUTING](CONTRIBUTING.md) file.
|
|
92
87
|
|
93
88
|
## Code branches
|
94
89
|
|
95
|
-
Development takes place in the `
|
96
|
-
releases. If necessary, maintenance of the old
|
97
|
-
|
98
|
-
necessary.
|
90
|
+
Development takes place in the `main` branch and currently targets the 2.x
|
91
|
+
releases. If necessary, maintenance of the old 1.1.x releases will take place
|
92
|
+
in a `1-1-stable` branch, and of 0.14.x releases in the `0-14-stable` branch.
|
93
|
+
Stable branches will not be created until absolutely necessary.
|
99
94
|
|
100
95
|
## License
|
101
96
|
|
data/exe/aruba
CHANGED
data/lib/aruba.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require
|
1
|
+
require "aruba/api"
|
data/lib/aruba/api.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "rspec/expectations"
|
2
|
+
require "shellwords"
|
3
3
|
|
4
|
-
require
|
4
|
+
require "aruba/version"
|
5
5
|
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
6
|
+
require "aruba/platform"
|
7
|
+
require "aruba/api/core"
|
8
|
+
require "aruba/api/commands"
|
9
9
|
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require
|
13
|
-
require
|
10
|
+
require "aruba/api/environment"
|
11
|
+
require "aruba/api/filesystem"
|
12
|
+
require "aruba/api/text"
|
13
|
+
require "aruba/api/bundler"
|
14
14
|
|
15
|
-
Aruba.platform.require_matching_files(
|
15
|
+
Aruba.platform.require_matching_files("../matchers/**/*.rb", __FILE__)
|
16
16
|
|
17
17
|
# Aruba
|
18
18
|
module Aruba
|
data/lib/aruba/api/bundler.rb
CHANGED
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
|
@@ -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)
|
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
|
@@ -64,9 +64,9 @@ module Aruba
|
|
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)
|
@@ -117,34 +117,36 @@ module Aruba
|
|
117
117
|
#
|
118
118
|
# @example Single file name
|
119
119
|
#
|
120
|
-
# # => <path>/tmp/aruba/file
|
121
120
|
# expand_path('file')
|
121
|
+
# # => <path>/tmp/aruba/file
|
122
122
|
#
|
123
123
|
# @example Single Dot
|
124
124
|
#
|
125
|
-
# # => <path>/tmp/aruba
|
126
125
|
# expand_path('.')
|
126
|
+
# # => <path>/tmp/aruba
|
127
127
|
#
|
128
128
|
# @example using home directory
|
129
129
|
#
|
130
|
-
# # => <path>/home/<name>/file
|
131
130
|
# expand_path('~/file')
|
131
|
+
# # => <path>/home/<name>/file
|
132
132
|
#
|
133
133
|
# @example using fixtures directory
|
134
134
|
#
|
135
|
-
# # => <path>/test/fixtures/file
|
136
135
|
# expand_path('%/file')
|
136
|
+
# # => <path>/test/fixtures/file
|
137
137
|
#
|
138
|
-
# @example Absolute directory
|
138
|
+
# @example Absolute directory (requires aruba.config.allow_absolute_paths
|
139
|
+
# to be set)
|
139
140
|
#
|
140
|
-
# # => /foo/bar
|
141
141
|
# expand_path('/foo/bar')
|
142
|
+
# # => /foo/bar
|
142
143
|
#
|
143
144
|
def expand_path(file_name, dir_string = nil)
|
144
145
|
unless file_name.is_a?(String) && !file_name.empty?
|
145
146
|
message = "Filename #{file_name} needs to be a string." \
|
146
|
-
|
147
|
-
|
147
|
+
" It cannot be nil or empty either."\
|
148
|
+
" Please use `expand_path('.')` if you want" \
|
149
|
+
" the current directory to be expanded."
|
148
150
|
|
149
151
|
raise ArgumentError, message
|
150
152
|
end
|
@@ -152,32 +154,32 @@ module Aruba
|
|
152
154
|
unless Aruba.platform.directory? File.join(aruba.config.root_directory,
|
153
155
|
aruba.config.working_directory)
|
154
156
|
raise "Aruba's working directory does not exist." \
|
155
|
-
|
157
|
+
" Maybe you forgot to run `setup_aruba` before using its API."
|
156
158
|
end
|
157
159
|
|
158
160
|
prefix = file_name[0]
|
159
161
|
|
160
|
-
if aruba.config.fixtures_path_prefix
|
162
|
+
if prefix == aruba.config.fixtures_path_prefix
|
161
163
|
rest = file_name[2..-1]
|
162
164
|
path = File.join(*[aruba.fixtures_directory, rest].compact)
|
163
165
|
unless Aruba.platform.exist? path
|
164
166
|
aruba_fixture_candidates = aruba.config.fixtures_directories
|
165
|
-
.map { |p| format('"%s"', p) }.join(
|
167
|
+
.map { |p| format('"%s"', p) }.join(", ")
|
166
168
|
|
167
169
|
raise ArgumentError,
|
168
170
|
"Fixture \"#{rest}\" does not exist" \
|
169
171
|
" in fixtures directory \"#{aruba.fixtures_directory}\"." \
|
170
|
-
|
172
|
+
" This was the one we found first on your system from all possible" \
|
171
173
|
" candidates: #{aruba_fixture_candidates}."
|
172
174
|
end
|
173
175
|
|
174
176
|
path
|
175
|
-
elsif prefix ==
|
177
|
+
elsif prefix == "~"
|
176
178
|
path = with_environment do
|
177
179
|
File.expand_path(file_name)
|
178
180
|
end
|
179
181
|
|
180
|
-
raise ArgumentError, 'Expanding "~/" to "/" is not allowed' if path ==
|
182
|
+
raise ArgumentError, 'Expanding "~/" to "/" is not allowed' if path == "/"
|
181
183
|
|
182
184
|
unless Aruba.platform.absolute_path? path
|
183
185
|
raise ArgumentError,
|
@@ -189,11 +191,13 @@ module Aruba
|
|
189
191
|
unless aruba.config.allow_absolute_paths
|
190
192
|
caller_location = caller_locations(1, 1).first
|
191
193
|
caller_file_line = "#{caller_location.path}:#{caller_location.lineno}"
|
192
|
-
|
194
|
+
message =
|
193
195
|
"Aruba's `expand_path` method was called with an absolute path" \
|
194
196
|
" at #{caller_file_line}, which is not recommended." \
|
195
|
-
|
196
|
-
|
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"
|
200
|
+
raise UserError, message
|
197
201
|
end
|
198
202
|
file_name
|
199
203
|
else
|