Module: WWTD

Defined in:
lib/wwtd.rb,
lib/wwtd/cli.rb,
lib/wwtd/run.rb,
lib/wwtd/ruby.rb,
lib/wwtd/version.rb

Defined Under Namespace

Modules: CLI, Ruby Classes: Run

Constant Summary collapse

CONFIG =
".travis.yml"
DEFAULT_GEMFILE =
"Gemfile"
COMBINATORS =
["rvm", "gemfile", "env"]
UNDERSTOOD =
["rvm", "gemfile", "matrix", "script", "bundler_args"]
VERSION =
"0.4.7"

Class Method Summary collapse

Class Method Details

.read_travis_ymlObject



18
19
20
21
22
23
# File 'lib/wwtd.rb', line 18

def read_travis_yml
  config = (File.exist?(CONFIG) ? YAML.load_file(CONFIG) : {})
  config.delete("source_key") # we don't need that we already have the source
  ignored = config.keys - UNDERSTOOD
  [matrix(config), ignored]
end

.run(matrix, options, &block) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/wwtd.rb', line 25

def run(matrix, options, &block)
  with_clean_dot_bundle do
    with_clean_env do
      Dir.mktmpdir do |lock|
        in_multiple_threads(matrix.each_with_index, options[:parallel]) do |config, i|
          # set env as parallel_tests does to reuse existing infrastructure
          env = {}
          env["TEST_ENV_NUMBER"] = (i == 0 ? "" : (i + 1).to_s) if options[:parallel]
          Run.new(config, env, lock).execute(&block)
        end
      end
    end
  end
end