aruba 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +72 -1
  3. data/CONTRIBUTING.md +11 -31
  4. data/README.md +1 -2
  5. data/exe/aruba +2 -2
  6. data/lib/aruba.rb +1 -1
  7. data/lib/aruba/api.rb +11 -12
  8. data/lib/aruba/api/bundler.rb +18 -3
  9. data/lib/aruba/api/commands.rb +19 -22
  10. data/lib/aruba/api/core.rb +65 -48
  11. data/lib/aruba/api/environment.rb +13 -5
  12. data/lib/aruba/api/filesystem.rb +69 -39
  13. data/lib/aruba/api/text.rb +15 -3
  14. data/lib/aruba/aruba_path.rb +3 -4
  15. data/lib/aruba/basic_configuration.rb +52 -71
  16. data/lib/aruba/basic_configuration/option.rb +2 -2
  17. data/lib/aruba/cli.rb +9 -6
  18. data/lib/aruba/command.rb +4 -4
  19. data/lib/aruba/config/jruby.rb +9 -9
  20. data/lib/aruba/config_wrapper.rb +17 -2
  21. data/lib/aruba/configuration.rb +37 -32
  22. data/lib/aruba/console.rb +11 -13
  23. data/lib/aruba/console/help.rb +9 -6
  24. data/lib/aruba/contracts/absolute_path.rb +2 -2
  25. data/lib/aruba/contracts/enum.rb +1 -1
  26. data/lib/aruba/contracts/is_power_of_two.rb +3 -3
  27. data/lib/aruba/contracts/relative_path.rb +2 -2
  28. data/lib/aruba/cucumber.rb +7 -7
  29. data/lib/aruba/cucumber/command.rb +106 -95
  30. data/lib/aruba/cucumber/environment.rb +7 -7
  31. data/lib/aruba/cucumber/file.rb +50 -26
  32. data/lib/aruba/cucumber/hooks.rb +32 -29
  33. data/lib/aruba/cucumber/testing_frameworks.rb +32 -30
  34. data/lib/aruba/event_bus.rb +6 -4
  35. data/lib/aruba/event_bus/name_resolver.rb +12 -11
  36. data/lib/aruba/events.rb +2 -1
  37. data/lib/aruba/file_size.rb +1 -1
  38. data/lib/aruba/generators/script_file.rb +2 -2
  39. data/lib/aruba/hooks.rb +2 -4
  40. data/lib/aruba/in_config_wrapper.rb +8 -5
  41. data/lib/aruba/initializer.rb +14 -12
  42. data/lib/aruba/matchers/base/base_matcher.rb +3 -12
  43. data/lib/aruba/matchers/base/message_indenter.rb +2 -2
  44. data/lib/aruba/matchers/base/object_formatter.rb +2 -5
  45. data/lib/aruba/matchers/collection.rb +1 -1
  46. data/lib/aruba/matchers/collection/all.rb +1 -1
  47. data/lib/aruba/matchers/collection/include_an_object.rb +6 -6
  48. data/lib/aruba/matchers/command.rb +1 -1
  49. data/lib/aruba/matchers/command/be_successfully_executed.rb +6 -4
  50. data/lib/aruba/matchers/command/have_exit_status.rb +3 -1
  51. data/lib/aruba/matchers/command/have_finished_in_time.rb +4 -2
  52. data/lib/aruba/matchers/command/have_output.rb +4 -2
  53. data/lib/aruba/matchers/command/have_output_on_stderr.rb +3 -1
  54. data/lib/aruba/matchers/command/have_output_on_stdout.rb +3 -1
  55. data/lib/aruba/matchers/directory.rb +1 -1
  56. data/lib/aruba/matchers/directory/be_an_existing_directory.rb +2 -2
  57. data/lib/aruba/matchers/directory/have_sub_directory.rb +9 -4
  58. data/lib/aruba/matchers/environment.rb +1 -1
  59. data/lib/aruba/matchers/file.rb +1 -1
  60. data/lib/aruba/matchers/file/be_a_command_found_in_path.rb +1 -1
  61. data/lib/aruba/matchers/file/be_an_existing_executable.rb +2 -2
  62. data/lib/aruba/matchers/file/be_an_existing_file.rb +2 -2
  63. data/lib/aruba/matchers/file/have_file_content.rb +1 -1
  64. data/lib/aruba/matchers/file/have_file_size.rb +5 -3
  65. data/lib/aruba/matchers/file/have_same_file_content.rb +2 -2
  66. data/lib/aruba/matchers/path.rb +1 -1
  67. data/lib/aruba/matchers/path/a_path_matching_pattern.rb +1 -1
  68. data/lib/aruba/matchers/path/be_an_absolute_path.rb +1 -1
  69. data/lib/aruba/matchers/path/be_an_existing_path.rb +1 -1
  70. data/lib/aruba/matchers/path/have_permissions.rb +9 -6
  71. data/lib/aruba/matchers/string.rb +1 -1
  72. data/lib/aruba/matchers/string/include_output_string.rb +1 -1
  73. data/lib/aruba/matchers/string/match_output_string.rb +1 -1
  74. data/lib/aruba/matchers/string/output_string_eq.rb +1 -1
  75. data/lib/aruba/platform.rb +2 -2
  76. data/lib/aruba/platforms/announcer.rb +29 -17
  77. data/lib/aruba/platforms/aruba_file_creator.rb +3 -1
  78. data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +7 -2
  79. data/lib/aruba/platforms/aruba_logger.rb +11 -10
  80. data/lib/aruba/platforms/command_monitor.rb +7 -9
  81. data/lib/aruba/platforms/determine_disk_usage.rb +2 -4
  82. data/lib/aruba/platforms/filesystem_status.rb +20 -14
  83. data/lib/aruba/platforms/simple_table.rb +3 -3
  84. data/lib/aruba/platforms/unix_command_string.rb +2 -2
  85. data/lib/aruba/platforms/unix_environment_variables.rb +2 -4
  86. data/lib/aruba/platforms/unix_platform.rb +23 -23
  87. data/lib/aruba/platforms/unix_which.rb +2 -2
  88. data/lib/aruba/platforms/windows_command_string.rb +2 -2
  89. data/lib/aruba/platforms/windows_environment_variables.rb +3 -2
  90. data/lib/aruba/platforms/windows_platform.rb +7 -7
  91. data/lib/aruba/platforms/windows_which.rb +8 -4
  92. data/lib/aruba/processes/basic_process.rb +4 -4
  93. data/lib/aruba/processes/debug_process.rb +5 -3
  94. data/lib/aruba/processes/in_process.rb +10 -8
  95. data/lib/aruba/processes/spawn_process.rb +28 -25
  96. data/lib/aruba/rspec.rb +30 -20
  97. data/lib/aruba/runtime.rb +16 -9
  98. data/lib/aruba/setup.rb +25 -12
  99. data/lib/aruba/version.rb +1 -1
  100. metadata +77 -88
  101. data/.cucumberproignore +0 -3
  102. data/.document +0 -5
  103. data/.github/ISSUE_TEMPLATE.md +0 -48
  104. data/.github/PULL_REQUEST_TEMPLATE.md +0 -41
  105. data/.gitignore +0 -38
  106. data/.rspec +0 -3
  107. data/.rubocop.yml +0 -31
  108. data/.rubocop_todo.yml +0 -262
  109. data/.simplecov +0 -36
  110. data/.travis.yml +0 -62
  111. data/.yardopts +0 -11
  112. data/Dockerfile +0 -67
  113. data/Gemfile +0 -12
  114. data/Rakefile +0 -80
  115. data/TODO.md +0 -13
  116. data/appveyor.yml +0 -29
  117. data/aruba.gemspec +0 -54
  118. data/bin/console +0 -7
  119. data/bin/test +0 -9
  120. data/config/.gitignore +0 -1
  121. data/cucumber.yml +0 -6
  122. data/docker-compose.yml +0 -26
  123. data/fixtures/cli-app/.gitignore +0 -9
  124. data/fixtures/cli-app/.rspec +0 -2
  125. data/fixtures/cli-app/README.md +0 -39
  126. data/fixtures/cli-app/Rakefile +0 -1
  127. data/fixtures/cli-app/bin/aruba-test-cli +0 -6
  128. data/fixtures/cli-app/cli-app.gemspec +0 -25
  129. data/fixtures/cli-app/features/support/aruba.rb +0 -1
  130. data/fixtures/cli-app/features/support/env.rb +0 -1
  131. data/fixtures/cli-app/lib/cli/app.rb +0 -9
  132. data/fixtures/cli-app/lib/cli/app/suppress_simple_cov_output.rb +0 -15
  133. data/fixtures/cli-app/lib/cli/app/version.rb +0 -5
  134. data/fixtures/cli-app/script/console +0 -14
  135. data/fixtures/cli-app/spec/spec_helper.rb +0 -7
  136. data/fixtures/cli-app/spec/support/aruba.rb +0 -1
  137. data/fixtures/copy/file.txt +0 -1
  138. data/fixtures/empty-app/.gitignore +0 -9
  139. data/fixtures/empty-app/.rspec +0 -2
  140. data/fixtures/empty-app/README.md +0 -24
  141. data/fixtures/empty-app/Rakefile +0 -1
  142. data/fixtures/empty-app/cli-app.gemspec +0 -25
  143. data/fixtures/empty-app/lib/cli/app.rb +0 -7
  144. data/fixtures/empty-app/lib/cli/app/version.rb +0 -5
  145. data/fixtures/getting-started-app/.gitignore +0 -4
  146. data/fixtures/getting-started-app/Gemfile +0 -4
  147. data/fixtures/getting-started-app/README.md +0 -3
  148. data/fixtures/getting-started-app/features/support/env.rb +0 -1
  149. data/lib/aruba/extensions/string/strip.rb +0 -25
  150. data/lib/aruba/tasks/docker_helpers.rb +0 -154
@@ -1 +0,0 @@
1
- require 'bundler/gem_tasks'
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- $LOAD_PATH << File.expand_path('../lib', __dir__)
4
- require 'cli/app'
5
-
6
- exit 0
@@ -1,25 +0,0 @@
1
- lib = File.expand_path('lib', __dir__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require 'cli/app/version'
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = 'cli-app'
7
- spec.version = Cli::App::VERSION
8
- spec.authors = ['Aruba Developers']
9
- spec.email = 'cukes@googlegroups.com'
10
-
11
- spec.summary = 'Summary'
12
- spec.description = 'Description'
13
- spec.homepage = 'http://example.com'
14
-
15
- # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
16
- # delete this section to allow pushing this gem to any host.
17
-
18
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
- spec.bindir = 'exe'
20
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
- spec.require_paths = ['lib']
22
-
23
- spec.add_development_dependency 'bundler', '~> 1.9'
24
- spec.add_development_dependency 'rake', '~> 10.0'
25
- end
@@ -1 +0,0 @@
1
- require 'aruba/cucumber'
@@ -1 +0,0 @@
1
- require_relative 'aruba'
@@ -1,9 +0,0 @@
1
- require 'cli/app/version'
2
-
3
- ::Dir.glob(File.expand_path('**/*.rb', __dir__)).each { |f| require_relative f }
4
-
5
- module Cli
6
- module App
7
- # Your code goes here...
8
- end
9
- end
@@ -1,15 +0,0 @@
1
- module SimpleCov
2
- module Formatter
3
- class HTMLFormatter
4
- def format(result)
5
- Dir[File.join(File.dirname(__FILE__), '../public/*')].each do |path|
6
- FileUtils.cp_r(path, asset_output_path)
7
- end
8
-
9
- File.open(File.join(output_path, 'index.html'), 'wb') do |file|
10
- file.puts template('layout').result(binding)
11
- end
12
- end
13
- end
14
- end
15
- end
@@ -1,5 +0,0 @@
1
- module Cli
2
- module App
3
- VERSION = '0.1.0'.freeze
4
- end
5
- end
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'bundler/setup'
4
- require 'cli/app'
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require 'irb'
14
- IRB.start
@@ -1,7 +0,0 @@
1
- $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
2
-
3
- require 'cli/app'
4
-
5
- require_relative 'support/aruba'
6
-
7
- ::Dir.glob(::File.expand_path('../support/**/*.rb', __FILE__)).each { |f| require_relative f }
@@ -1 +0,0 @@
1
- require 'aruba/rspec'
@@ -1 +0,0 @@
1
- a
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
@@ -1,2 +0,0 @@
1
- --format documentation
2
- --color
@@ -1,24 +0,0 @@
1
- # Empty Cli App
2
-
3
- This is a simple test cli app
4
-
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- ```ruby
10
- gem 'cli-app'
11
- ```
12
-
13
- And then execute:
14
-
15
- $ bundle
16
-
17
- Or install it yourself as:
18
-
19
- $ gem install cli-app
20
-
21
- ## Usage
22
-
23
- Place files in `lib/cli/app/`. They are loaded automatically. If you need a
24
- specific load order, use `require` in your files.
@@ -1 +0,0 @@
1
- require 'bundler/gem_tasks'
@@ -1,25 +0,0 @@
1
- lib = File.expand_path('lib', __dir__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require 'cli/app/version'
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = 'cli-app'
7
- spec.version = Cli::App::VERSION
8
- spec.authors = ['Aruba Developers']
9
- spec.email = 'cukes@googlegroups.com'
10
-
11
- spec.summary = 'Summary'
12
- spec.description = 'Description'
13
- spec.homepage = 'http://example.com'
14
-
15
- # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
16
- # delete this section to allow pushing this gem to any host.
17
-
18
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
- spec.bindir = 'exe'
20
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
- spec.require_paths = ['lib']
22
-
23
- spec.add_development_dependency 'bundler', '~> 1.9'
24
- spec.add_development_dependency 'rake', '~> 10.0'
25
- end
@@ -1,7 +0,0 @@
1
- require 'cli/app/version'
2
-
3
- module Cli
4
- module App
5
- # Your code goes here...
6
- end
7
- end
@@ -1,5 +0,0 @@
1
- module Cli
2
- module App
3
- VERSION = '0.1.0'.freeze
4
- end
5
- end
@@ -1,4 +0,0 @@
1
- /coverage/
2
- /doc/
3
- /pkg/
4
- /tmp/
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'aruba', path: File.expand_path('../../..', __dir__)
4
- gem 'cucumber'
@@ -1,3 +0,0 @@
1
- # Simple Cli App
2
-
3
- This is a simple app to get started with `aruba`.
@@ -1 +0,0 @@
1
- require 'aruba/cucumber'
@@ -1,25 +0,0 @@
1
- # String
2
- class String
3
- # Strips indentation in heredocs.
4
- #
5
- # For example in
6
- #
7
- # if options[:usage]
8
- # puts <<-USAGE.strip_heredoc
9
- # This command does such and such.
10
- #
11
- # Supported options are:
12
- # -h This message
13
- # ...
14
- # USAGE
15
- # end
16
- #
17
- # the user would see the usage message aligned against the left margin.
18
- #
19
- # Technically, it looks for the least indented line in the whole string, and removes
20
- # that amount of leading whitespace.
21
- def strip_heredoc
22
- indent = scan(/^[ \t]*(?=\S)/).min.to_s.size
23
- gsub(/^[ \t]{#{indent}}/, '')
24
- end
25
- end
@@ -1,154 +0,0 @@
1
- require 'psych'
2
-
3
- module Aruba
4
- class DockerRunInstance
5
- protected
6
-
7
- attr_reader :file, :instance
8
-
9
- public
10
-
11
- def initialize(file, instance)
12
- @file = file
13
- @instance = instance
14
- end
15
-
16
- def method_missing(m, *_args)
17
- @file.public_send m, instance
18
- end
19
-
20
- def respond_to_missing?(m)
21
- @file.respond_to? m
22
- end
23
- end
24
-
25
- class DockerBuildCommandLineBuilder
26
- protected
27
-
28
- attr_reader :run_instance, :opts
29
-
30
- public
31
-
32
- def initialize(run_instance, opts = {})
33
- @run_instance = run_instance
34
- @opts = opts
35
- end
36
-
37
- def to_cli
38
- cache = opts[:cache]
39
- application_version = opts[:version]
40
- docker_file = run_instance.docker_file
41
- docker_image = run_instance.image
42
-
43
- cmdline = []
44
- cmdline << 'docker'
45
- cmdline << 'build'
46
- cmdline << '--no-cache=true' if cache == 'false'
47
-
48
- %w(http_proxy https_proxy HTTP_PROXY HTTPS_PROXY).each do |var|
49
- next unless ENV.key? var
50
-
51
- proxy_uri = URI(ENV[var])
52
- proxy_uri.host = '172.17.0.1'
53
- cmdline << "--build-arg #{var}=#{proxy_uri}"
54
- end
55
-
56
- cmdline << "-t #{docker_image}:#{application_version}"
57
- cmdline << "-f #{docker_file}"
58
- cmdline << File.dirname(docker_file)
59
-
60
- cmdline.join(' ')
61
- end
62
- end
63
-
64
- class DockerRunCommandLineBuilder
65
- protected
66
-
67
- attr_reader :run_instance, :opts
68
-
69
- public
70
-
71
- def initialize(run_instance, opts = {})
72
- @run_instance = run_instance
73
- @opts = opts
74
- end
75
-
76
- def to_cli
77
- volumes = run_instance.volumes
78
- image = run_instance.image
79
- command = opts[:command]
80
-
81
- cmdline = []
82
- cmdline << 'docker'
83
- cmdline << 'run'
84
- cmdline << '-it'
85
- cmdline << '--rm'
86
- cmdline << "--name #{run_instance.container_name}"
87
-
88
- volumes.each do |v|
89
- cmdline << "-v #{expand_volume_paths(v)}"
90
- end
91
-
92
- cmdline << image
93
- cmdline << command if command
94
-
95
- cmdline.join(' ')
96
- end
97
-
98
- private
99
-
100
- def expand_volume_paths(volume_paths)
101
- volume_paths.split(':').map { |path| File.expand_path(path) }.join(':')
102
- end
103
- end
104
-
105
- class DockerComposeFile
106
- protected
107
-
108
- attr_reader :data
109
-
110
- public
111
-
112
- def initialize(path)
113
- @data = Psych.load_file(path)['services']
114
- end
115
-
116
- def volumes(instance)
117
- fetch(instance)['volumes']
118
- end
119
-
120
- def build_context(instance)
121
- fetch(instance).fetch('build', {})['context']
122
- end
123
-
124
- def build_arguments(instance)
125
- fetch(instance).fetch('build', {})['args']
126
- end
127
-
128
- def docker_file(instance)
129
- fetch(instance).fetch('build', {})['dockerfile']
130
- end
131
-
132
- def image(instance)
133
- fetch(instance)['image']
134
- end
135
-
136
- def container_name(instance)
137
- fetch(instance)['container_name']
138
- end
139
-
140
- def command(instance)
141
- fetch(instance)['command']
142
- end
143
-
144
- def working_directory(instance)
145
- fetch(instance)['working_dir']
146
- end
147
-
148
- private
149
-
150
- def fetch(instance)
151
- Hash(data).fetch(instance.to_s)
152
- end
153
- end
154
- end