Sha256: adf41d3253ac03c321a7c37c6bcec1a0b4b194a58d9072f90290f1b2b4c888ac

Contents?: true

Size: 1.49 KB

Versions: 15

Compression:

Stored size: 1.49 KB

Contents

require 'rubygems'
require 'test/spec'
require 'mocha'

require 'tempfile'
require 'fileutils'
require 'pathname'

TMP_PATH = File.join(Dir.tmpdir, "braid_integration")
BRAID_PATH = Pathname.new(File.dirname(__FILE__)).parent.realpath
FIXTURE_PATH = File.join(BRAID_PATH, "test", "fixtures")
FileUtils.rm_rf(TMP_PATH)
FileUtils.mkdir_p(TMP_PATH)
BRAID_BIN = File.join(BRAID_PATH, "bin", "braid")

#def exec(cmd)
#  `cd #{TMP} && #{cmd}`
#end

def in_dir(dir = TMP_PATH)
  Dir.chdir(dir)
  yield
end

def run_cmds(ary)
  ary.each do |cmd|
    cmd = cmd.strip!
    out = `#{cmd}`
  end
end

def update_dir_from_fixture(dir, fixture = dir)
  to_dir = File.join(TMP_PATH, dir)
  FileUtils.mkdir_p(to_dir)
  FileUtils.cp_r(File.join(FIXTURE_PATH, fixture) + "/.", to_dir)
end

def create_git_repo_from_fixture(fixture_name)
  git_repo = File.join(TMP_PATH, fixture_name)
  update_dir_from_fixture(fixture_name)

  in_dir(git_repo) do
    run_cmds(<<-EOD)
      git init
      git add *
      git commit -m "initial commit of #{fixture_name}"
    EOD
  end

  git_repo
end

def create_svn_repo_from_fixture(fixture_name)
  svn_wc = File.join(TMP_PATH, fixture_name + "_wc")
  svn_repo = File.join(TMP_PATH, fixture_name)
  run_cmds(<<-EOD)
    svnadmin create #{svn_repo}
    svn co file://#{svn_repo} #{svn_wc}
  EOD
  update_dir_from_fixture(fixture_name + "_wc", fixture_name)
  in_dir(svn_wc) do
    run_cmds(<<-EOD)
      svn add *
      svn commit -m "initial commit of #{fixture_name}"
    EOD
  end
  "file://#{svn_repo}"
end


Version data entries

15 entries across 15 versions & 5 rubygems

Version Path
dreamcat4-braid-0.5.1 test/integration_helper.rb
dreamcat4-braid-0.5.2 test/integration_helper.rb
dreamcat4-braid-0.50 test/integration_helper.rb
dreamcat4-braid-0.52 test/integration_helper.rb
dreamcat4-braid-0.53 test/integration_helper.rb
dreamcat4-braid-0.531 test/integration_helper.rb
dreamcat4-braid-0.533 test/integration_helper.rb
dreamcat4-braid-0.534 test/integration_helper.rb
evilchelu-braid-0.5 test/integration_helper.rb
mlightner-braid-0.5.1 test/integration_helper.rb
braid-0.6.2 test/integration_helper.rb
honkster-braid-0.6.2 test/integration_helper.rb
braid-0.6.1 test/integration_helper.rb
braid-0.6 test/integration_helper.rb
braid-0.5 test/integration_helper.rb