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.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -0
  3. data/.travis.yml +3 -1
  4. data/Gemfile +13 -10
  5. data/History.md +25 -7
  6. data/README.md +6 -1
  7. data/Rakefile +16 -3
  8. data/aruba.gemspec +10 -2
  9. data/bin/aruba +7 -0
  10. data/cucumber.yml +11 -2
  11. data/features/api/command/extract_text.feature +97 -0
  12. data/features/api/command/unescape_text.feature +119 -0
  13. data/features/api/core/expand_path.feature +16 -0
  14. data/features/api/{cd.feature → filesystem/cd.feature} +2 -1
  15. data/features/api/filesystem/create_directory.feature +57 -0
  16. data/features/api/filesystem/disk_usage.feature +151 -0
  17. data/features/api/filesystem/does_exist.feature +62 -0
  18. data/features/api/filesystem/is_absolute.feature +48 -0
  19. data/features/api/filesystem/is_directory.feature +53 -0
  20. data/features/api/filesystem/is_file.feature +54 -0
  21. data/features/api/filesystem/is_relative.feature +48 -0
  22. data/features/cli/console.feature +52 -0
  23. data/features/configuration/console_history_file.feature +38 -0
  24. data/features/configuration/exit_timeout.feature +2 -1
  25. data/features/configuration/fixtures_path_prefix.feature +0 -1
  26. data/features/configuration/home_directory.feature +0 -1
  27. data/features/configuration/io_timeout.feature +0 -1
  28. data/features/configuration/keep_ansi.feature +1 -2
  29. data/features/configuration/log_level.feature +38 -0
  30. data/features/configuration/physical_block_size.feature +53 -0
  31. data/features/configuration/remove_ansi_escape_sequences.feature +38 -0
  32. data/features/configuration/root_directory.feature +0 -1
  33. data/features/configuration/working_directory.feature +2 -1
  34. data/features/fixtures/cli-app/README.md +5 -0
  35. data/features/fixtures/cli-app/lib/cli/app.rb +1 -1
  36. data/features/fixtures/cli-app/spec/spec_helper.rb +1 -2
  37. data/features/fixtures/cli-app/spec/support/aruba.rb +1 -0
  38. data/features/fixtures/empty-app/lib/cli/app.rb +1 -1
  39. data/features/fixtures/empty-app/spec/spec_helper.rb +1 -1
  40. data/features/step_definitions/aruba_dev_steps.rb +12 -1
  41. data/features/support/env.rb +1 -1
  42. data/lib/aruba/announcer.rb +1 -14
  43. data/lib/aruba/api.rb +6 -6
  44. data/lib/aruba/api/command.rb +74 -12
  45. data/lib/aruba/api/core.rb +18 -11
  46. data/lib/aruba/api/deprecated.rb +60 -72
  47. data/lib/aruba/api/filesystem.rb +41 -16
  48. data/lib/aruba/aruba_logger.rb +77 -0
  49. data/lib/aruba/aruba_path.rb +33 -0
  50. data/lib/aruba/basic_configuration.rb +2 -2
  51. data/lib/aruba/cli.rb +11 -0
  52. data/lib/aruba/config.rb +13 -3
  53. data/lib/aruba/config/jruby.rb +5 -2
  54. data/lib/aruba/console.rb +66 -0
  55. data/lib/aruba/console/help.rb +33 -0
  56. data/lib/aruba/contracts/is_power_of_two.rb +15 -0
  57. data/lib/aruba/cucumber.rb +27 -10
  58. data/lib/aruba/cucumber/hooks.rb +15 -8
  59. data/lib/aruba/disk_usage_calculator.rb +7 -0
  60. data/lib/aruba/file_size.rb +52 -0
  61. data/lib/aruba/in_process.rb +1 -1
  62. data/lib/aruba/jruby.rb +1 -1
  63. data/lib/aruba/matchers/command.rb +1 -1
  64. data/lib/aruba/matchers/directory.rb +1 -1
  65. data/lib/aruba/matchers/environment.rb +1 -1
  66. data/lib/aruba/matchers/file.rb +1 -1
  67. data/lib/aruba/matchers/path.rb +1 -1
  68. data/lib/aruba/matchers/path/match_path_pattern.rb +1 -1
  69. data/lib/aruba/matchers/rspec_matcher_include_regexp.rb +1 -1
  70. data/lib/aruba/platform.rb +14 -242
  71. data/lib/aruba/{creators → platforms}/aruba_file_creator.rb +3 -3
  72. data/lib/aruba/{creators → platforms}/aruba_fixed_size_file_creator.rb +2 -2
  73. data/lib/aruba/platforms/simple_table.rb +36 -0
  74. data/lib/aruba/platforms/unix_command_string.rb +24 -0
  75. data/lib/aruba/platforms/unix_environment_variables.rb +130 -0
  76. data/lib/aruba/platforms/unix_platform.rb +226 -0
  77. data/lib/aruba/platforms/unix_which.rb +83 -0
  78. data/lib/aruba/platforms/windows_command_string.rb +23 -0
  79. data/lib/aruba/platforms/windows_environment_variables.rb +83 -0
  80. data/lib/aruba/platforms/windows_platform.rb +39 -0
  81. data/lib/aruba/platforms/windows_which.rb +104 -0
  82. data/lib/aruba/process_monitor.rb +3 -3
  83. data/lib/aruba/processes/basic_process.rb +23 -3
  84. data/lib/aruba/processes/debug_process.rb +2 -2
  85. data/lib/aruba/processes/in_process.rb +1 -1
  86. data/lib/aruba/processes/spawn_process.rb +10 -4
  87. data/lib/aruba/reporting.rb +1 -1
  88. data/lib/aruba/rspec.rb +8 -6
  89. data/lib/aruba/runtime.rb +8 -5
  90. data/lib/aruba/version.rb +1 -1
  91. data/spec/aruba/api_spec.rb +25 -23
  92. data/spec/aruba/aruba_path_spec.rb +37 -0
  93. data/spec/aruba/jruby_spec.rb +1 -1
  94. data/spec/aruba/matchers/file_spec.rb +2 -2
  95. data/spec/aruba/matchers/path_spec.rb +3 -3
  96. data/spec/aruba/platform/simple_table_spec.rb +23 -0
  97. data/spec/aruba/platform/windows_environment_variables_spec.rb +500 -0
  98. data/spec/aruba/spawn_process_spec.rb +3 -1
  99. metadata +90 -12
  100. data/lib/aruba/contracts/is_a.rb +0 -21
  101. data/lib/aruba/environment.rb +0 -121
@@ -1,12 +1,14 @@
1
1
  require 'aruba/processes/spawn_process'
2
2
 
3
3
  RSpec.describe Aruba::Processes::SpawnProcess do
4
- subject(:process) { described_class.new(command, exit_timeout, io_wait, working_directory) }
4
+ subject(:process) { described_class.new(command, exit_timeout, io_wait, working_directory, environment, main_class) }
5
5
 
6
6
  let(:command) { 'echo "yo"' }
7
7
  let(:exit_timeout) { 1 }
8
8
  let(:io_wait) { 1 }
9
9
  let(:working_directory) { Dir.getwd }
10
+ let(:environment) { ENV.to_hash.dup }
11
+ let(:main_class) { nil }
10
12
 
11
13
  describe "#stdout" do
12
14
  before(:each) { process.run! }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aruba
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.0.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aslak Hellesøy
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2015-07-15 00:00:00.000000000 Z
16
+ date: 2015-08-12 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: cucumber
@@ -43,6 +43,20 @@ dependencies:
43
43
  - - "~>"
44
44
  - !ruby/object:Gem::Version
45
45
  version: 0.5.6
46
+ - !ruby/object:Gem::Dependency
47
+ name: ffi
48
+ requirement: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: 1.9.10
53
+ type: :runtime
54
+ prerelease: false
55
+ version_requirements: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: 1.9.10
46
60
  - !ruby/object:Gem::Dependency
47
61
  name: rspec-expectations
48
62
  requirement: !ruby/object:Gem::Requirement
@@ -71,6 +85,20 @@ dependencies:
71
85
  - - "~>"
72
86
  - !ruby/object:Gem::Version
73
87
  version: '0.9'
88
+ - !ruby/object:Gem::Dependency
89
+ name: thor
90
+ requirement: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - "~>"
93
+ - !ruby/object:Gem::Version
94
+ version: '0.19'
95
+ type: :runtime
96
+ prerelease: false
97
+ version_requirements: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - "~>"
100
+ - !ruby/object:Gem::Version
101
+ version: '0.19'
74
102
  - !ruby/object:Gem::Dependency
75
103
  name: bundler
76
104
  requirement: !ruby/object:Gem::Requirement
@@ -88,7 +116,8 @@ dependencies:
88
116
  description: Extension for popular TDD and BDD frameworks like "Cucumber" and "RSpec"
89
117
  to make testing commandline applications meaningful, easy and fun.
90
118
  email: cukes@googlegroups.com
91
- executables: []
119
+ executables:
120
+ - aruba
92
121
  extensions: []
93
122
  extra_rdoc_files: []
94
123
  files:
@@ -109,22 +138,37 @@ files:
109
138
  - TODO.md
110
139
  - appveyor.yml
111
140
  - aruba.gemspec
141
+ - bin/aruba
112
142
  - config/.gitignore
113
143
  - cucumber.yml
114
144
  - doc/dependency_decisions.yml
115
- - features/api/cd.feature
145
+ - features/api/command/extract_text.feature
116
146
  - features/api/command/run.feature
147
+ - features/api/command/unescape_text.feature
117
148
  - features/api/command/which.feature
118
149
  - features/api/core/expand_path.feature
119
150
  - features/api/environment/append_environment_variable.feature
120
151
  - features/api/environment/prepend_environment_variable.feature
121
152
  - features/api/environment/set_environment_variable.feature
153
+ - features/api/filesystem/cd.feature
154
+ - features/api/filesystem/create_directory.feature
155
+ - features/api/filesystem/disk_usage.feature
156
+ - features/api/filesystem/does_exist.feature
157
+ - features/api/filesystem/is_absolute.feature
158
+ - features/api/filesystem/is_directory.feature
159
+ - features/api/filesystem/is_file.feature
160
+ - features/api/filesystem/is_relative.feature
161
+ - features/cli/console.feature
162
+ - features/configuration/console_history_file.feature
122
163
  - features/configuration/exit_timeout.feature
123
164
  - features/configuration/fixtures_directories.feature
124
165
  - features/configuration/fixtures_path_prefix.feature
125
166
  - features/configuration/home_directory.feature
126
167
  - features/configuration/io_timeout.feature
127
168
  - features/configuration/keep_ansi.feature
169
+ - features/configuration/log_level.feature
170
+ - features/configuration/physical_block_size.feature
171
+ - features/configuration/remove_ansi_escape_sequences.feature
128
172
  - features/configuration/root_directory.feature
129
173
  - features/configuration/working_directory.feature
130
174
  - features/debug.feature
@@ -141,6 +185,7 @@ files:
141
185
  - features/fixtures/cli-app/script/console
142
186
  - features/fixtures/cli-app/spec/cli/app_spec.rb
143
187
  - features/fixtures/cli-app/spec/spec_helper.rb
188
+ - features/fixtures/cli-app/spec/support/aruba.rb
144
189
  - features/fixtures/copy/file.txt
145
190
  - features/fixtures/empty-app/.gitignore
146
191
  - features/fixtures/empty-app/.rspec
@@ -190,24 +235,27 @@ files:
190
235
  - lib/aruba/api/environment.rb
191
236
  - lib/aruba/api/filesystem.rb
192
237
  - lib/aruba/api/rvm.rb
238
+ - lib/aruba/aruba_logger.rb
193
239
  - lib/aruba/aruba_path.rb
194
240
  - lib/aruba/basic_configuration.rb
195
241
  - lib/aruba/basic_configuration/option.rb
242
+ - lib/aruba/cli.rb
196
243
  - lib/aruba/command.rb
197
244
  - lib/aruba/config.rb
198
245
  - lib/aruba/config/jruby.rb
199
246
  - lib/aruba/config_wrapper.rb
247
+ - lib/aruba/console.rb
248
+ - lib/aruba/console/help.rb
200
249
  - lib/aruba/contracts/absolute_path.rb
201
250
  - lib/aruba/contracts/enum.rb
202
- - lib/aruba/contracts/is_a.rb
251
+ - lib/aruba/contracts/is_power_of_two.rb
203
252
  - lib/aruba/contracts/relative_path.rb
204
- - lib/aruba/creators/aruba_file_creator.rb
205
- - lib/aruba/creators/aruba_fixed_size_file_creator.rb
206
253
  - lib/aruba/cucumber.rb
207
254
  - lib/aruba/cucumber/hooks.rb
208
- - lib/aruba/environment.rb
255
+ - lib/aruba/disk_usage_calculator.rb
209
256
  - lib/aruba/errors.rb
210
257
  - lib/aruba/extensions/string/strip.rb
258
+ - lib/aruba/file_size.rb
211
259
  - lib/aruba/hooks.rb
212
260
  - lib/aruba/in_process.rb
213
261
  - lib/aruba/jruby.rb
@@ -233,6 +281,17 @@ files:
233
281
  - lib/aruba/matchers/rspec.rb
234
282
  - lib/aruba/matchers/rspec_matcher_include_regexp.rb
235
283
  - lib/aruba/platform.rb
284
+ - lib/aruba/platforms/aruba_file_creator.rb
285
+ - lib/aruba/platforms/aruba_fixed_size_file_creator.rb
286
+ - lib/aruba/platforms/simple_table.rb
287
+ - lib/aruba/platforms/unix_command_string.rb
288
+ - lib/aruba/platforms/unix_environment_variables.rb
289
+ - lib/aruba/platforms/unix_platform.rb
290
+ - lib/aruba/platforms/unix_which.rb
291
+ - lib/aruba/platforms/windows_command_string.rb
292
+ - lib/aruba/platforms/windows_environment_variables.rb
293
+ - lib/aruba/platforms/windows_platform.rb
294
+ - lib/aruba/platforms/windows_which.rb
236
295
  - lib/aruba/process_monitor.rb
237
296
  - lib/aruba/processes/basic_process.rb
238
297
  - lib/aruba/processes/debug_process.rb
@@ -258,6 +317,8 @@ files:
258
317
  - spec/aruba/matchers/directory_spec.rb
259
318
  - spec/aruba/matchers/file_spec.rb
260
319
  - spec/aruba/matchers/path_spec.rb
320
+ - spec/aruba/platform/simple_table_spec.rb
321
+ - spec/aruba/platform/windows_environment_variables_spec.rb
261
322
  - spec/aruba/rspec_spec.rb
262
323
  - spec/aruba/runtime_spec.rb
263
324
  - spec/aruba/spawn_process_spec.rb
@@ -310,29 +371,43 @@ required_ruby_version: !ruby/object:Gem::Requirement
310
371
  version: 1.8.7
311
372
  required_rubygems_version: !ruby/object:Gem::Requirement
312
373
  requirements:
313
- - - ">="
374
+ - - ">"
314
375
  - !ruby/object:Gem::Version
315
- version: '0'
376
+ version: 1.3.1
316
377
  requirements: []
317
378
  rubyforge_project:
318
379
  rubygems_version: 2.4.5
319
380
  signing_key:
320
381
  specification_version: 4
321
- summary: aruba-0.8.1
382
+ summary: aruba-0.9.0.pre
322
383
  test_files:
323
- - features/api/cd.feature
384
+ - features/api/command/extract_text.feature
324
385
  - features/api/command/run.feature
386
+ - features/api/command/unescape_text.feature
325
387
  - features/api/command/which.feature
326
388
  - features/api/core/expand_path.feature
327
389
  - features/api/environment/append_environment_variable.feature
328
390
  - features/api/environment/prepend_environment_variable.feature
329
391
  - features/api/environment/set_environment_variable.feature
392
+ - features/api/filesystem/cd.feature
393
+ - features/api/filesystem/create_directory.feature
394
+ - features/api/filesystem/disk_usage.feature
395
+ - features/api/filesystem/does_exist.feature
396
+ - features/api/filesystem/is_absolute.feature
397
+ - features/api/filesystem/is_directory.feature
398
+ - features/api/filesystem/is_file.feature
399
+ - features/api/filesystem/is_relative.feature
400
+ - features/cli/console.feature
401
+ - features/configuration/console_history_file.feature
330
402
  - features/configuration/exit_timeout.feature
331
403
  - features/configuration/fixtures_directories.feature
332
404
  - features/configuration/fixtures_path_prefix.feature
333
405
  - features/configuration/home_directory.feature
334
406
  - features/configuration/io_timeout.feature
335
407
  - features/configuration/keep_ansi.feature
408
+ - features/configuration/log_level.feature
409
+ - features/configuration/physical_block_size.feature
410
+ - features/configuration/remove_ansi_escape_sequences.feature
336
411
  - features/configuration/root_directory.feature
337
412
  - features/configuration/working_directory.feature
338
413
  - features/debug.feature
@@ -349,6 +424,7 @@ test_files:
349
424
  - features/fixtures/cli-app/script/console
350
425
  - features/fixtures/cli-app/spec/cli/app_spec.rb
351
426
  - features/fixtures/cli-app/spec/spec_helper.rb
427
+ - features/fixtures/cli-app/spec/support/aruba.rb
352
428
  - features/fixtures/copy/file.txt
353
429
  - features/fixtures/empty-app/.gitignore
354
430
  - features/fixtures/empty-app/.rspec
@@ -401,6 +477,8 @@ test_files:
401
477
  - spec/aruba/matchers/directory_spec.rb
402
478
  - spec/aruba/matchers/file_spec.rb
403
479
  - spec/aruba/matchers/path_spec.rb
480
+ - spec/aruba/platform/simple_table_spec.rb
481
+ - spec/aruba/platform/windows_environment_variables_spec.rb
404
482
  - spec/aruba/rspec_spec.rb
405
483
  - spec/aruba/runtime_spec.rb
406
484
  - spec/aruba/spawn_process_spec.rb
@@ -1,21 +0,0 @@
1
- require 'contracts'
2
-
3
- module Aruba
4
- module Contracts
5
- class IsA < ::Contracts::CallableClass
6
- private
7
-
8
- attr_reader :vals
9
-
10
- public
11
-
12
- def initialize(*vals)
13
- @vals = vals
14
- end
15
-
16
- def valid?(val)
17
- vals.any? { |v| val.is_a? v }
18
- end
19
- end
20
- end
21
- end
@@ -1,121 +0,0 @@
1
- module Aruba
2
- class Environment
3
- private
4
-
5
- attr_reader :env
6
-
7
- public
8
-
9
- def initialize
10
- @env = ENV.to_hash
11
- end
12
-
13
- # Update environment with other en
14
- #
15
- # @param [#to_hash, #to_h] other_env
16
- # Another environment object or hash
17
- #
18
- # @yield
19
- # Pass block to env
20
- def update(other_env, &block)
21
- if RUBY_VERSION <= '1.9.3'
22
- # rubocop:disable Style/EachWithObject
23
- other_env = other_env.to_hash.inject({}) { |a, (k, v)| a[k] = v.to_s; a }
24
- # rubocop:enable Style/EachWithObject
25
- else
26
- other_env = other_env.to_h.each_with_object({}) { |(k, v), a| a[k] = v.to_s }
27
- end
28
-
29
- env.update(other_env, &block)
30
-
31
- self
32
- end
33
-
34
- # Fetch variable from environment
35
- #
36
- # @param [#to_s] name
37
- # The name of the variable
38
- #
39
- # @param [Object] default
40
- # The default value used, if the variable is not defined
41
- def fetch(name, default)
42
- env.fetch name.to_s, default
43
- end
44
-
45
- # Check if variable exist
46
- #
47
- # @param [#to_s] name
48
- # The name of the variable
49
- def key?(name)
50
- env.key? name.to_s
51
- end
52
-
53
- # Get value of variable
54
- #
55
- # @param [#to_s] name
56
- # The name of the variable
57
- def [](name)
58
- env[name.to_s]
59
- end
60
-
61
- # Set value of variable
62
- #
63
- # @param [#to_s] name
64
- # The name of the variable
65
- #
66
- # @param [#to_s] value
67
- # The value of the variable
68
- def []=(name, value)
69
- env[name.to_s] = value.to_s
70
-
71
- self
72
- end
73
-
74
- # Append value to variable
75
- #
76
- # @param [#to_s] name
77
- # The name of the variable
78
- #
79
- # @param [#to_s] value
80
- # The value of the variable
81
- def append(name, value)
82
- name = name.to_s
83
- env[name] = env[name].to_s + value.to_s
84
-
85
- self
86
- end
87
-
88
- # Prepend value to variable
89
- #
90
- # @param [#to_s] name
91
- # The name of the variable
92
- #
93
- # @param [#to_s] value
94
- # The value of the variable
95
- def prepend(name, value)
96
- name = name.to_s
97
- env[name] = value.to_s + env[name].to_s
98
-
99
- self
100
- end
101
-
102
- # Convert to hash
103
- #
104
- # @return [Hash]
105
- # A new hash from environment
106
- def to_h
107
- if RUBY_VERSION < '2.0'
108
- env.to_hash.dup
109
- else
110
- env.to_h.dup
111
- end
112
- end
113
-
114
- # Reset environment
115
- def clear
116
- env.clear
117
-
118
- self
119
- end
120
- end
121
- end