aruba 1.0.0.pre.alpha.4 → 1.0.0.pre.alpha.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +0 -1
- data/.rubocop.yml +19 -1
- data/.rubocop_todo.yml +10 -116
- data/.travis.yml +24 -26
- data/CHANGELOG.md +112 -19
- data/CONTRIBUTING.md +7 -7
- data/Gemfile +2 -50
- data/Rakefile +20 -37
- data/appveyor.yml +3 -5
- data/aruba.gemspec +16 -6
- data/bin/console +1 -1
- data/cucumber.yml +4 -15
- data/exe/aruba +1 -1
- data/fixtures/cli-app/bin/aruba-test-cli +1 -1
- data/fixtures/cli-app/cli-app.gemspec +1 -3
- data/fixtures/cli-app/lib/cli/app.rb +1 -1
- data/fixtures/cli-app/spec/spec_helper.rb +1 -1
- data/fixtures/empty-app/cli-app.gemspec +1 -3
- data/fixtures/empty-app/lib/cli/app.rb +0 -2
- data/fixtures/getting-started-app/Gemfile +1 -1
- data/lib/aruba/api.rb +6 -6
- data/lib/aruba/api/commands.rb +25 -1
- data/lib/aruba/api/core.rb +17 -4
- data/lib/aruba/api/environment.rb +8 -4
- data/lib/aruba/api/filesystem.rb +19 -6
- data/lib/aruba/colorizer.rb +10 -99
- data/lib/aruba/config/jruby.rb +15 -5
- data/lib/aruba/config_wrapper.rb +3 -1
- data/lib/aruba/configuration.rb +24 -12
- data/lib/aruba/cucumber.rb +0 -2
- data/lib/aruba/cucumber/command.rb +123 -45
- data/lib/aruba/cucumber/file.rb +13 -15
- data/lib/aruba/cucumber/testing_frameworks.rb +74 -50
- data/lib/aruba/in_config_wrapper.rb +5 -1
- data/lib/aruba/initializer.rb +28 -28
- data/lib/aruba/matchers/command/be_successfully_executed.rb +4 -0
- data/lib/aruba/matchers/command/have_exit_status.rb +13 -3
- 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/command/have_output_on_stderr.rb +1 -1
- data/lib/aruba/matchers/command/have_output_on_stdout.rb +1 -1
- data/lib/aruba/matchers/command/have_output_size.rb +1 -1
- data/lib/aruba/matchers/directory/be_an_existing_directory.rb +1 -1
- data/lib/aruba/matchers/file/be_an_existing_file.rb +1 -1
- data/lib/aruba/platform.rb +0 -7
- data/lib/aruba/platforms/announcer.rb +16 -11
- data/lib/aruba/platforms/command_monitor.rb +36 -0
- data/lib/aruba/platforms/simple_table.rb +2 -10
- data/lib/aruba/platforms/unix_environment_variables.rb +2 -10
- data/lib/aruba/platforms/unix_platform.rb +7 -3
- data/lib/aruba/platforms/windows_command_string.rb +2 -2
- data/lib/aruba/platforms/windows_environment_variables.rb +7 -1
- data/lib/aruba/platforms/windows_platform.rb +4 -0
- data/lib/aruba/processes/basic_process.rb +11 -11
- data/lib/aruba/processes/debug_process.rb +7 -3
- data/lib/aruba/processes/spawn_process.rb +13 -8
- data/lib/aruba/rspec.rb +1 -1
- data/lib/aruba/setup.rb +5 -5
- data/lib/aruba/version.rb +1 -1
- metadata +153 -20
- data/bin/build +0 -3
- data/bin/release +0 -3
data/CONTRIBUTING.md
CHANGED
@@ -129,11 +129,11 @@ Or use these Rake tasks:
|
|
129
129
|
# Run the whole test suite
|
130
130
|
rake test
|
131
131
|
# Run RSpec tests
|
132
|
-
rake
|
132
|
+
rake spec
|
133
133
|
# Run Cucumber features
|
134
|
-
rake
|
134
|
+
rake cucumber
|
135
135
|
# Run Cucumber features which are "WORK IN PROGRESS" and are allowed to fail
|
136
|
-
rake
|
136
|
+
rake cucumber:wip
|
137
137
|
```
|
138
138
|
|
139
139
|
If you have problems because our assumptions about your local setup are wrong,
|
@@ -195,11 +195,11 @@ You can use the following Rake tasks to build and install your work-in-progress
|
|
195
195
|
|
196
196
|
```bash
|
197
197
|
# Build your copy
|
198
|
-
bundle exec rake
|
198
|
+
bundle exec rake build
|
199
199
|
# Build and install your copy
|
200
|
-
bundle exec rake
|
200
|
+
bundle exec rake install
|
201
201
|
# Build and install your copy without network access
|
202
|
-
bundle exec rake
|
202
|
+
bundle exec rake install:local
|
203
203
|
```
|
204
204
|
|
205
205
|
## Getting started as a "Maintainer"
|
@@ -225,7 +225,7 @@ bin/test
|
|
225
225
|
|
226
226
|
# Release gem
|
227
227
|
git commit -m "Version bump"
|
228
|
-
|
228
|
+
bundle exec rake release
|
229
229
|
|
230
230
|
# If it's a major relase:
|
231
231
|
# Merge changes back to have correct documentation
|
data/Gemfile
CHANGED
@@ -4,60 +4,12 @@ source 'https://rubygems.org'
|
|
4
4
|
gemspec
|
5
5
|
|
6
6
|
# Load local Gemfile
|
7
|
-
load File.expand_path('
|
7
|
+
load File.expand_path('Gemfile.local', __dir__) if File.file? File.expand_path('Gemfile.local', __dir__)
|
8
8
|
|
9
9
|
# Debug aruba
|
10
10
|
group :debug do
|
11
11
|
unless RUBY_PLATFORM.include?('java')
|
12
|
-
|
13
|
-
gem 'byebug', '~> 11.0'
|
14
|
-
else
|
15
|
-
gem 'byebug', '~> 10.0'
|
16
|
-
end
|
17
|
-
|
12
|
+
gem 'byebug', '~> 11.0'
|
18
13
|
gem 'pry-byebug', '~> 3.4'
|
19
14
|
end
|
20
|
-
|
21
|
-
gem 'pry-doc', '~> 1.0.0'
|
22
|
-
end
|
23
|
-
|
24
|
-
# Tools to run during development
|
25
|
-
group :development do
|
26
|
-
# Needed for lint:yard:junk task
|
27
|
-
if RUBY_VERSION >= '2.3.0'
|
28
|
-
gem 'yard-junk', '~> 0'
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
group :development, :test do
|
33
|
-
# we use this to demonstrate interactive debugging within our feature tests
|
34
|
-
gem 'pry', '~> 0.12.2'
|
35
|
-
|
36
|
-
# Run development and test tasks
|
37
|
-
gem 'rake', '~> 12.3'
|
38
|
-
|
39
|
-
# Lint travis yaml
|
40
|
-
gem 'travis-yaml'
|
41
|
-
|
42
|
-
# Code Coverage
|
43
|
-
gem 'simplecov', '~> 0.10'
|
44
|
-
|
45
|
-
# API docs generation
|
46
|
-
gem 'yard', '~>0.9.9'
|
47
|
-
|
48
|
-
# Test api
|
49
|
-
gem 'fuubar', '~> 2.2'
|
50
|
-
gem 'rspec', '~> 3.4'
|
51
|
-
|
52
|
-
# Make aruba compliant to ruby community guide
|
53
|
-
gem 'rubocop', '~> 0.64.0'
|
54
|
-
|
55
|
-
# License compliance
|
56
|
-
if RUBY_VERSION >= '2.3'
|
57
|
-
gem 'license_finder', '~> 5.0'
|
58
|
-
end
|
59
|
-
|
60
|
-
gem 'minitest', '~> 5.8'
|
61
|
-
|
62
|
-
gem 'json', '~> 2.1'
|
63
15
|
end
|
data/Rakefile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
$LOAD_PATH << File.expand_path(
|
1
|
+
$LOAD_PATH << File.expand_path(__dir__)
|
2
2
|
|
3
3
|
require 'aruba/tasks/docker_helpers'
|
4
4
|
require 'aruba/platform'
|
@@ -6,33 +6,30 @@ require 'aruba/platform'
|
|
6
6
|
require 'bundler'
|
7
7
|
Bundler.setup
|
8
8
|
|
9
|
-
task default:
|
9
|
+
task default: %w(spec cucumber cucumber:wip lint)
|
10
10
|
|
11
11
|
desc 'Run all linters.'
|
12
12
|
task lint: %w(lint:travis lint:coding_guidelines lint:licenses)
|
13
13
|
|
14
14
|
desc 'Run the whole test suite.'
|
15
|
-
task test: %w(
|
15
|
+
task test: %w(spec cucumber cucumber:wip)
|
16
16
|
|
17
17
|
require 'cucumber/rake/task'
|
18
18
|
require 'rspec/core/rake_task'
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
Cucumber::Rake::Task.new(:cucumber_wip, 'Run Cucumber features '\
|
26
|
-
'which are "WORK IN PROGRESS" and '\
|
27
|
-
'are allowed to fail') do |t|
|
28
|
-
t.cucumber_opts = %w{--format progress}
|
29
|
-
t.profile = 'wip'
|
30
|
-
end
|
20
|
+
Cucumber::Rake::Task.new do |t|
|
21
|
+
t.cucumber_opts = %w{--format progress}
|
22
|
+
end
|
31
23
|
|
32
|
-
|
33
|
-
|
24
|
+
Cucumber::Rake::Task.new('cucumber:wip', 'Run Cucumber features '\
|
25
|
+
'which are "WORK IN PROGRESS" and '\
|
26
|
+
'are allowed to fail') do |t|
|
27
|
+
t.cucumber_opts = %w{--format progress}
|
28
|
+
t.profile = 'wip'
|
34
29
|
end
|
35
30
|
|
31
|
+
RSpec::Core::RakeTask.new
|
32
|
+
|
36
33
|
namespace :lint do
|
37
34
|
desc 'Lint our .travis.yml'
|
38
35
|
task :travis do
|
@@ -48,33 +45,19 @@ namespace :lint do
|
|
48
45
|
|
49
46
|
desc 'Lint our code with "rubocop"'
|
50
47
|
task :coding_guidelines do
|
51
|
-
|
52
|
-
sh 'bundle exec rubocop --fail-level E'
|
53
|
-
else
|
54
|
-
warn 'Your ruby version is not supported for code linting'
|
55
|
-
end
|
48
|
+
sh 'bundle exec rubocop --fail-level E'
|
56
49
|
end
|
57
50
|
|
58
51
|
desc 'Check for relevant licenses in project'
|
59
52
|
task :licenses do
|
60
|
-
|
61
|
-
sh 'bundle exec license_finder'
|
62
|
-
else
|
63
|
-
warn 'Your ruby version is not supported for license checking'
|
64
|
-
end
|
53
|
+
sh 'bundle exec license_finder'
|
65
54
|
end
|
66
55
|
|
67
|
-
|
68
|
-
|
69
|
-
YardJunk::Rake.define_task
|
70
|
-
rescue LoadError
|
71
|
-
warn 'yard-junk requires Ruby 2.3.0. Rake task lint:yard:junk not loaded.'
|
72
|
-
end
|
56
|
+
require 'yard-junk/rake'
|
57
|
+
YardJunk::Rake.define_task
|
73
58
|
end
|
74
59
|
|
75
|
-
|
76
|
-
Bundler::GemHelper.install_tasks
|
77
|
-
end
|
60
|
+
Bundler::GemHelper.install_tasks
|
78
61
|
|
79
62
|
namespace :docker do
|
80
63
|
desc 'Build docker image'
|
@@ -82,7 +65,7 @@ namespace :docker do
|
|
82
65
|
args.with_defaults(version: 'latest')
|
83
66
|
args.with_defaults(cache: true)
|
84
67
|
|
85
|
-
docker_compose_file = Aruba::DockerComposeFile.new(File.expand_path('
|
68
|
+
docker_compose_file = Aruba::DockerComposeFile.new(File.expand_path('docker-compose.yml', __dir__))
|
86
69
|
docker_run_instance = Aruba::DockerRunInstance.new(docker_compose_file, :base)
|
87
70
|
|
88
71
|
builder = Aruba::DockerBuildCommandLineBuilder.new(
|
@@ -96,7 +79,7 @@ namespace :docker do
|
|
96
79
|
|
97
80
|
desc 'Run docker container'
|
98
81
|
task :run, :command do |_, args|
|
99
|
-
docker_compose_file = Aruba::DockerComposeFile.new(File.expand_path('
|
82
|
+
docker_compose_file = Aruba::DockerComposeFile.new(File.expand_path('docker-compose.yml', __dir__))
|
100
83
|
docker_run_instance = Aruba::DockerRunInstance.new(docker_compose_file, :base)
|
101
84
|
|
102
85
|
builder = Aruba::DockerRunCommandLineBuilder.new(
|
data/appveyor.yml
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
version: "{build}"
|
2
2
|
|
3
|
-
# This will build all PRs
|
3
|
+
# This will build all PRs targeting matching branches.
|
4
4
|
# Without this, each PR builds twice -- once for the PR branch HEAD,
|
5
|
-
# and once for the merge commit that github creates for each
|
5
|
+
# and once for the merge commit that github creates for each mergeable PR.
|
6
6
|
branches:
|
7
7
|
only:
|
8
8
|
- master
|
@@ -20,13 +20,11 @@ install:
|
|
20
20
|
- cinst ansicon
|
21
21
|
|
22
22
|
test_script:
|
23
|
-
- bundle exec rake
|
23
|
+
- bundle exec rake spec --trace
|
24
24
|
|
25
25
|
environment:
|
26
26
|
matrix:
|
27
|
-
- ruby_version: '22'
|
28
27
|
- ruby_version: '23'
|
29
28
|
- ruby_version: '24'
|
30
29
|
- ruby_version: '25'
|
31
30
|
- ruby_version: '26'
|
32
|
-
|
data/aruba.gemspec
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
1
|
lib = ::File.expand_path('../lib', __FILE__)
|
4
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
3
|
require 'aruba/version'
|
@@ -8,22 +6,34 @@ Gem::Specification.new do |spec|
|
|
8
6
|
spec.name = 'aruba'
|
9
7
|
spec.version = Aruba::VERSION
|
10
8
|
spec.author = 'Aslak Hellesøy, Matt Wynne and other Aruba Contributors'
|
11
|
-
spec.description = 'Extension for popular TDD and BDD frameworks like "Cucumber", "RSpec" and "Minitest"
|
9
|
+
spec.description = 'Extension for popular TDD and BDD frameworks like "Cucumber", "RSpec" and "Minitest",
|
10
|
+
to make testing commandline applications meaningful, easy and fun.'
|
12
11
|
spec.summary = "aruba-#{spec.version}"
|
13
12
|
spec.license = 'MIT'
|
14
13
|
spec.email = 'cukes@googlegroups.com'
|
15
14
|
spec.homepage = 'https://github.com/cucumber/aruba'
|
16
15
|
|
17
|
-
spec.add_runtime_dependency 'childprocess', '~>
|
16
|
+
spec.add_runtime_dependency 'childprocess', '~> 3.0'
|
18
17
|
spec.add_runtime_dependency 'contracts', '~> 0.13'
|
19
18
|
spec.add_runtime_dependency 'cucumber', ['>= 2.4', '< 4.0']
|
20
19
|
spec.add_runtime_dependency 'ffi', '~> 1.9'
|
21
20
|
spec.add_runtime_dependency 'rspec-expectations', '~> 3.4'
|
22
21
|
spec.add_runtime_dependency 'thor', '~> 0.19'
|
23
22
|
|
24
|
-
spec.add_development_dependency '
|
23
|
+
spec.add_development_dependency 'json', '~> 2.1'
|
24
|
+
spec.add_development_dependency 'license_finder', '~> 5.3'
|
25
|
+
spec.add_development_dependency 'minitest', '~> 5.10'
|
26
|
+
spec.add_development_dependency 'pry-doc', '~> 1.0.0'
|
27
|
+
spec.add_development_dependency 'rake', '~> 12.3'
|
28
|
+
spec.add_development_dependency 'rspec', '~> 3.6'
|
29
|
+
spec.add_development_dependency 'rubocop', '~> 0.69.0'
|
30
|
+
spec.add_development_dependency 'rubocop-performance', '~> 1.1'
|
31
|
+
spec.add_development_dependency 'simplecov', '~> 0.15'
|
32
|
+
spec.add_development_dependency 'travis-yaml', '~> 0.2'
|
33
|
+
spec.add_development_dependency 'yard-junk', '~> 0.0.7'
|
34
|
+
|
25
35
|
spec.rubygems_version = '>= 1.6.1'
|
26
|
-
spec.required_ruby_version = '>= 2.
|
36
|
+
spec.required_ruby_version = '>= 2.3'
|
27
37
|
|
28
38
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
29
39
|
f.match(%r{^(test|spec|features)/})
|
data/bin/console
CHANGED
data/cucumber.yml
CHANGED
@@ -1,17 +1,6 @@
|
|
1
1
|
<%
|
2
|
-
|
3
|
-
|
4
|
-
require 'ffi'
|
5
|
-
|
6
|
-
java_version = (RUBY_DESCRIPTION.match(/.*?on.*?(1\.[\d]\..*? )/))[1] if defined?(JRUBY_VERSION)
|
7
|
-
|
8
|
-
std_opts = "--format pretty --color --exclude features/fixtures --require features --tags ~@unsupported-on"
|
9
|
-
java_default_opts = "--tags ~@wip-jruby-java-1.6" if defined?(JRUBY_VERSION) && (java_version < '1.7.0')
|
10
|
-
java_wip_opts = "--tags @wip-jruby-java-1.6:3" if defined?(JRUBY_VERSION) && (java_version < '1.7.0')
|
11
|
-
|
12
|
-
ignore_opts = []
|
13
|
-
ignore_opts << '--tags ~@ignore'
|
14
|
-
ignore_opts = ignore_opts.join(' ')
|
2
|
+
std_opts = "--format pretty --color --exclude features/fixtures --require features --tags ~@unsupported-on"
|
3
|
+
ignore_opts = '--tags ~@ignore'
|
15
4
|
%>
|
16
|
-
default: <%= std_opts %> --tags ~@wip <%=
|
17
|
-
wip: <%= std_opts %> --wip --tags @wip:3 <%=
|
5
|
+
default: <%= std_opts %> --tags ~@wip <%= ignore_opts %>
|
6
|
+
wip: <%= std_opts %> --wip --tags @wip:3 <%= ignore_opts %>
|
data/exe/aruba
CHANGED
data/lib/aruba/api.rb
CHANGED
@@ -19,11 +19,11 @@ Aruba.platform.require_matching_files('../matchers/**/*.rb', __FILE__)
|
|
19
19
|
module Aruba
|
20
20
|
# Api
|
21
21
|
module Api
|
22
|
-
include
|
23
|
-
include
|
24
|
-
include
|
25
|
-
include
|
26
|
-
include
|
27
|
-
include
|
22
|
+
include Core
|
23
|
+
include Commands
|
24
|
+
include Environment
|
25
|
+
include Filesystem
|
26
|
+
include Text
|
27
|
+
include Bundler
|
28
28
|
end
|
29
29
|
end
|
data/lib/aruba/api/commands.rb
CHANGED
@@ -92,6 +92,30 @@ module Aruba
|
|
92
92
|
self
|
93
93
|
end
|
94
94
|
|
95
|
+
# Get stdout of all processes
|
96
|
+
#
|
97
|
+
# @return [String]
|
98
|
+
# The stdout of all processes which have run before
|
99
|
+
def all_stdout
|
100
|
+
aruba.command_monitor.all_stdout
|
101
|
+
end
|
102
|
+
|
103
|
+
# Get stderr of all processes
|
104
|
+
#
|
105
|
+
# @return [String]
|
106
|
+
# The stderr of all processes which have run before
|
107
|
+
def all_stderr
|
108
|
+
aruba.command_monitor.all_stderr
|
109
|
+
end
|
110
|
+
|
111
|
+
# Get stderr and stdout of all processes
|
112
|
+
#
|
113
|
+
# @return [String]
|
114
|
+
# The stderr and stdout of all processes which have run before
|
115
|
+
def all_output
|
116
|
+
aruba.command_monitor.all_output
|
117
|
+
end
|
118
|
+
|
95
119
|
# Find a started command
|
96
120
|
#
|
97
121
|
# @param [String, Command] commandline
|
@@ -128,7 +152,7 @@ module Aruba
|
|
128
152
|
|
129
153
|
unless command.interactive?
|
130
154
|
raise NotImplementedError,
|
131
|
-
|
155
|
+
'Running interactively is not supported with this process launcher.'
|
132
156
|
end
|
133
157
|
|
134
158
|
start_command(command)
|
data/lib/aruba/api/core.rb
CHANGED
@@ -3,8 +3,6 @@ require 'aruba/runtime'
|
|
3
3
|
require 'aruba/errors'
|
4
4
|
require 'aruba/setup'
|
5
5
|
|
6
|
-
require 'aruba/config/jruby'
|
7
|
-
|
8
6
|
# Aruba
|
9
7
|
module Aruba
|
10
8
|
# Api
|
@@ -17,6 +15,8 @@ module Aruba
|
|
17
15
|
|
18
16
|
# Aruba Runtime
|
19
17
|
def aruba
|
18
|
+
# TODO: Check this variable being accessed inconsistently. Should only be using the memo!
|
19
|
+
# Renaming this to `aruba` causes 100's of rspec failures. Needs a deeper dive, approach with caution!
|
20
20
|
@_aruba_runtime ||= Runtime.new
|
21
21
|
end
|
22
22
|
|
@@ -31,6 +31,15 @@ module Aruba
|
|
31
31
|
self
|
32
32
|
end
|
33
33
|
|
34
|
+
# Execute block in Aruba's current directory
|
35
|
+
#
|
36
|
+
# @yield
|
37
|
+
# The block which should be run in current directory
|
38
|
+
def in_current_directory(&block)
|
39
|
+
create_directory '.' unless directory?('.')
|
40
|
+
cd('.', &block)
|
41
|
+
end
|
42
|
+
|
34
43
|
# Switch to directory
|
35
44
|
#
|
36
45
|
# @param [String] dir
|
@@ -49,7 +58,9 @@ module Aruba
|
|
49
58
|
def cd(dir, &block)
|
50
59
|
if block_given?
|
51
60
|
begin
|
52
|
-
|
61
|
+
unless Aruba.platform.directory? expand_path(dir)
|
62
|
+
fail ArgumentError, "#{expand_path(dir)} is not a directory or does not exist."
|
63
|
+
end
|
53
64
|
|
54
65
|
old_directory = expand_path('.')
|
55
66
|
aruba.current_directory << dir
|
@@ -74,7 +85,9 @@ module Aruba
|
|
74
85
|
return result
|
75
86
|
end
|
76
87
|
|
77
|
-
|
88
|
+
unless Aruba.platform.directory? expand_path(dir)
|
89
|
+
fail ArgumentError, "#{expand_path(dir)} is not a directory or does not exist."
|
90
|
+
end
|
78
91
|
|
79
92
|
old_directory = expand_path('.')
|
80
93
|
aruba.current_directory << dir
|