aruba 1.0.4 → 1.1.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 +13 -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 -11
- data/lib/aruba/api/bundler.rb +1 -1
- data/lib/aruba/api/commands.rb +7 -7
- data/lib/aruba/api/core.rb +20 -20
- data/lib/aruba/api/environment.rb +2 -2
- data/lib/aruba/api/filesystem.rb +41 -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 +7 -7
- data/lib/aruba/cucumber/command.rb +31 -31
- 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 +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 +22 -22
- 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 +6 -6
- 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 +21 -22
- 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: 9b464d3e65f58bdcafd421ed026c8541de9cc9723258f76175b8b8ad3dab4621
|
4
|
+
data.tar.gz: 2215471629083ac51e4b5e31694ac60408d374f8a0aa504addb79ae70f364e84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2222d8d29dccca2bcbe973512ae24bbdc14a82d2b7dbb3e1fd84b72c35793af4919043cc077bacb2e48db3fbe9c8f60d2c8ed032a36a93d88a0c2ec3ef2e190f
|
7
|
+
data.tar.gz: 007bda65f38b79499f0fda2243f44539c76e541d871cf66b841adafbe1f9a7800946d96c32637264313a24f381f4f97d176a93a02d0e171f1d116d3467b58c19
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,15 @@ 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.0] / 2021-04-14
|
12
|
+
|
13
|
+
* Add step and API to add whole lines to a file ([#780] by [mvz])
|
14
|
+
* Deprecate file creation when using `append_to_file` ([#781] by [mvz])
|
15
|
+
* Update dependencies to cucumber to allow working with incoming major versions
|
16
|
+
([#801] by [mattwynne])
|
17
|
+
|
9
18
|
## [1.0.4] / 2021-01-04
|
10
19
|
|
11
20
|
* Update rubocop and fix new offenses (various pull requests)
|
@@ -964,6 +973,7 @@ Note: These are changes w.r.t. Aruba version 0.14.1.
|
|
964
973
|
|
965
974
|
<!-- issues & pull requests -->
|
966
975
|
|
976
|
+
[#801]: https://github.com/cucumber/aruba/pull/801
|
967
977
|
[#727]: https://github.com/cucumber/aruba/pull/727
|
968
978
|
[#725]: https://github.com/cucumber/aruba/pull/725
|
969
979
|
[#724]: https://github.com/cucumber/aruba/pull/724
|
@@ -1242,7 +1252,9 @@ Note: These are changes w.r.t. Aruba version 0.14.1.
|
|
1242
1252
|
|
1243
1253
|
<!-- Releases -->
|
1244
1254
|
|
1245
|
-
[Unreleased]: https://github.com/cucumber/aruba/compare/v1.0
|
1255
|
+
[Unreleased]: https://github.com/cucumber/aruba/compare/v1.1.0...master
|
1256
|
+
[1.1.0]: https://github.com/cucumber/aruba/compare/v1.0.4...v1.1.0
|
1257
|
+
[1.0.4]: https://github.com/cucumber/aruba/compare/v1.0.3...v1.0.4
|
1246
1258
|
[1.0.3]: https://github.com/cucumber/aruba/compare/v1.0.2...v1.0.3
|
1247
1259
|
[1.0.2]: https://github.com/cucumber/aruba/compare/v1.0.1...v1.0.2
|
1248
1260
|
[1.0.1]: https://github.com/cucumber/aruba/compare/v1.0.0...v1.0.1
|
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,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)
|
@@ -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
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "aruba/platform"
|
2
2
|
|
3
3
|
# Aruba
|
4
4
|
module Aruba
|
@@ -96,7 +96,7 @@ module Aruba
|
|
96
96
|
|
97
97
|
environment_change = { old: old_environment,
|
98
98
|
new: new_environment,
|
99
|
-
changed: { name: name, value:
|
99
|
+
changed: { name: name, value: "" } }
|
100
100
|
aruba.event_bus.notify Events::ChangedEnvironmentVariable.new(environment_change)
|
101
101
|
|
102
102
|
self
|
data/lib/aruba/api/filesystem.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
require
|
1
|
+
require "pathname"
|
2
2
|
|
3
|
-
require
|
3
|
+
require "aruba/platform"
|
4
4
|
|
5
|
-
Aruba.platform.require_matching_files(
|
6
|
-
Aruba.platform.require_matching_files(
|
7
|
-
Aruba.platform.require_matching_files(
|
5
|
+
Aruba.platform.require_matching_files("../matchers/file/*.rb", __FILE__)
|
6
|
+
Aruba.platform.require_matching_files("../matchers/directory/*.rb", __FILE__)
|
7
|
+
Aruba.platform.require_matching_files("../matchers/path/*.rb", __FILE__)
|
8
8
|
|
9
9
|
# Aruba
|
10
10
|
module Aruba
|
@@ -67,7 +67,7 @@ module Aruba
|
|
67
67
|
# @return [Array]
|
68
68
|
# List of files and directories
|
69
69
|
def all_paths
|
70
|
-
list(
|
70
|
+
list(".").map { |path| expand_path(path) }
|
71
71
|
end
|
72
72
|
|
73
73
|
# Return all existing files in current directory
|
@@ -75,7 +75,7 @@ module Aruba
|
|
75
75
|
# @return [Array]
|
76
76
|
# List of files
|
77
77
|
def all_files
|
78
|
-
list(
|
78
|
+
list(".").select { |p| file? p }.map { |p| expand_path(p) }
|
79
79
|
end
|
80
80
|
|
81
81
|
# Return all existing directories in current directory
|
@@ -83,7 +83,7 @@ module Aruba
|
|
83
83
|
# @return [Array]
|
84
84
|
# List of files
|
85
85
|
def all_directories
|
86
|
-
list(
|
86
|
+
list(".").select { |p| directory? p }.map { |p| expand_path(p) }
|
87
87
|
end
|
88
88
|
|
89
89
|
# Create directory object
|
@@ -108,8 +108,8 @@ module Aruba
|
|
108
108
|
%(Only directories are supported. Path "#{name}" is not a directory.)
|
109
109
|
end
|
110
110
|
|
111
|
-
existing_files = Dir.glob(expand_path(File.join(name,
|
112
|
-
current_working_directory = Pathname.new(expand_path(
|
111
|
+
existing_files = Dir.glob(expand_path(File.join(name, "**", "*")))
|
112
|
+
current_working_directory = Pathname.new(expand_path("."))
|
113
113
|
|
114
114
|
existing_files.map do |d|
|
115
115
|
Pathname.new(d).relative_path_from(current_working_directory).to_s
|
@@ -191,7 +191,7 @@ module Aruba
|
|
191
191
|
end
|
192
192
|
|
193
193
|
if source.count > 1 && exist?(destination) && !directory?(destination)
|
194
|
-
raise ArgumentError,
|
194
|
+
raise ArgumentError, "Multiples sources can only be copied to a directory"
|
195
195
|
end
|
196
196
|
|
197
197
|
source_paths = source.map { |f| expand_path(f) }
|
@@ -240,7 +240,7 @@ module Aruba
|
|
240
240
|
end
|
241
241
|
|
242
242
|
if source.count > 1 && exist?(destination) && !directory?(destination)
|
243
|
-
raise ArgumentError,
|
243
|
+
raise ArgumentError, "Multiple sources can only be copied to a directory"
|
244
244
|
end
|
245
245
|
|
246
246
|
source_paths = source.map { |f| expand_path(f) }
|
@@ -326,8 +326,35 @@ module Aruba
|
|
326
326
|
def append_to_file(file_name, file_content)
|
327
327
|
file_name = expand_path(file_name)
|
328
328
|
|
329
|
-
|
330
|
-
|
329
|
+
unless File.exist? file_name
|
330
|
+
Aruba.platform.deprecated("The ability to call #append_to_file with a file that" \
|
331
|
+
" does not exist is deprecated and will be removed in" \
|
332
|
+
" Aruba 2.0.")
|
333
|
+
Aruba.platform.mkdir(File.dirname(file_name))
|
334
|
+
end
|
335
|
+
File.open(file_name, "a") { |f| f << file_content }
|
336
|
+
end
|
337
|
+
|
338
|
+
# Append lines to a (text) file. This will make sure a newline is present
|
339
|
+
# between the old content and the new.
|
340
|
+
#
|
341
|
+
# @param [String] file_name
|
342
|
+
# The name of the file to be used
|
343
|
+
#
|
344
|
+
# @param [String] file_content
|
345
|
+
# The lines which should be appended to file
|
346
|
+
def append_lines_to_file(file_name, file_content)
|
347
|
+
file_name = expand_path(file_name)
|
348
|
+
|
349
|
+
last = File.open(file_name) do |f|
|
350
|
+
f.seek(-3, IO::SEEK_END)
|
351
|
+
f.read
|
352
|
+
end
|
353
|
+
|
354
|
+
File.open(file_name, "a") do |f|
|
355
|
+
f << "\n" unless last.end_with? "\n"
|
356
|
+
f << file_content
|
357
|
+
end
|
331
358
|
end
|
332
359
|
|
333
360
|
# Create a directory in current directory
|