Sha256: f9935b3d337f6e1536ec0ed95b686fbb810c5df1b5ec38cade8e78cc7dde2ab5

Contents?: true

Size: 1.47 KB

Versions: 6

Compression:

Stored size: 1.47 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.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

6 entries across 6 versions & 2 rubygems

Version Path
evilchelu-braid-0.4.10 test/integration_helper.rb
evilchelu-braid-0.4.11 test/integration_helper.rb
evilchelu-braid-0.4.12 test/integration_helper.rb
evilchelu-braid-0.4.13 test/integration_helper.rb
norbert-braid-0.4.12 test/integration_helper.rb
norbert-braid-0.4.13 test/integration_helper.rb