aruba 0.8.1 → 0.9.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/.travis.yml +3 -1
- data/Gemfile +13 -10
- data/History.md +25 -7
- data/README.md +6 -1
- data/Rakefile +16 -3
- data/aruba.gemspec +10 -2
- data/bin/aruba +7 -0
- data/cucumber.yml +11 -2
- data/features/api/command/extract_text.feature +97 -0
- data/features/api/command/unescape_text.feature +119 -0
- data/features/api/core/expand_path.feature +16 -0
- data/features/api/{cd.feature → filesystem/cd.feature} +2 -1
- data/features/api/filesystem/create_directory.feature +57 -0
- data/features/api/filesystem/disk_usage.feature +151 -0
- data/features/api/filesystem/does_exist.feature +62 -0
- data/features/api/filesystem/is_absolute.feature +48 -0
- data/features/api/filesystem/is_directory.feature +53 -0
- data/features/api/filesystem/is_file.feature +54 -0
- data/features/api/filesystem/is_relative.feature +48 -0
- data/features/cli/console.feature +52 -0
- data/features/configuration/console_history_file.feature +38 -0
- data/features/configuration/exit_timeout.feature +2 -1
- data/features/configuration/fixtures_path_prefix.feature +0 -1
- data/features/configuration/home_directory.feature +0 -1
- data/features/configuration/io_timeout.feature +0 -1
- data/features/configuration/keep_ansi.feature +1 -2
- data/features/configuration/log_level.feature +38 -0
- data/features/configuration/physical_block_size.feature +53 -0
- data/features/configuration/remove_ansi_escape_sequences.feature +38 -0
- data/features/configuration/root_directory.feature +0 -1
- data/features/configuration/working_directory.feature +2 -1
- data/features/fixtures/cli-app/README.md +5 -0
- data/features/fixtures/cli-app/lib/cli/app.rb +1 -1
- data/features/fixtures/cli-app/spec/spec_helper.rb +1 -2
- data/features/fixtures/cli-app/spec/support/aruba.rb +1 -0
- data/features/fixtures/empty-app/lib/cli/app.rb +1 -1
- data/features/fixtures/empty-app/spec/spec_helper.rb +1 -1
- data/features/step_definitions/aruba_dev_steps.rb +12 -1
- data/features/support/env.rb +1 -1
- data/lib/aruba/announcer.rb +1 -14
- data/lib/aruba/api.rb +6 -6
- data/lib/aruba/api/command.rb +74 -12
- data/lib/aruba/api/core.rb +18 -11
- data/lib/aruba/api/deprecated.rb +60 -72
- data/lib/aruba/api/filesystem.rb +41 -16
- data/lib/aruba/aruba_logger.rb +77 -0
- data/lib/aruba/aruba_path.rb +33 -0
- data/lib/aruba/basic_configuration.rb +2 -2
- data/lib/aruba/cli.rb +11 -0
- data/lib/aruba/config.rb +13 -3
- data/lib/aruba/config/jruby.rb +5 -2
- data/lib/aruba/console.rb +66 -0
- data/lib/aruba/console/help.rb +33 -0
- data/lib/aruba/contracts/is_power_of_two.rb +15 -0
- data/lib/aruba/cucumber.rb +27 -10
- data/lib/aruba/cucumber/hooks.rb +15 -8
- data/lib/aruba/disk_usage_calculator.rb +7 -0
- data/lib/aruba/file_size.rb +52 -0
- data/lib/aruba/in_process.rb +1 -1
- data/lib/aruba/jruby.rb +1 -1
- data/lib/aruba/matchers/command.rb +1 -1
- data/lib/aruba/matchers/directory.rb +1 -1
- data/lib/aruba/matchers/environment.rb +1 -1
- data/lib/aruba/matchers/file.rb +1 -1
- data/lib/aruba/matchers/path.rb +1 -1
- data/lib/aruba/matchers/path/match_path_pattern.rb +1 -1
- data/lib/aruba/matchers/rspec_matcher_include_regexp.rb +1 -1
- data/lib/aruba/platform.rb +14 -242
- data/lib/aruba/{creators → platforms}/aruba_file_creator.rb +3 -3
- data/lib/aruba/{creators → platforms}/aruba_fixed_size_file_creator.rb +2 -2
- data/lib/aruba/platforms/simple_table.rb +36 -0
- data/lib/aruba/platforms/unix_command_string.rb +24 -0
- data/lib/aruba/platforms/unix_environment_variables.rb +130 -0
- data/lib/aruba/platforms/unix_platform.rb +226 -0
- data/lib/aruba/platforms/unix_which.rb +83 -0
- data/lib/aruba/platforms/windows_command_string.rb +23 -0
- data/lib/aruba/platforms/windows_environment_variables.rb +83 -0
- data/lib/aruba/platforms/windows_platform.rb +39 -0
- data/lib/aruba/platforms/windows_which.rb +104 -0
- data/lib/aruba/process_monitor.rb +3 -3
- data/lib/aruba/processes/basic_process.rb +23 -3
- data/lib/aruba/processes/debug_process.rb +2 -2
- data/lib/aruba/processes/in_process.rb +1 -1
- data/lib/aruba/processes/spawn_process.rb +10 -4
- data/lib/aruba/reporting.rb +1 -1
- data/lib/aruba/rspec.rb +8 -6
- data/lib/aruba/runtime.rb +8 -5
- data/lib/aruba/version.rb +1 -1
- data/spec/aruba/api_spec.rb +25 -23
- data/spec/aruba/aruba_path_spec.rb +37 -0
- data/spec/aruba/jruby_spec.rb +1 -1
- data/spec/aruba/matchers/file_spec.rb +2 -2
- data/spec/aruba/matchers/path_spec.rb +3 -3
- data/spec/aruba/platform/simple_table_spec.rb +23 -0
- data/spec/aruba/platform/windows_environment_variables_spec.rb +500 -0
- data/spec/aruba/spawn_process_spec.rb +3 -1
- metadata +90 -12
- data/lib/aruba/contracts/is_a.rb +0 -21
- data/lib/aruba/environment.rb +0 -121
@@ -0,0 +1,48 @@
|
|
1
|
+
Feature: Check if path is relative
|
2
|
+
|
3
|
+
Use the `#relative?`-method to check if a path is an relative path.
|
4
|
+
|
5
|
+
```ruby
|
6
|
+
require 'spec_helper'
|
7
|
+
|
8
|
+
RSpec.configure do |config|
|
9
|
+
config.include Aruba::Api
|
10
|
+
end
|
11
|
+
|
12
|
+
RSpec.describe 'Check if directory or file is relative' do
|
13
|
+
let(:path) { '/path/to/file.txt' }
|
14
|
+
|
15
|
+
it { expect(relative?(path)).to be true }
|
16
|
+
end
|
17
|
+
```
|
18
|
+
|
19
|
+
Background:
|
20
|
+
Given I use a fixture named "cli-app"
|
21
|
+
|
22
|
+
Scenario: Is path relative
|
23
|
+
Given a file named "spec/create_directory_spec.rb" with:
|
24
|
+
"""
|
25
|
+
require 'spec_helper'
|
26
|
+
|
27
|
+
RSpec.describe 'Check if directory or file is relative', :type => :aruba do
|
28
|
+
let(:path) { 'file.txt' }
|
29
|
+
|
30
|
+
it { expect(relative?(path)).to be true }
|
31
|
+
end
|
32
|
+
"""
|
33
|
+
When I run `rspec`
|
34
|
+
Then the specs should all pass
|
35
|
+
|
36
|
+
Scenario: Path should be relative, but it's relative
|
37
|
+
Given a file named "spec/create_directory_spec.rb" with:
|
38
|
+
"""
|
39
|
+
require 'spec_helper'
|
40
|
+
|
41
|
+
RSpec.describe 'Check if directory or file is relative', :type => :aruba do
|
42
|
+
let(:path) { '/path/to/file.txt' }
|
43
|
+
|
44
|
+
it { expect(relative?(path)).to be false }
|
45
|
+
end
|
46
|
+
"""
|
47
|
+
When I run `rspec`
|
48
|
+
Then the specs should all pass
|
@@ -0,0 +1,52 @@
|
|
1
|
+
Feature: Aruba Console
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given a mocked home directory
|
5
|
+
|
6
|
+
Scenario: Start console
|
7
|
+
Given I run `aruba console` interactively
|
8
|
+
When I close the stdin stream
|
9
|
+
Then the output should contain:
|
10
|
+
"""
|
11
|
+
aruba:001:0>
|
12
|
+
"""
|
13
|
+
|
14
|
+
@ignore-platform-java
|
15
|
+
Scenario: Show help
|
16
|
+
Given I run `aruba console` interactively
|
17
|
+
And I type "aruba_help"
|
18
|
+
When I close the stdin stream
|
19
|
+
Then the output should contain:
|
20
|
+
"""
|
21
|
+
Version:
|
22
|
+
"""
|
23
|
+
And the output should contain:
|
24
|
+
"""
|
25
|
+
Issue Tracker:
|
26
|
+
"""
|
27
|
+
And the output should contain:
|
28
|
+
"""
|
29
|
+
Documentation:
|
30
|
+
"""
|
31
|
+
|
32
|
+
@ignore-platform-java
|
33
|
+
Scenario: Show methods
|
34
|
+
Given I run `aruba console` interactively
|
35
|
+
And I type "aruba_methods"
|
36
|
+
When I close the stdin stream
|
37
|
+
Then the output should contain:
|
38
|
+
"""
|
39
|
+
Methods:
|
40
|
+
"""
|
41
|
+
And the output should contain:
|
42
|
+
"""
|
43
|
+
* setup_aruba
|
44
|
+
"""
|
45
|
+
|
46
|
+
@ignore-platform-java
|
47
|
+
Scenario: Has history
|
48
|
+
Given I run `aruba console` interactively
|
49
|
+
And I type "aruba_methods"
|
50
|
+
And I type "exit"
|
51
|
+
When I close the stdin stream
|
52
|
+
Then the file "~/.aruba_history" should exist
|
@@ -0,0 +1,38 @@
|
|
1
|
+
Feature: Configure the aruba console history file
|
2
|
+
|
3
|
+
As a developer
|
4
|
+
I want to configure the history file of aruba console
|
5
|
+
In order to have a better isolation of tests
|
6
|
+
|
7
|
+
Background:
|
8
|
+
Given I use the fixture "cli-app"
|
9
|
+
|
10
|
+
Scenario: Default value
|
11
|
+
Given a file named "features/support/aruba.rb" with:
|
12
|
+
"""
|
13
|
+
Aruba.configure do |config|
|
14
|
+
puts %(The default value is "#{config.console_history_file}")
|
15
|
+
end
|
16
|
+
"""
|
17
|
+
When I successfully run `cucumber`
|
18
|
+
Then the output should contain:
|
19
|
+
"""
|
20
|
+
The default value is "~/.aruba_history"
|
21
|
+
"""
|
22
|
+
|
23
|
+
Scenario: Set some value
|
24
|
+
Given a file named "features/support/aruba.rb" with:
|
25
|
+
"""
|
26
|
+
Aruba.configure do |config|
|
27
|
+
config.console_history_file = '~/.config/aruba/history.txt'
|
28
|
+
end
|
29
|
+
|
30
|
+
Aruba.configure do |config|
|
31
|
+
puts %(The value is "#{config.console_history_file}")
|
32
|
+
end
|
33
|
+
"""
|
34
|
+
Then I successfully run `cucumber`
|
35
|
+
Then the output should contain:
|
36
|
+
"""
|
37
|
+
The value is "~/.config/aruba/history.txt"
|
38
|
+
"""
|
@@ -6,7 +6,6 @@ Feature: Configure timeout for command execution
|
|
6
6
|
|
7
7
|
Background:
|
8
8
|
Given I use the fixture "cli-app"
|
9
|
-
And the default feature-test
|
10
9
|
|
11
10
|
Scenario: Default value
|
12
11
|
Given a file named "features/support/aruba.rb" with:
|
@@ -33,6 +32,7 @@ Feature: Configure timeout for command execution
|
|
33
32
|
config.exit_timeout = 2
|
34
33
|
end
|
35
34
|
"""
|
35
|
+
And the default feature-test
|
36
36
|
Then I successfully run `cucumber`
|
37
37
|
|
38
38
|
Scenario: Fails if takes longer
|
@@ -47,5 +47,6 @@ Feature: Configure timeout for command execution
|
|
47
47
|
config.exit_timeout = 1
|
48
48
|
end
|
49
49
|
"""
|
50
|
+
And the default feature-test
|
50
51
|
Then I run `cucumber`
|
51
52
|
And the exit status should be 1
|
@@ -1,4 +1,4 @@
|
|
1
|
-
Feature: Configure if ansi color codes should be stripped off from command output
|
1
|
+
Feature: Configure if ansi color codes should be stripped off from command output (deprecated)
|
2
2
|
|
3
3
|
As a developer
|
4
4
|
I want to strip off ansi color codes
|
@@ -6,7 +6,6 @@ Feature: Configure if ansi color codes should be stripped off from command outpu
|
|
6
6
|
|
7
7
|
Background:
|
8
8
|
Given I use the fixture "cli-app"
|
9
|
-
And the default feature-test
|
10
9
|
|
11
10
|
Scenario: Default value
|
12
11
|
Given a file named "features/support/aruba.rb" with:
|
@@ -0,0 +1,38 @@
|
|
1
|
+
Feature: Configure Log level of aruba logger
|
2
|
+
|
3
|
+
As a developer
|
4
|
+
I want to configure the level of information put to output by logger
|
5
|
+
In order to modify the amount of information
|
6
|
+
|
7
|
+
Background:
|
8
|
+
Given I use the fixture "cli-app"
|
9
|
+
|
10
|
+
Scenario: Default value
|
11
|
+
Given a file named "features/support/aruba.rb" with:
|
12
|
+
"""
|
13
|
+
Aruba.configure do |config|
|
14
|
+
puts %(The default value is "#{config.log_level}")
|
15
|
+
end
|
16
|
+
"""
|
17
|
+
When I successfully run `cucumber`
|
18
|
+
Then the output should contain:
|
19
|
+
"""
|
20
|
+
The default value is "info"
|
21
|
+
"""
|
22
|
+
|
23
|
+
Scenario: Modify value
|
24
|
+
Given a file named "features/support/aruba.rb" with:
|
25
|
+
"""
|
26
|
+
Aruba.configure do |config|
|
27
|
+
config.log_level = :warn
|
28
|
+
end
|
29
|
+
|
30
|
+
Aruba.configure do |config|
|
31
|
+
puts %(The default value is "#{config.log_level}")
|
32
|
+
end
|
33
|
+
"""
|
34
|
+
Then I successfully run `cucumber`
|
35
|
+
Then the output should contain:
|
36
|
+
"""
|
37
|
+
The default value is "warn"
|
38
|
+
"""
|
@@ -0,0 +1,53 @@
|
|
1
|
+
Feature: Configure the phsical block size of disk
|
2
|
+
|
3
|
+
As a developer
|
4
|
+
I want to configure the physical block size
|
5
|
+
In order to make the disk usage work for my application's setup
|
6
|
+
|
7
|
+
Background:
|
8
|
+
Given I use the fixture "cli-app"
|
9
|
+
|
10
|
+
Scenario: Default value
|
11
|
+
Given a file named "features/support/aruba.rb" with:
|
12
|
+
"""
|
13
|
+
Aruba.configure do |config|
|
14
|
+
puts %(The default value is "#{config.physical_block_size}")
|
15
|
+
end
|
16
|
+
"""
|
17
|
+
When I successfully run `cucumber`
|
18
|
+
Then the output should contain:
|
19
|
+
"""
|
20
|
+
The default value is "512"
|
21
|
+
"""
|
22
|
+
|
23
|
+
Scenario: Set the block size to something else which is a power of two
|
24
|
+
Given a file named "features/support/aruba.rb" with:
|
25
|
+
"""
|
26
|
+
Aruba.configure do |config|
|
27
|
+
# use current working directory
|
28
|
+
config.physical_block_size = 4096
|
29
|
+
end
|
30
|
+
|
31
|
+
Aruba.configure do |config|
|
32
|
+
puts %(The default value is "#{config.physical_block_size}")
|
33
|
+
end
|
34
|
+
"""
|
35
|
+
When I successfully run `cucumber`
|
36
|
+
Then the output should contain:
|
37
|
+
"""
|
38
|
+
The default value is "4096"
|
39
|
+
"""
|
40
|
+
|
41
|
+
Scenario: The value needs to be a power of two, otherwise it will fail
|
42
|
+
Given a file named "features/support/aruba.rb" with:
|
43
|
+
"""
|
44
|
+
Aruba.configure do |config|
|
45
|
+
config.physical_block_size = 3
|
46
|
+
end
|
47
|
+
"""
|
48
|
+
When I run `cucumber`
|
49
|
+
Then the output should contain:
|
50
|
+
"""
|
51
|
+
Contract violation for argument
|
52
|
+
"""
|
53
|
+
|
@@ -0,0 +1,38 @@
|
|
1
|
+
Feature: Configure if ansi color codes should be stripped off from command output
|
2
|
+
|
3
|
+
As a developer
|
4
|
+
I want to strip off ansi color codes
|
5
|
+
In order to make checking of those outputs easier
|
6
|
+
|
7
|
+
Background:
|
8
|
+
Given I use the fixture "cli-app"
|
9
|
+
|
10
|
+
Scenario: Default value
|
11
|
+
Given a file named "features/support/aruba.rb" with:
|
12
|
+
"""
|
13
|
+
Aruba.configure do |config|
|
14
|
+
puts %(The default value is "#{config.remove_ansi_escape_sequences}")
|
15
|
+
end
|
16
|
+
"""
|
17
|
+
When I successfully run `cucumber`
|
18
|
+
Then the output should contain:
|
19
|
+
"""
|
20
|
+
The default value is "true"
|
21
|
+
"""
|
22
|
+
|
23
|
+
Scenario: Modify value
|
24
|
+
Given a file named "features/support/aruba.rb" with:
|
25
|
+
"""
|
26
|
+
Aruba.configure do |config|
|
27
|
+
config.remove_ansi_escape_sequences = false
|
28
|
+
end
|
29
|
+
|
30
|
+
Aruba.configure do |config|
|
31
|
+
puts %(The value is "#{config.remove_ansi_escape_sequences}")
|
32
|
+
end
|
33
|
+
"""
|
34
|
+
Then I successfully run `cucumber`
|
35
|
+
And the output should contain:
|
36
|
+
"""
|
37
|
+
The value is "false"
|
38
|
+
"""
|
@@ -6,7 +6,6 @@ Feature: Configure working directory of aruba
|
|
6
6
|
|
7
7
|
Background:
|
8
8
|
Given I use the fixture "cli-app"
|
9
|
-
And the default feature-test
|
10
9
|
|
11
10
|
Scenario: Default value
|
12
11
|
Given a file named "features/support/aruba.rb" with:
|
@@ -28,5 +27,7 @@ Feature: Configure working directory of aruba
|
|
28
27
|
config.working_directory = 'tmp/cucumber'
|
29
28
|
end
|
30
29
|
"""
|
30
|
+
And the default feature-test
|
31
|
+
And the default executable
|
31
32
|
When I successfully run `cucumber`
|
32
33
|
Then a directory named "tmp/cucumber" should exist
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'cli/app/version'
|
2
2
|
|
3
|
-
if RUBY_VERSION < '1.9'
|
3
|
+
if RUBY_VERSION < '1.9.3'
|
4
4
|
::Dir.glob(::File.expand_path('../**/*.rb', __FILE__)).each { |f| require File.join(File.dirname(f), File.basename(f, '.rb')) }
|
5
5
|
else
|
6
6
|
::Dir.glob(File.expand_path('../**/*.rb', __FILE__)).each { |f| require_relative f }
|
@@ -1,9 +1,8 @@
|
|
1
1
|
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
2
|
|
3
3
|
require 'cli/app'
|
4
|
-
require 'aruba/rspec'
|
5
4
|
|
6
|
-
if RUBY_VERSION < '1.9.'
|
5
|
+
if RUBY_VERSION < '1.9.3'
|
7
6
|
::Dir.glob(::File.expand_path('../support/**/*.rb', __FILE__)).each { |f| require File.join(File.dirname(f), File.basename(f, '.rb')) }
|
8
7
|
else
|
9
8
|
::Dir.glob(::File.expand_path('../support/**/*.rb', __FILE__)).each { |f| require_relative f }
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'aruba/rspec'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'cli/app/version'
|
2
2
|
|
3
|
-
if RUBY_VERSION < '1.9'
|
3
|
+
if RUBY_VERSION < '1.9.3'
|
4
4
|
::Dir.glob(::File.expand_path('../**/*.rb', __FILE__)).each { |f| require File.join(File.dirname(f), File.basename(f, '.rb')) }
|
5
5
|
else
|
6
6
|
::Dir.glob(File.expand_path('../**/*.rb', __FILE__)).each { |f| require_relative f }
|
@@ -2,7 +2,7 @@ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
|
2
2
|
|
3
3
|
require 'cli/app'
|
4
4
|
|
5
|
-
if RUBY_VERSION < '1.9.'
|
5
|
+
if RUBY_VERSION < '1.9.3'
|
6
6
|
::Dir.glob(::File.expand_path('../support/**/*.rb', __FILE__)).each { |f| require File.join(File.dirname(f), File.basename(f, '.rb')) }
|
7
7
|
else
|
8
8
|
::Dir.glob(::File.expand_path('../support/**/*.rb', __FILE__)).each { |f| require_relative f }
|
@@ -18,7 +18,7 @@ When /^I set env variable "(\w+)" to "([^"]*)"$/ do |var, value|
|
|
18
18
|
end
|
19
19
|
|
20
20
|
Then /^aruba should fail with "([^"]*)"$/ do |error_message|
|
21
|
-
expect(@aruba_exception.message).to include(
|
21
|
+
expect(@aruba_exception.message).to include(extract_text(unescape_text(error_message)))
|
22
22
|
end
|
23
23
|
|
24
24
|
Then /^the following step should fail with Spec::Expectations::ExpectationNotMetError:$/ do |multiline_step|
|
@@ -78,6 +78,17 @@ Then /^the spec(?:s)? should( not)?(?: all)? pass with:$/ do |negated, string|
|
|
78
78
|
step 'the output should contain:', string if string
|
79
79
|
end
|
80
80
|
|
81
|
+
Given(/^the default executable$/) do
|
82
|
+
step 'an executable named "bin/cli" with:', <<-EOS
|
83
|
+
#!/usr/bin/env ruby
|
84
|
+
|
85
|
+
$LOAD_PATH << File.expand_path('../../lib', __FILE__)
|
86
|
+
require 'cli/app'
|
87
|
+
|
88
|
+
exit 0
|
89
|
+
EOS
|
90
|
+
end
|
91
|
+
|
81
92
|
Given(/^the default feature-test$/) do
|
82
93
|
step(
|
83
94
|
'a file named "features/default.feature" with:',
|
data/features/support/env.rb
CHANGED
@@ -13,7 +13,7 @@ require 'rspec/expectations'
|
|
13
13
|
|
14
14
|
Before do |scenario|
|
15
15
|
command_name = if scenario.respond_to?(:feature) && scenario.respond_to?(:name)
|
16
|
-
"#{scenario.feature.
|
16
|
+
"#{scenario.feature.name} #{scenario.name}"
|
17
17
|
else
|
18
18
|
raise TypeError.new("Don't know how to extract command name from #{scenario.class}")
|
19
19
|
end
|