aruba 1.0.0.pre.alpha.2 → 1.0.0.pre.alpha.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +5 -5
  2. data/.github/PULL_REQUEST_TEMPLATE.md +2 -1
  3. data/.rubocop.yml +6 -181
  4. data/.rubocop_todo.yml +364 -0
  5. data/.travis.yml +63 -34
  6. data/.yardopts +3 -0
  7. data/CHANGELOG.md +1121 -0
  8. data/CONTRIBUTING.md +179 -78
  9. data/Gemfile +29 -44
  10. data/README.md +41 -11
  11. data/Rakefile +35 -35
  12. data/appveyor.yml +6 -5
  13. data/aruba.gemspec +14 -16
  14. data/bin/console +2 -11
  15. data/cucumber.yml +0 -7
  16. data/fixtures/cli-app/README.md +1 -1
  17. data/fixtures/cli-app/Rakefile +1 -1
  18. data/fixtures/cli-app/cli-app.gemspec +1 -0
  19. data/fixtures/cli-app/lib/cli/app/suppress_simple_cov_output.rb +3 -3
  20. data/fixtures/cli-app/lib/cli/app/version.rb +1 -1
  21. data/fixtures/empty-app/Rakefile +1 -1
  22. data/fixtures/empty-app/cli-app.gemspec +1 -0
  23. data/fixtures/empty-app/lib/cli/app/version.rb +1 -1
  24. data/fixtures/getting-started-app/Gemfile +1 -1
  25. data/lib/aruba/api.rb +3 -10
  26. data/lib/aruba/api/bundler.rb +16 -0
  27. data/lib/aruba/api/commands.rb +249 -0
  28. data/lib/aruba/api/core.rb +24 -10
  29. data/lib/aruba/api/environment.rb +12 -7
  30. data/lib/aruba/api/filesystem.rb +22 -20
  31. data/lib/aruba/api/text.rb +3 -9
  32. data/lib/aruba/aruba_path.rb +3 -18
  33. data/lib/aruba/basic_configuration.rb +3 -19
  34. data/lib/aruba/cli.rb +1 -1
  35. data/lib/aruba/colorizer.rb +33 -33
  36. data/lib/aruba/command.rb +4 -0
  37. data/lib/aruba/config_wrapper.rb +1 -1
  38. data/lib/aruba/configuration.rb +78 -0
  39. data/lib/aruba/console.rb +5 -5
  40. data/lib/aruba/console/help.rb +1 -1
  41. data/lib/aruba/cucumber.rb +0 -1
  42. data/lib/aruba/cucumber/command.rb +55 -115
  43. data/lib/aruba/cucumber/environment.rb +1 -1
  44. data/lib/aruba/cucumber/file.rb +9 -21
  45. data/lib/aruba/cucumber/hooks.rb +6 -62
  46. data/lib/aruba/event_bus/name_resolver.rb +1 -2
  47. data/lib/aruba/hooks.rb +1 -1
  48. data/lib/aruba/initializer.rb +3 -3
  49. data/lib/aruba/matchers/base/base_matcher.rb +2 -2
  50. data/lib/aruba/matchers/base/message_indenter.rb +19 -0
  51. data/lib/aruba/matchers/base/object_formatter.rb +2 -2
  52. data/lib/aruba/matchers/collection/include_an_object.rb +7 -9
  53. data/lib/aruba/matchers/command/be_successfully_executed.rb +2 -4
  54. data/lib/aruba/matchers/command/have_exit_status.rb +1 -1
  55. data/lib/aruba/matchers/command/have_finished_in_time.rb +2 -4
  56. data/lib/aruba/matchers/command/have_output.rb +9 -4
  57. data/lib/aruba/matchers/command/have_output_on_stderr.rb +1 -1
  58. data/lib/aruba/matchers/command/have_output_on_stdout.rb +1 -1
  59. data/lib/aruba/matchers/command/have_output_size.rb +1 -1
  60. data/lib/aruba/matchers/directory/be_an_existing_directory.rb +4 -6
  61. data/lib/aruba/matchers/directory/have_sub_directory.rb +4 -6
  62. data/lib/aruba/matchers/file/be_a_command_found_in_path.rb +2 -4
  63. data/lib/aruba/matchers/file/be_an_existing_executable.rb +4 -6
  64. data/lib/aruba/matchers/file/be_an_existing_file.rb +4 -6
  65. data/lib/aruba/matchers/file/have_file_content.rb +4 -4
  66. data/lib/aruba/matchers/file/have_file_size.rb +6 -8
  67. data/lib/aruba/matchers/file/have_same_file_content.rb +9 -12
  68. data/lib/aruba/matchers/path/a_path_matching_pattern.rb +2 -4
  69. data/lib/aruba/matchers/path/be_an_absolute_path.rb +3 -5
  70. data/lib/aruba/matchers/path/be_an_existing_path.rb +4 -6
  71. data/lib/aruba/matchers/path/have_permissions.rb +6 -8
  72. data/lib/aruba/matchers/string/include_output_string.rb +8 -10
  73. data/lib/aruba/matchers/string/match_output_string.rb +9 -11
  74. data/lib/aruba/matchers/string/output_string_eq.rb +7 -9
  75. data/lib/aruba/platform.rb +0 -1
  76. data/lib/aruba/platforms/announcer.rb +26 -70
  77. data/lib/aruba/platforms/aruba_file_creator.rb +1 -1
  78. data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +2 -2
  79. data/lib/aruba/platforms/aruba_logger.rb +22 -2
  80. data/lib/aruba/platforms/command_monitor.rb +2 -125
  81. data/lib/aruba/platforms/filesystem_status.rb +9 -9
  82. data/lib/aruba/platforms/local_environment.rb +2 -2
  83. data/lib/aruba/platforms/simple_table.rb +3 -3
  84. data/lib/aruba/platforms/unix_command_string.rb +7 -4
  85. data/lib/aruba/platforms/unix_environment_variables.rb +9 -13
  86. data/lib/aruba/platforms/unix_platform.rb +2 -27
  87. data/lib/aruba/platforms/unix_which.rb +2 -1
  88. data/lib/aruba/platforms/windows_command_string.rb +20 -7
  89. data/lib/aruba/platforms/windows_environment_variables.rb +35 -30
  90. data/lib/aruba/platforms/windows_which.rb +4 -3
  91. data/lib/aruba/processes/basic_process.rb +11 -15
  92. data/lib/aruba/processes/debug_process.rb +5 -0
  93. data/lib/aruba/processes/in_process.rb +17 -8
  94. data/lib/aruba/processes/spawn_process.rb +35 -23
  95. data/lib/aruba/rspec.rb +9 -22
  96. data/lib/aruba/runtime.rb +7 -5
  97. data/lib/aruba/setup.rb +6 -4
  98. data/lib/aruba/tasks/docker_helpers.rb +1 -1
  99. data/lib/aruba/version.rb +1 -1
  100. metadata +37 -57
  101. data/History.md +0 -612
  102. data/bin/bootstrap +0 -34
  103. data/fixtures/spawn_process/stderr.sh +0 -3
  104. data/lib/aruba/api/command.rb +0 -309
  105. data/lib/aruba/api/deprecated.rb +0 -895
  106. data/lib/aruba/api/rvm.rb +0 -44
  107. data/lib/aruba/config.rb +0 -101
  108. data/lib/aruba/cucumber/rvm.rb +0 -3
  109. data/lib/aruba/in_process.rb +0 -14
  110. data/lib/aruba/jruby.rb +0 -4
  111. data/lib/aruba/matchers/path/match_path_pattern.rb +0 -41
  112. data/lib/aruba/matchers/rspec_matcher_include_regexp.rb +0 -25
  113. data/lib/aruba/spawn_process.rb +0 -11
@@ -1,44 +0,0 @@
1
- require 'aruba/api/environment'
2
- require 'aruba/api/command'
3
-
4
- # Aruba
5
- module Aruba
6
- # Api
7
- module Api
8
- # RVM
9
- #
10
- # @deprecated
11
- module Rvm
12
- # Use a clean rvm gemset
13
- #
14
- # Please make sure that you've got [rvm](http://rvm.io/) installed.
15
- #
16
- # @param [String] gemset
17
- # The name of the gemset to be used
18
- def use_clean_gemset(gemset)
19
- run_command_and_stop(%{rvm gemset create "#{gemset}"}, true)
20
- if all_stdout =~ /'#{gemset}' gemset created \((.*)\)\./
21
- gem_home = Regexp.last_match[1]
22
- set_environment_variable('GEM_HOME', gem_home)
23
- set_environment_variable('GEM_PATH', gem_home)
24
- set_environment_variable('BUNDLE_PATH', gem_home)
25
-
26
- paths = (ENV['PATH'] || "").split(File::PATH_SEPARATOR)
27
- paths.unshift(File.join(gem_home, 'bin'))
28
- set_environment_variable('PATH', paths.uniq.join(File::PATH_SEPARATOR))
29
-
30
- run_command_and_stop("gem install bundler", true)
31
- else
32
- raise "I didn't understand rvm's output: #{all_stdout}"
33
- end
34
- end
35
-
36
- # Unset variables used by bundler
37
- def unset_bundler_env_vars
38
- %w[RUBYOPT BUNDLE_PATH BUNDLE_BIN_PATH BUNDLE_GEMFILE].each do |key|
39
- set_environment_variable(key, nil)
40
- end
41
- end
42
- end
43
- end
44
- end
@@ -1,101 +0,0 @@
1
- require 'contracts'
2
-
3
- require 'aruba/version'
4
- require 'aruba/basic_configuration'
5
- require 'aruba/in_config_wrapper'
6
- require 'aruba/hooks'
7
-
8
- require 'aruba/contracts/relative_path'
9
- require 'aruba/contracts/absolute_path'
10
- require 'aruba/contracts/enum'
11
-
12
- require 'aruba/contracts/is_power_of_two'
13
-
14
- # Aruba
15
- module Aruba
16
- # Aruba Configuration
17
- #
18
- # This defines the configuration options of aruba
19
- class Configuration < BasicConfiguration
20
- if Aruba::VERSION >= '1.0.0'
21
- option_reader :root_directory, :contract => { None => String }, :default => Dir.getwd
22
- else
23
- option_accessor :root_directory, :contract => { String => String }, :default => Dir.getwd
24
- end
25
-
26
- option_accessor :working_directory, :contract => { Aruba::Contracts::RelativePath => Aruba::Contracts::RelativePath }, :default => 'tmp/aruba'
27
-
28
- option_reader :fixtures_path_prefix, :contract => { None => String }, :default => ?%
29
-
30
- option_accessor :exit_timeout, :contract => { Num => Num }, :default => 15
31
- option_accessor :stop_signal, :contract => { Maybe[String] => Maybe[String] }, :default => nil
32
- option_accessor :io_wait_timeout, :contract => { Num => Num }, :default => 0.1
33
- option_accessor :startup_wait_time, :contract => { Num => Num }, :default => 0
34
- option_accessor :fixtures_directories, :contract => { Array => ArrayOf[String] }, :default => %w(features/fixtures spec/fixtures test/fixtures fixtures)
35
- option_accessor :command_runtime_environment, :contract => { Hash => Hash }, :default => ENV.to_hash
36
- # rubocop:disable Metrics/LineLength
37
- option_accessor(:command_search_paths, :contract => { ArrayOf[String] => ArrayOf[String] }) { |config| [File.join(config.root_directory.value, 'bin'), File.join(config.root_directory.value, 'exe')] }
38
- # rubocop:enable Metrics/LineLength
39
- option_accessor :keep_ansi, :contract => { Bool => Bool }, :default => false
40
- option_accessor :remove_ansi_escape_sequences, :contract => { Bool => Bool }, :default => true
41
- # rubocop:disable Metrics/LineLength
42
- option_accessor :command_launcher, :contract => { Aruba::Contracts::Enum[:in_process, :spawn, :debug] => Aruba::Contracts::Enum[:in_process, :spawn, :debug] }, :default => :spawn
43
- option_accessor :main_class, :contract => { Class => Maybe[Class] }, :default => nil
44
-
45
- if Aruba::VERSION >= '1.0.0'
46
- option_accessor :home_directory, :contract => { Or[Aruba::Contracts::AbsolutePath, Aruba::Contracts::RelativePath] => Or[Aruba::Contracts::AbsolutePath, Aruba::Contracts::RelativePath] } do |config|
47
- File.join(config.root_directory.value, config.working_directory.value)
48
- end
49
- else
50
- option_accessor :home_directory, :contract => { Or[Aruba::Contracts::AbsolutePath, Aruba::Contracts::RelativePath] => Or[Aruba::Contracts::AbsolutePath, Aruba::Contracts::RelativePath] }, :default => ENV['HOME']
51
- end
52
-
53
- option_accessor :log_level, :contract => { Aruba::Contracts::Enum[:fatal, :warn, :debug, :info, :error, :unknown, :silent] => Aruba::Contracts::Enum[:fatal, :warn, :debug, :info, :error, :unknown, :silent] }, :default => :info
54
-
55
- # TODO: deprecate this value and replace with "filesystem allocation unit"
56
- # equal to 4096 by default. "filesystem allocation unit" would represent
57
- # the actual MINIMUM space taken in bytes by a 1-byte file
58
- option_accessor :physical_block_size, :contract => { Aruba::Contracts::IsPowerOfTwo => Aruba::Contracts::IsPowerOfTwo }, :default => 512
59
- option_accessor :console_history_file, :contract => { String => String }, :default => '~/.aruba_history'
60
-
61
- option_accessor :activate_announcer_on_command_failure, :contract => { ArrayOf[Symbol] => ArrayOf[Symbol] }, :default => []
62
- end
63
- end
64
-
65
- # Aruba
66
- module Aruba
67
- @config = Configuration.new
68
-
69
- class << self
70
- attr_reader :config
71
-
72
- # Configure aruba
73
- #
74
- # @example How to configure aruba
75
- #
76
- # Aruba.configure do |config|
77
- # config.<option> = <value>
78
- # end
79
- #
80
- def configure(&block)
81
- @config.configure(&block)
82
-
83
- self
84
- end
85
- end
86
- end
87
-
88
- # Aruba
89
- module Aruba
90
- # Old Config
91
- #
92
- # @private
93
- # @deprecated
94
- class Config < Configuration
95
- def initialize(*args)
96
- warn('The use of "Aruba::Config" is deprecated. Use "Aruba::Configuration" instead.')
97
-
98
- super
99
- end
100
- end
101
- end
@@ -1,3 +0,0 @@
1
- Given(/^I'm using a clean gemset "([^"]*)"$/) do |gemset|
2
- use_clean_gemset(gemset)
3
- end
@@ -1,14 +0,0 @@
1
- require 'aruba/processes/in_process'
2
- require 'aruba/platform'
3
-
4
- # Aruba
5
- module Aruba
6
- # @deprecated
7
- class InProcess < Aruba::Processes::InProcess
8
- def initialize(*args)
9
- Aruba.platform.deprecated('The use of "Aruba::InProcess" is deprecated. Use "Aruba::Processes::InProcess" instead.')
10
-
11
- super
12
- end
13
- end
14
- end
@@ -1,4 +0,0 @@
1
- require 'aruba/platform'
2
- Aruba.platform.deprecated('The use of "aruba/jruby" is deprecated. Use "aruba/config/jruby" instead')
3
-
4
- require 'aruba/config/jruby'
@@ -1,41 +0,0 @@
1
- # @!method match_path_pattern(pattern)
2
- # This matchers checks if <files>/directories match <pattern>
3
- #
4
- # @param [String, Regexp] pattern
5
- # The pattern to use.
6
- #
7
- # @return [TrueClass, FalseClass] The result
8
- #
9
- # false:
10
- # * if there are no files/directories which match the pattern
11
- # true:
12
- # * if there are files/directories which match the pattern
13
- #
14
- # @example Use matcher with regex
15
- #
16
- # RSpec.describe do
17
- # it { expect(Dir.glob(**/*)).to match_file_pattern(/.txt$/) }
18
- # end
19
- #
20
- # @example Use matcher with string
21
- #
22
- # RSpec.describe do
23
- # it { expect(Dir.glob(**/*)).to match_file_pattern('.txt$') }
24
- # end
25
- RSpec::Matchers.define :match_path_pattern do |_|
26
- match do |actual|
27
- Aruba.platform.deprecated('The use of `expect().to match_path_pattern` is deprecated. Please use `expect().to include pattern /regex/` instead.')
28
-
29
- next !actual.select { |a| a == expected }.empty? if expected.is_a? String
30
-
31
- !actual.grep(expected).empty?
32
- end
33
-
34
- failure_message do |actual|
35
- format("expected that path \"%s\" matches pattern \"%s\".", actual.join(", "), expected)
36
- end
37
-
38
- failure_message_when_negated do |actual|
39
- format("expected that path \"%s\" does not match pattern \"%s\".", actual.join(", "), expected)
40
- end
41
- end
@@ -1,25 +0,0 @@
1
- # @!method include_regexp(regexp)
2
- # This matchers checks if items of an <array> matches regexp
3
- #
4
- # @param [Regexp] regexp
5
- # The regular expression to use
6
- #
7
- # @return [TrueClass, FalseClass] The result
8
- #
9
- # false:
10
- # * if regexp does not match
11
- # true:
12
- # * if regexp matches
13
- #
14
- # @example Use matcher
15
- #
16
- # RSpec.describe do
17
- # it { expect(%w(asdf qwert)).to include_regexp(/asdf/) }
18
- # end
19
- RSpec::Matchers.define :include_regexp do |expected|
20
- match do |actual|
21
- Aruba.platform.deprecated('The use of "include_regexp"-matchers is deprecated. It will be removed soon.')
22
-
23
- !actual.grep(expected).empty?
24
- end
25
- end
@@ -1,11 +0,0 @@
1
- require 'aruba/processes/spawn_process'
2
-
3
- module Aruba
4
- class SpawnProcess < Aruba::Processes::SpawnProcess
5
- def initialize(*args)
6
- warn('The use of "Aruba::SpawnProcess" is deprecated. Use "Aruba::Processes::SpawnProcess" instead.')
7
-
8
- super
9
- end
10
- end
11
- end