Sha256: c0c7f875842c392e5686b736dd7783fa068a21dc791a1bd92dc91dd3eab13f71

Contents?: true

Size: 1.85 KB

Versions: 15

Compression:

Stored size: 1.85 KB

Contents

#!/usr/bin/env ruby

def execute(*commands)
  commands.each do |command|
    system(command)
    unless $?.success?
      message = [
        "Executing shell command failed.",
        "  Command: #{command}",
        "  Status:  #{$?.exitstatus}"
      ].join("\n")
      raise message
    end
  end
end

def reset_bundle
  execute(
    "rm -rf .bundle/gems",
    "rm -rf gemfiles/.bundle/gems",
    "rm -f *.lock",
    "rm -f gemfiles/*.lock"
  )
end

def with_rbenv(command)
  %{export PATH="$HOME/.rbenv/bin:$PATH"; eval "$(rbenv init -)"; #{command}}
end

def run(gemfile, task = "test")
  ENV["BUNDLE_GEMFILE"] = gemfile
  ENV["MOCHA_OPTIONS"] = "debug"
  ENV["MOCHA_NO_DOCS"] = "true"
  reset_bundle
  execute(
    with_rbenv("bundle install --gemfile=#{gemfile}"),
    with_rbenv("bundle exec rake #{task}")
  )
end

EXCLUDED_RUBY_193_GEMFILES = [
  "gemfiles/Gemfile.minitest.1.3.0",
  "gemfiles/Gemfile.minitest.1.4.0",
  "gemfiles/Gemfile.minitest.1.4.1",
  "gemfiles/Gemfile.minitest.1.4.2"
]

RUBY_VERSIONS = ["1.8.7-p352", "1.9.3-p125-perf"]

RUBY_VERSIONS.each do |ruby_version|
  execute("rbenv local #{ruby_version}")
  reset_bundle
  run("Gemfile")
  execute("rbenv local --unset")
end

RUBY_VERSIONS.each do |ruby_version|
  execute("rbenv local #{ruby_version}")
  ["test-unit", "minitest"].each do |test_library|
    reset_bundle
    (Dir["gemfiles/Gemfile.#{test_library}.*"] + ["Gemfile"]).each do |gemfile|
      ruby_version_without_patch = ruby_version.split("-")[0]
      next if (ruby_version_without_patch == "1.9.3") && EXCLUDED_RUBY_193_GEMFILES.include?(gemfile)
      next if (ruby_version_without_patch == "1.8.7") && (gemfile == "Gemfile") && (test_library == "minitest")
      p [ruby_version_without_patch, test_library, gemfile]
      ENV['MOCHA_RUN_INTEGRATION_TESTS'] = test_library
      run(gemfile)
    end
  end
  execute("rbenv local --unset")
end

Version data entries

15 entries across 14 versions & 4 rubygems

Version Path
tnargav-1.3.3 vendor/bundle/ruby/1.9.1/gems/mocha-0.14.0/build-matrix.rb
challah-1.0.0 vendor/bundle/gems/mocha-0.14.0/build-matrix.rb
tnargav-1.2.3 vendor/bundle/ruby/1.9.1/gems/mocha-0.14.0/build-matrix.rb
mocha-0.14.0 build-matrix.rb
challah-1.0.0.beta3 vendor/bundle/gems/mocha-0.13.3/build-matrix.rb
mocha-0.14.0.alpha build-matrix.rb
challah-1.0.0.beta2 vendor/bundle/gems/mocha-0.13.3/build-matrix.rb
challah-1.0.0.beta vendor/bundle/gems/mocha-0.13.3/build-matrix.rb
mocha-0.13.3 build-matrix.rb
mocha-0.13.2 build-matrix.rb
mocha-0.13.1 build-matrix.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.3/vendor/bundle/gems/mocha-0.13.0/build-matrix.rb
challah-rolls-0.2.0 vendor/bundle/gems/mocha-0.13.0/build-matrix.rb
challah-0.8.3 vendor/bundle/gems/mocha-0.13.0/build-matrix.rb
mocha-0.13.0 build-matrix.rb