aruba 0.14.9 → 0.14.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -0
  3. data/.travis.yml +17 -37
  4. data/CHANGELOG.md +30 -0
  5. data/Gemfile +11 -1
  6. data/features/{getting_started/cleanup.feature → 01_getting_started_with_aruba/cleanup_working_directory.feature} +4 -5
  7. data/features/{getting_started → 01_getting_started_with_aruba}/run_commands.feature +45 -15
  8. data/features/{getting_started → 01_getting_started_with_aruba}/supported_testing_frameworks.feature +5 -21
  9. data/features/{configuration → 02_configure_aruba}/activate_announcer_on_command_failure.feature +2 -2
  10. data/features/{configuration/usage.feature → 02_configure_aruba/basics.feature} +21 -29
  11. data/features/{configuration → 02_configure_aruba}/command_runtime_environment.feature +0 -0
  12. data/features/{configuration → 02_configure_aruba}/console_history_file.feature +2 -2
  13. data/features/{configuration → 02_configure_aruba}/exit_timeout.feature +25 -17
  14. data/features/{configuration → 02_configure_aruba}/fixtures_directories.feature +2 -2
  15. data/features/{configuration → 02_configure_aruba}/fixtures_path_prefix.feature +1 -1
  16. data/features/{configuration → 02_configure_aruba}/home_directory.feature +6 -6
  17. data/features/{configuration → 02_configure_aruba}/io_timeout.feature +2 -2
  18. data/features/{configuration → 02_configure_aruba}/keep_ansi.feature +0 -0
  19. data/features/{configuration → 02_configure_aruba}/log_level.feature +2 -2
  20. data/features/{configuration → 02_configure_aruba}/physical_block_size.feature +3 -3
  21. data/features/{configuration → 02_configure_aruba}/remove_ansi_escape_sequences.feature +2 -2
  22. data/features/{configuration → 02_configure_aruba}/root_directory.feature +1 -1
  23. data/features/{configuration → 02_configure_aruba}/startup_wait_time.feature +2 -2
  24. data/features/{configuration → 02_configure_aruba}/working_directory.feature +9 -4
  25. data/features/{steps/core/announce.feature → 03_testing_frameworks/cucumber/announce_information_for_troubleshooting.feature} +20 -40
  26. data/features/{steps/environment → 03_testing_frameworks/cucumber}/disable_bunder.feature +0 -0
  27. data/features/{steps/command/exit_statuses.feature → 03_testing_frameworks/cucumber/steps/command/check_for_exit_statuses.feature} +20 -20
  28. data/features/{steps/command/output.feature → 03_testing_frameworks/cucumber/steps/command/check_output_of_command.feature} +58 -111
  29. data/features/{steps/command/stderr.feature → 03_testing_frameworks/cucumber/steps/command/check_stderr_of_command.feature} +1 -1
  30. data/features/{steps/command/stdout.feature → 03_testing_frameworks/cucumber/steps/command/check_stdout_of_command.feature} +6 -6
  31. data/features/{steps/command/debug.feature → 03_testing_frameworks/cucumber/steps/command/debug_your_command_in_aruba.feature} +6 -6
  32. data/features/{steps/command/run.feature → 03_testing_frameworks/cucumber/steps/command/run_a_command.feature} +4 -4
  33. data/features/{steps/command/in_process.feature → 03_testing_frameworks/cucumber/steps/command/run_command_in_process.feature} +2 -2
  34. data/features/{steps/command/interactive.feature → 03_testing_frameworks/cucumber/steps/command/run_command_interactively.feature} +2 -2
  35. data/features/03_testing_frameworks/cucumber/steps/command/run_commands_which_require_a_shell.feature +79 -0
  36. data/features/{steps/command/send_signal.feature → 03_testing_frameworks/cucumber/steps/command/send_signal_to_command.feature} +19 -40
  37. data/features/{steps/command/stop.feature → 03_testing_frameworks/cucumber/steps/command/stop_command.feature} +47 -75
  38. data/features/{steps → 03_testing_frameworks/cucumber/steps}/environment/append_environment_variable.feature +3 -3
  39. data/features/{steps/environment/home_variable.feature → 03_testing_frameworks/cucumber/steps/environment/modify_home_variable_for_testing.feature} +4 -4
  40. data/features/{steps → 03_testing_frameworks/cucumber/steps}/environment/prepend_environment_variable.feature +3 -3
  41. data/features/{steps → 03_testing_frameworks/cucumber/steps}/environment/set_environment_variable.feature +3 -3
  42. data/features/{steps → 03_testing_frameworks/cucumber/steps}/filesystem/append_to_file.feature +0 -0
  43. data/features/{steps → 03_testing_frameworks/cucumber/steps}/filesystem/cd_to_directory.feature +0 -0
  44. data/features/{steps/filesystem/existence_of_directory.feature → 03_testing_frameworks/cucumber/steps/filesystem/check_existence_of_directory.feature} +0 -0
  45. data/features/{steps/filesystem/existence_of_file.feature → 03_testing_frameworks/cucumber/steps/filesystem/check_existence_of_file.feature} +0 -0
  46. data/features/{steps/filesystem/file_content.feature → 03_testing_frameworks/cucumber/steps/filesystem/check_file_content.feature} +57 -0
  47. data/features/{steps/filesystem/non_existence_of_directory.feature → 03_testing_frameworks/cucumber/steps/filesystem/check_non_existence_of_directory.feature} +0 -0
  48. data/features/{steps/filesystem/non_existence_of_file.feature → 03_testing_frameworks/cucumber/steps/filesystem/check_non_existence_of_file.feature} +0 -0
  49. data/features/{steps → 03_testing_frameworks/cucumber/steps}/filesystem/check_permissions_of_file.feature +0 -0
  50. data/features/{steps → 03_testing_frameworks/cucumber/steps}/filesystem/compare_files.feature +0 -0
  51. data/features/{steps/filesystem/copy.feature → 03_testing_frameworks/cucumber/steps/filesystem/copy_file_or_directory.feature} +0 -0
  52. data/features/{steps → 03_testing_frameworks/cucumber/steps}/filesystem/create_directory.feature +0 -0
  53. data/features/{steps → 03_testing_frameworks/cucumber/steps}/filesystem/create_file.feature +0 -0
  54. data/features/{steps/filesystem/move.feature → 03_testing_frameworks/cucumber/steps/filesystem/move_file_or_directory.feature} +0 -1
  55. data/features/{steps → 03_testing_frameworks/cucumber/steps}/filesystem/overwrite_file.feature +0 -0
  56. data/features/{steps → 03_testing_frameworks/cucumber/steps}/filesystem/remove_directory.feature +0 -0
  57. data/features/{steps → 03_testing_frameworks/cucumber/steps}/filesystem/remove_file.feature +0 -0
  58. data/features/{steps/filesystem/use_fixture.feature → 03_testing_frameworks/cucumber/steps/filesystem/use_fixtures_for_setup_test.feature} +0 -0
  59. data/features/{hooks/after/command.feature → 03_testing_frameworks/rspec/hooks/define_after_hook_for_commands.feature} +1 -4
  60. data/features/{hooks/before/command.feature → 03_testing_frameworks/rspec/hooks/define_before_hook_for_commands.feature} +1 -5
  61. data/features/{rspec/integration.feature → 03_testing_frameworks/rspec/setup_aruba_for_rspec.feature} +17 -17
  62. data/features/{api/command/find_command.feature → 04_aruba_api/command/find_a_started_command.feature} +0 -0
  63. data/features/{api/command/which.feature → 04_aruba_api/command/find_command_in_PATH.feature} +4 -4
  64. data/features/{api/command/stderr.feature → 04_aruba_api/command/read_stderr_of_command.feature} +8 -8
  65. data/features/{api/command/stdout.feature → 04_aruba_api/command/read_stdout_of_command.feature} +7 -7
  66. data/features/{api/command/run.feature → 04_aruba_api/command/run_command.feature} +53 -44
  67. data/features/{api → 04_aruba_api}/command/run_simple.feature +46 -34
  68. data/features/{api/command/send_signal.feature → 04_aruba_api/command/send_signal_to_command.feature} +8 -8
  69. data/features/{api → 04_aruba_api}/command/stop_all_commands.feature +18 -14
  70. data/features/{api/command/stop.feature → 04_aruba_api/command/stop_single_command.feature} +19 -18
  71. data/features/{api → 04_aruba_api}/command/terminate_all_commands.feature +16 -12
  72. data/features/{api/command/last_command_started.feature → 04_aruba_api/command/use_last_command_started.feature} +0 -0
  73. data/features/{api/command/last_command_stopped.feature → 04_aruba_api/command/use_last_command_stopped.feature} +2 -2
  74. data/features/{api → 04_aruba_api}/core/expand_path.feature +0 -0
  75. data/features/{api → 04_aruba_api}/environment/append_environment_variable.feature +0 -0
  76. data/features/{api → 04_aruba_api}/environment/delete_environment_variable.feature +0 -0
  77. data/features/{api → 04_aruba_api}/environment/prepend_environment_variable.feature +0 -0
  78. data/features/{api → 04_aruba_api}/environment/set_environment_variable.feature +0 -0
  79. data/features/{api/filesystem/cd.feature → 04_aruba_api/filesystem/cd_to_directory.feature} +0 -0
  80. data/features/{api/filesystem/does_exist.feature → 04_aruba_api/filesystem/check_existence_file_or_directory.feature} +0 -0
  81. data/features/{api/filesystem/is_absolute.feature → 04_aruba_api/filesystem/check_if_path_is_absolute.feature} +0 -0
  82. data/features/{api/filesystem/is_directory.feature → 04_aruba_api/filesystem/check_if_path_is_directory.feature} +0 -0
  83. data/features/{api/filesystem/is_file.feature → 04_aruba_api/filesystem/check_if_path_is_file.feature} +0 -0
  84. data/features/{api/filesystem/is_relative.feature → 04_aruba_api/filesystem/check_if_path_is_relative.feature} +0 -0
  85. data/features/{api → 04_aruba_api}/filesystem/create_directory.feature +0 -0
  86. data/features/{api/filesystem/move.feature → 04_aruba_api/filesystem/move_file_or_directory.feature} +0 -0
  87. data/features/{api/filesystem/disk_usage.feature → 04_aruba_api/filesystem/report_disk_usage.feature} +0 -0
  88. data/features/{api/filesystem/fixtures.feature → 04_aruba_api/filesystem/use_fixtures.feature} +0 -0
  89. data/features/{api → 04_aruba_api}/text/extract_text.feature +8 -8
  90. data/features/{api → 04_aruba_api}/text/replace_variables.feature +2 -2
  91. data/features/{api → 04_aruba_api}/text/sanitize_text.feature +22 -22
  92. data/features/{api → 04_aruba_api}/text/unescape_text.feature +12 -12
  93. data/features/{matchers/timeouts.feature → 05_use_rspec_matchers/command/check_timeouts.feature} +4 -4
  94. data/features/{matchers → 05_use_rspec_matchers}/directory/have_sub_directory.feature +0 -0
  95. data/features/{matchers → 05_use_rspec_matchers}/file/be_a_command_found_in_path.feature +0 -0
  96. data/features/{matchers → 05_use_rspec_matchers}/file/be_existing_executable.feature +0 -0
  97. data/features/{matchers → 05_use_rspec_matchers}/file/be_existing_file.feature +0 -0
  98. data/features/{matchers → 05_use_rspec_matchers}/file/have_file_content.feature +0 -0
  99. data/features/{matchers → 05_use_rspec_matchers}/file/have_file_size.feature +0 -0
  100. data/features/{matchers → 05_use_rspec_matchers}/path/be_an_absolute_path.feature +0 -0
  101. data/features/{matchers → 05_use_rspec_matchers}/path/be_an_existing_path.feature +0 -0
  102. data/features/{matchers → 05_use_rspec_matchers}/path/have_permissions.feature +4 -4
  103. data/features/{cli/init.feature → 06_use_aruba_cli/initialize_project_with_aruba.feature} +0 -0
  104. data/features/{cli/console.feature → 06_use_aruba_cli/open_console.feature} +0 -0
  105. data/features/08_other/improve_performance_if_using_jruby.feature +37 -0
  106. data/features/step_definitions/hooks.rb +0 -10
  107. data/features/support/env.rb +1 -1
  108. data/features/support/simplecov_setup.rb +9 -6
  109. data/fixtures/cli-app/bin/{cli → aruba-test-cli} +0 -0
  110. data/fixtures/cli-app/spec/spec_helper.rb +1 -0
  111. data/fixtures/empty-app/lib/cli/app.rb +0 -6
  112. data/lib/aruba/api/commands.rb +24 -0
  113. data/lib/aruba/api/core.rb +9 -2
  114. data/lib/aruba/api/deprecated.rb +2 -73
  115. data/lib/aruba/api/filesystem.rb +1 -1
  116. data/lib/aruba/colorizer.rb +10 -99
  117. data/lib/aruba/config/jruby.rb +15 -5
  118. data/lib/aruba/cucumber.rb +1 -0
  119. data/lib/aruba/cucumber/command.rb +63 -93
  120. data/lib/aruba/cucumber/deprecated.rb +93 -0
  121. data/lib/aruba/cucumber/file.rb +0 -12
  122. data/lib/aruba/cucumber/hooks.rb +0 -44
  123. data/lib/aruba/in_process.rb +2 -0
  124. data/lib/aruba/matchers/string/output_string_eq.rb +1 -1
  125. data/lib/aruba/platforms/announcer.rb +1 -1
  126. data/lib/aruba/platforms/command_monitor.rb +0 -3
  127. data/lib/aruba/processes/spawn_process.rb +17 -5
  128. data/lib/aruba/spawn_process.rb +4 -1
  129. data/lib/aruba/version.rb +1 -1
  130. data/script/bootstrap +0 -4
  131. data/spec/aruba/api/core_spec.rb +142 -0
  132. data/spec/aruba/api/deprecated_spec.rb +113 -0
  133. data/spec/aruba/api/filesystem_spec.rb +746 -0
  134. data/spec/aruba/api_spec.rb +1 -885
  135. data/spec/aruba/jruby_spec.rb +46 -28
  136. data/spec/aruba/{spawn_process_spec.rb → processes/spawn_process_spec.rb} +18 -2
  137. data/spec/spec_helper.rb +5 -3
  138. metadata +108 -115
  139. data/features/development/build.feature +0 -15
  140. data/features/getting_started/writing_good_feature_tests.feature +0 -38
  141. data/features/matchers/collection/include_an_object.feature +0 -72
  142. data/features/platforms/jruby.feature +0 -14
  143. data/features/step_definitions/aruba_dev_steps.rb +0 -56
  144. data/features/steps/command/shell.feature +0 -155
  145. data/features/steps/filesystem/check_file_content.feature +0 -61
  146. data/features/steps/filesystem/fixtures.feature +0 -64
  147. data/features/steps/overview.feature +0 -25
  148. data/spec/aruba/api/environment/restore_env_spec.rb +0 -86
  149. data/spec/aruba/api/environment/set_env_spec.rb +0 -46
  150. data/spec/aruba/api/filesystem/file_size_spec.rb +0 -28
@@ -6,7 +6,7 @@ Feature: Check if a timeout occured during command execution
6
6
  Given I use a fixture named "cli-app"
7
7
 
8
8
  Scenario: Check if command runs to long
9
- Given an executable named "bin/cli" with:
9
+ Given an executable named "bin/aruba-test-cli" with:
10
10
  """
11
11
  #!/bin/bash
12
12
  sleep 1
@@ -18,7 +18,7 @@ Feature: Check if a timeout occured during command execution
18
18
  RSpec.describe 'Long running command', :type => :aruba do
19
19
  before(:each) { aruba.config.exit_timeout = 0 }
20
20
 
21
- before(:each) { run_command('cli') }
21
+ before(:each) { run_command('aruba-test-cli') }
22
22
 
23
23
  it { expect(last_command_started).to run_too_long }
24
24
  end
@@ -27,7 +27,7 @@ Feature: Check if a timeout occured during command execution
27
27
  Then the specs should all pass
28
28
 
29
29
  Scenario: Check if command finishes in time
30
- Given an executable named "bin/cli" with:
30
+ Given an executable named "bin/aruba-test-cli" with:
31
31
  """
32
32
  #!/bin/bash
33
33
  exit 0
@@ -39,7 +39,7 @@ Feature: Check if a timeout occured during command execution
39
39
  RSpec.describe 'Short running command', :type => :aruba do
40
40
  before(:each) { aruba.config.exit_timeout = 5 }
41
41
 
42
- before(:each) { run_command('cli') }
42
+ before(:each) { run_command('aruba-test-cli') }
43
43
 
44
44
  it { expect(last_command_started).to have_finished_in_time }
45
45
  end
@@ -31,7 +31,7 @@ Feature: Check if path has permissions in filesystem
31
31
 
32
32
  RSpec.describe 'Check if path has permissions', :type => :aruba do
33
33
  let(:file) { 'file.txt' }
34
- let(:permissions) { 0700 }
34
+ let(:permissions) { 0600 }
35
35
 
36
36
  before(:each) { touch(file) }
37
37
  before(:each) { chmod(permissions, file) }
@@ -67,7 +67,7 @@ Feature: Check if path has permissions in filesystem
67
67
 
68
68
  RSpec.describe 'Check if path has permissions', :type => :aruba do
69
69
  let(:files) { %w(file1.txt file2.txt) }
70
- let(:permissions) { 0700 }
70
+ let(:permissions) { 0600 }
71
71
 
72
72
  before :each do
73
73
  files.each do |f|
@@ -89,7 +89,7 @@ Feature: Check if path has permissions in filesystem
89
89
 
90
90
  RSpec.describe 'Check if path has permissions', :type => :aruba do
91
91
  let(:files) { %w(file1.txt file2.txt) }
92
- let(:permissions) { 0700 }
92
+ let(:permissions) { 0600 }
93
93
 
94
94
  before :each do
95
95
  touch(files.first)
@@ -109,7 +109,7 @@ Feature: Check if path has permissions in filesystem
109
109
 
110
110
  RSpec.describe 'Check if path has permissions', :type => :aruba do
111
111
  let(:path) { 'file.txt' }
112
- let(:permissions) { 0777 }
112
+ let(:permissions) { 0700 }
113
113
 
114
114
  it { expect(path).to have_permissions permissions }
115
115
  end
@@ -0,0 +1,37 @@
1
+ Feature: Support for JRuby
2
+
3
+ Improve startup time by disabling JIT and forcing client JVM mode. This can
4
+ be accomplished by adding
5
+
6
+ ```ruby
7
+ require 'aruba/config/jruby'
8
+ ```
9
+
10
+ *Note* - no conflict resolution on the JAVA/JRuby environment options is
11
+ done; only merging. For more complex settings please manually set the
12
+ environment variables in the hook or externally.
13
+
14
+ Refer to http://blog.headius.com/2010/03/jruby-startup-time-tips.html for other tips on startup time.
15
+
16
+ Background:
17
+ Given I use a fixture named "cli-app"
18
+
19
+ @requires-ruby-platform-java
20
+ Scenario:
21
+ Given a file named "spec/jruby_env_spec.rb" with:
22
+ """
23
+ require 'spec_helper'
24
+ require 'aruba/config/jruby'
25
+
26
+ RSpec.describe 'running commands with before :command hook', :type => :aruba do
27
+ it 'sets up for efficient JRuby startup' do
28
+ with_environment 'JRUBY_OPTS' => '-d' do
29
+ run_command_and_stop('env')
30
+
31
+ expect(last_command_started.output).to include 'JRUBY_OPTS=--dev -X-C -d'
32
+ end
33
+ end
34
+ end
35
+ """
36
+ When I run `rspec`
37
+ Then the specs should all pass
@@ -10,16 +10,6 @@ Before '@requires-python' do |scenario|
10
10
  end
11
11
  end
12
12
 
13
- Before '@requires-zsh' do |scenario|
14
- next unless Aruba.platform.which('zsh').nil?
15
-
16
- if Cucumber::VERSION < '2'
17
- scenario.skip_invoke!
18
- else
19
- skip_this_scenario
20
- end
21
- end
22
-
23
13
  Before '@requires-java' do |scenario|
24
14
  next unless Aruba.platform.which('javac').nil?
25
15
 
@@ -1,7 +1,7 @@
1
1
  $LOAD_PATH.unshift File.expand_path('../../../lib', __FILE__)
2
2
 
3
3
  # Has to be the first file required so that all other files show coverage information
4
- require 'simplecov'
4
+ require 'simplecov' unless RUBY_PLATFORM.include?('java')
5
5
 
6
6
  # Standard Library
7
7
  require 'fileutils'
@@ -1,8 +1,11 @@
1
- # @note this file is loaded in env.rb to setup simplecov using RUBYOPTs for child processes and @in-process
2
- require 'simplecov'
1
+ # @note this file is loaded in env.rb to setup simplecov using RUBYOPTs for
2
+ # child processes and @in-process
3
+ unless RUBY_PLATFORM.include?('java')
4
+ require 'simplecov'
3
5
 
4
- root = File.expand_path('../../../', __FILE__)
6
+ root = File.expand_path('../../../', __FILE__)
5
7
 
6
- SimpleCov.command_name(ENV['SIMPLECOV_COMMAND_NAME'])
7
- SimpleCov.root(root)
8
- load File.join(root, '.simplecov')
8
+ SimpleCov.command_name(ENV['SIMPLECOV_COMMAND_NAME'])
9
+ SimpleCov.root(root)
10
+ load File.join(root, '.simplecov')
11
+ end
@@ -1,6 +1,7 @@
1
1
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
2
 
3
3
  require 'cli/app'
4
+ require 'support/aruba'
4
5
 
5
6
  if RUBY_VERSION < '1.9.3'
6
7
  ::Dir.glob(::File.expand_path('../support/**/*.rb', __FILE__)).each { |f| require File.join(File.dirname(f), File.basename(f, '.rb')) }
@@ -1,11 +1,5 @@
1
1
  require 'cli/app/version'
2
2
 
3
- if RUBY_VERSION < '1.9.3'
4
- ::Dir.glob(::File.expand_path('../**/*.rb', __FILE__)).each { |f| require File.join(File.dirname(f), File.basename(f, '.rb')) }
5
- else
6
- ::Dir.glob(File.expand_path('../**/*.rb', __FILE__)).each { |f| require_relative f }
7
- end
8
-
9
3
  module Cli
10
4
  module App
11
5
  # Your code goes here...
@@ -103,6 +103,30 @@ module Aruba
103
103
  self
104
104
  end
105
105
 
106
+ # Get stdout of all processes
107
+ #
108
+ # @return [String]
109
+ # The stdout of all processes which have run before
110
+ def all_stdout
111
+ aruba.command_monitor.all_stdout
112
+ end
113
+
114
+ # Get stderr of all processes
115
+ #
116
+ # @return [String]
117
+ # The stderr of all processes which have run before
118
+ def all_stderr
119
+ aruba.command_monitor.all_stderr
120
+ end
121
+
122
+ # Get stderr and stdout of all processes
123
+ #
124
+ # @return [String]
125
+ # The stderr and stdout of all processes which have run before
126
+ def all_output
127
+ aruba.command_monitor.all_output
128
+ end
129
+
106
130
  # Find a started command
107
131
  #
108
132
  # @param [String, Command] commandline
@@ -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
@@ -31,6 +29,15 @@ module Aruba
31
29
  self
32
30
  end
33
31
 
32
+ # Execute block in Aruba's current directory
33
+ #
34
+ # @yield
35
+ # The block which should be run in current directory
36
+ def in_current_directory(&block)
37
+ create_directory '.' unless directory?('.')
38
+ cd('.', &block)
39
+ end
40
+
34
41
  # Switch to directory
35
42
  #
36
43
  # @param [String] dir
@@ -51,22 +51,6 @@ module Aruba
51
51
  setup_aruba
52
52
  end
53
53
 
54
- # @deprecated
55
- # Execute block in current directory
56
- #
57
- # @yield
58
- # The block which should be run in current directory
59
- def in_current_directory(&block)
60
- Aruba.platform.deprecated(
61
- 'The use of "in_current_directory" is deprecated.' \
62
- ' Use "#cd(\'.\') { # your code }" instead. But be aware,' \
63
- ' "cd" requires a previously created directory'
64
- )
65
-
66
- create_directory '.' unless directory?('.')
67
- cd('.', &block)
68
- end
69
-
70
54
  # @deprecated
71
55
  def detect_ruby(cmd)
72
56
  Aruba.platform.deprecated('The use of "#detect_ruby" is deprecated')
@@ -525,11 +509,10 @@ module Aruba
525
509
  def in_current_dir(&block)
526
510
  Aruba.platform.deprecated(
527
511
  'The use of "in_current_dir" is deprecated.' \
528
- ' Use "#cd(\'.\') { }" instead'
512
+ ' Use "#in_current_directory { }" instead'
529
513
  )
530
514
 
531
- create_directory '.' unless directory?('.')
532
- cd('.', &block)
515
+ in_current_directory(&block)
533
516
  end
534
517
 
535
518
  # @deprecated
@@ -1017,60 +1000,6 @@ module Aruba
1017
1000
  process_monitor.stderr_from(cmd)
1018
1001
  end
1019
1002
 
1020
- # @deprecated
1021
- #
1022
- # Get stdout of all processes
1023
- #
1024
- # @return [String]
1025
- # The stdout of all process which have run before
1026
- def all_stdout
1027
- Aruba.platform.deprecated(
1028
- 'The use of "#all_stdout" is deprecated.' \
1029
- ' Use `all_commands.map { |c| c.stdout }.join("\n") instead.' \
1030
- ' If you need to check for some output, use' \
1031
- ' "expect(all_commands).to included_an_object have_output_on_stdout(/output/)"' \
1032
- ' instead'
1033
- )
1034
-
1035
- process_monitor.all_stdout
1036
- end
1037
-
1038
- # @deprecated
1039
- #
1040
- # Get stderr of all processes
1041
- #
1042
- # @return [String]
1043
- # The stderr of all process which have run before
1044
- def all_stderr
1045
- Aruba.platform.deprecated(
1046
- 'The use of "#all_stderr" is deprecated.' \
1047
- ' Use `all_commands.map { |c| c.stderr }.join("\n") instead.' \
1048
- ' If you need to check for some output use' \
1049
- ' "expect(all_commands).to included_an_object have_output_on_stderr /output/"' \
1050
- ' instead'
1051
- )
1052
-
1053
- process_monitor.all_stderr
1054
- end
1055
-
1056
- # @deprecated
1057
- #
1058
- # Get stderr and stdout of all processes
1059
- #
1060
- # @return [String]
1061
- # The stderr and stdout of all process which have run before
1062
- def all_output
1063
- Aruba.platform.deprecated(
1064
- 'The use of "#all_output" is deprecated.' \
1065
- ' Use `all_commands.map { |c| c.output }.join("\n") instead.' \
1066
- ' If you need to check for some output use' \
1067
- ' "expect(all_commands).to included_an_object have_output /output/"' \
1068
- ' instead'
1069
- )
1070
-
1071
- process_monitor.all_output
1072
- end
1073
-
1074
1003
  # @deprecated
1075
1004
  #
1076
1005
  # Default exit timeout for running commands with aruba
@@ -383,7 +383,7 @@ module Aruba
383
383
  # @return [Numeric]
384
384
  # The size of the file
385
385
  def file_size(name)
386
- expect(name).to be_an_existing_file
386
+ raise ArgumentError, "#{name} does not exist" unless exist? name
387
387
 
388
388
  Aruba.platform.determine_file_size expand_path(name)
389
389
  end
@@ -1,108 +1,19 @@
1
+ # Aruba
1
2
  module Aruba
2
- # The ANSIColor module can be used for namespacing and mixed into your own
3
- # classes.
4
- module AnsiColor
5
- # :stopdoc:
6
- ATTRIBUTES = [
7
- [ :clear , 0 ],
8
- [ :reset , 0 ], # synonym for :clear
9
- [ :bold , 1 ],
10
- [ :dark , 2 ],
11
- [ :italic , 3 ], # not widely implemented
12
- [ :underline , 4 ],
13
- [ :underscore , 4 ], # synonym for :underline
14
- [ :blink , 5 ],
15
- [ :rapid_blink , 6 ], # not widely implemented
16
- [ :negative , 7 ], # no reverse because of String#reverse
17
- [ :concealed , 8 ],
18
- [ :strikethrough, 9 ], # not widely implemented
19
- [ :black , 30 ],
20
- [ :red , 31 ],
21
- [ :green , 32 ],
22
- [ :yellow , 33 ],
23
- [ :blue , 34 ],
24
- [ :magenta , 35 ],
25
- [ :cyan , 36 ],
26
- [ :white , 37 ],
27
- [ :on_black , 40 ],
28
- [ :on_red , 41 ],
29
- [ :on_green , 42 ],
30
- [ :on_yellow , 43 ],
31
- [ :on_blue , 44 ],
32
- [ :on_magenta , 45 ],
33
- [ :on_cyan , 46 ],
34
- [ :on_white , 47 ]
35
- ].freeze
36
-
37
- ATTRIBUTE_NAMES = ATTRIBUTES.transpose.first
38
- # :startdoc:
39
-
40
- # Returns true, if the coloring function of this module
41
- # is switched on, false otherwise.
42
- def self.coloring?
43
- @coloring
44
- end
45
-
46
- # Turns the coloring on or off globally, so you can easily do
47
- # this for example:
48
- # Cucumber::Term::ANSIColor::coloring = STDOUT.isatty
49
- def self.coloring=(val)
50
- @coloring = val
51
- end
52
- self.coloring = true
53
-
54
- ATTRIBUTES.each do |c, v|
55
- define_method(c) do |string|
56
- result = ''
57
- result << "\e[#{v}m" if Aruba::AnsiColor.coloring?
58
- if block_given?
59
- result << yield
60
- elsif string
61
- result << string
62
- elsif respond_to?(:to_str)
63
- result << to_str
64
- else
65
- return result #only switch on
66
- end
67
- result << "\e[0m" if Aruba::AnsiColor.coloring?
68
- result
69
- end
70
- end
71
-
72
- # Regular expression that is used to scan for ANSI-sequences while
73
- # uncoloring strings.
74
- COLORED_REGEXP = /\e\[(?:[34][0-7]|[0-9])?m/
3
+ # Simple colorizer class. Only supports the color cyan
4
+ class Colorizer
5
+ class << self
6
+ attr_accessor :coloring
75
7
 
76
- def self.included(klass)
77
- if klass == String
78
- ATTRIBUTES.delete(:clear)
79
- ATTRIBUTE_NAMES.delete(:clear)
80
- end
8
+ alias coloring? coloring
81
9
  end
82
10
 
83
- # Returns an uncolored version of the string, that is all
84
- # ANSI-sequences are stripped from the string.
85
- def uncolored(string = nil) # :yields:
86
- if block_given?
87
- yield.gsub(COLORED_REGEXP, '')
88
- elsif string
89
- string.gsub(COLORED_REGEXP, '')
90
- elsif respond_to?(:to_str)
91
- to_str.gsub(COLORED_REGEXP, '')
11
+ def cyan(string)
12
+ if self.class.coloring?
13
+ "\e[36m#{string}\e[0m"
92
14
  else
93
- ''
15
+ string
94
16
  end
95
17
  end
96
-
97
- # Returns an array of all Aruba::Platforms::AnsiColor attributes as symbols.
98
- def attributes
99
- ATTRIBUTE_NAMES
100
- end
101
- end
102
- end
103
-
104
- module Aruba
105
- class Colorizer
106
- include Aruba::AnsiColor
107
18
  end
108
19
  end