|
2 | 2 | require 'fileutils'
|
3 | 3 |
|
4 | 4 | module ArubaExt
|
5 |
| - def run_command(cmd, timeout = nil) |
6 |
| - exec_cmd = cmd =~ /^rspec/ ? "bin/#{cmd}" : cmd |
7 |
| - unset_bundler_env_vars |
8 |
| - # Ensure the correct Gemfile and binstubs are found |
9 |
| - in_current_directory do |
10 |
| - with_unbundled_env do |
11 |
| - super(exec_cmd, timeout) |
| 5 | + if defined?(Aruba::VERSION) && Aruba::VERSION >= '0.14.12' |
| 6 | + def run_command(cmd, timeout = nil) |
| 7 | + exec_cmd = cmd =~ /^rspec/ ? "bin/#{cmd}" : cmd |
| 8 | + unset_bundler_env_vars |
| 9 | + # Ensure the correct Gemfile and binstubs are found |
| 10 | + in_current_directory do |
| 11 | + with_unbundled_env do |
| 12 | + super(exec_cmd, timeout) |
| 13 | + end |
12 | 14 | end
|
13 | 15 | end
|
| 16 | + else |
| 17 | + def run(cmd, timeout = nil) |
| 18 | + exec_cmd = cmd =~ /^rspec/ ? "bin/#{cmd}" : cmd |
| 19 | + super(exec_cmd, timeout) |
| 20 | + end |
| 21 | + # This method overrides Aruba 0.5.4 implementation so that we can reset Bundler to use the sample app Gemfile |
| 22 | + def in_current_dir(&block) |
| 23 | + Bundler.with_clean_env do |
| 24 | + _mkdir(current_dir) |
| 25 | + Dir.chdir(current_dir, &block) |
| 26 | + end |
14 | 27 | end
|
15 | 28 |
|
16 | 29 | def unset_bundler_env_vars
|
@@ -41,12 +54,18 @@ def env_to_h
|
41 | 54 | end
|
42 | 55 | end
|
43 | 56 |
|
44 |
| -World(ArubaExt) |
45 |
| - |
46 |
| -Aruba.configure do |config| |
47 |
| - config.exit_timeout = 30 |
| 57 | +if defined?(Aruba::VERSION) && Aruba::VERSION >= '0.14.12' |
| 58 | + Aruba.configure do |config| |
| 59 | + config.exit_timeout = 30 |
| 60 | + end |
| 61 | +else |
| 62 | + Before do |
| 63 | + @aruba_timeout_seconds = 30 |
| 64 | + end |
48 | 65 | end
|
49 | 66 |
|
| 67 | +World(ArubaExt) |
| 68 | + |
50 | 69 | unless File.directory?('./tmp/example_app')
|
51 | 70 | system "rake generate:app generate:stuff"
|
52 | 71 | end
|
|
0 commit comments