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.15.0 spec/shared-contexts/git-fixtures.rb
akerl-r10k-3.14.2.1 spec/shared-contexts/git-fixtures.rb
r10k-3.14.2 spec/shared-contexts/git-fixtures.rb
r10k-3.14.1 spec/shared-contexts/git-fixtures.rb
r10k-3.14.0 spec/shared-contexts/git-fixtures.rb
r10k-3.13.0 spec/shared-contexts/git-fixtures.rb
r10k-3.12.1 spec/shared-contexts/git-fixtures.rb
r10k-3.12.0 spec/shared-contexts/git-fixtures.rb
r10k-3.11.0 spec/shared-contexts/git-fixtures.rb
r10k-3.10.0 spec/shared-contexts/git-fixtures.rb
r10k-3.9.3 spec/shared-contexts/git-fixtures.rb
r10k-3.9.2 spec/shared-contexts/git-fixtures.rb
r10k-3.9.1 spec/shared-contexts/git-fixtures.rb
r10k-3.9.0 spec/shared-contexts/git-fixtures.rb
r10k-3.8.0 spec/shared-contexts/git-fixtures.rb
r10k-3.7.0 spec/shared-contexts/git-fixtures.rb
r10k-3.6.0 spec/shared-contexts/git-fixtures.rb
r10k-2.6.9 spec/shared-contexts/git-fixtures.rb
r10k-3.5.2 spec/shared-contexts/git-fixtures.rb
r10k-3.5.1 spec/shared-contexts/git-fixtures.rb