Sha256: 7130c14d53b872b03cd2a5651b7279608f32105799d91d9280b92a70c8554ade

Contents?: true

Size: 1.22 KB

Versions: 69

Compression:

Stored size: 1.22 KB

Contents

require 'archive/tar/minitar'
require 'tmpdir'

shared_context "Git integration" do

  # Use tmpdir for cached git repositories

  before(:all) do
    @old_cache_root = R10K::Git::Cache.settings[:cache_root]
    R10K::Git::Cache.settings[:cache_root] = Dir.mktmpdir
  end

  after(:all) do
    FileUtils.remove_entry_secure(R10K::Git::Cache.settings[:cache_root])
    R10K::Git::Cache.settings[:cache_root] = @old_cache_root
  end

  # Create a mutable path for remote repositories

  def fixture_path
    File.join(PROJECT_ROOT, 'spec', 'fixtures', 'integration', 'git')
  end

  def remote_path
    @remote_path
  end

  def populate_remote_path
    Archive::Tar::Minitar.unpack(File.join(fixture_path, 'puppet-boolean-bare.tar'), remote_path)
  end

  def clear_remote_path
    FileUtils.remove_entry_secure(remote_path)
  end

  before(:all) do
    @remote_path = Dir.mktmpdir
    populate_remote_path
  end

  after(:all) do
    clear_remote_path
    @remote_path = nil
  end

  let(:remote) { Pathname.new(File.join(remote_path, 'puppet-boolean.git')).realpath.to_s }

  # Create a temp path for the git basedir and clean it up when finished

  let(:basedir) { Dir.mktmpdir }

  after do
    FileUtils.remove_entry_secure(basedir)
  end
end

Version data entries

69 entries across 69 versions & 2 rubygems

Version Path
r10k-3.0.0 spec/shared-contexts/git-fixtures.rb
r10k-2.6.4 spec/shared-contexts/git-fixtures.rb
r10k-2.6.3 spec/shared-contexts/git-fixtures.rb
r10k-2.6.2 spec/shared-contexts/git-fixtures.rb
r10k-2.6.1 spec/shared-contexts/git-fixtures.rb
r10k-2.6.0 spec/shared-contexts/git-fixtures.rb
r10k-2.5.5 spec/shared-contexts/git-fixtures.rb
r10k-2.5.4 spec/shared-contexts/git-fixtures.rb
r10k-2.5.3 spec/shared-contexts/git-fixtures.rb
r10k-2.5.2 spec/shared-contexts/git-fixtures.rb
r10k-2.5.1 spec/shared-contexts/git-fixtures.rb
r10k-2.4.5 spec/shared-contexts/git-fixtures.rb
r10k-2.3.1 spec/shared-contexts/git-fixtures.rb
r10k-2.4.4 spec/shared-contexts/git-fixtures.rb
r10k-2.5.0 spec/shared-contexts/git-fixtures.rb
r10k-2.4.3 spec/shared-contexts/git-fixtures.rb
r10k-2.4.1 spec/shared-contexts/git-fixtures.rb
r10k-2.4.0 spec/shared-contexts/git-fixtures.rb
r10k-2.3.0 spec/shared-contexts/git-fixtures.rb
r10k-2.2.2 spec/shared-contexts/git-fixtures.rb