summaryrefslogtreecommitdiff
path: root/lib/puppet/provider/vcsrepo.rb
blob: c560e939ded5b9b3696b352906c073a4b50a2aec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require 'tmpdir'
require 'digest/md5'

# Abstract
class Puppet::Provider::Vcsrepo < Puppet::Provider

  private

  # Note: We don't rely on Dir.chdir's behavior of automatically returning the
  # value of the last statement -- for easier stubbing.
  def at_path(&block) #:nodoc:
    value = nil
    Dir.chdir(@resource.value(:path)) do
      value = yield
    end
    value
  end

  def tempdir
    @tempdir ||= File.join(Dir.tmpdir, 'vcsrepo-' + Digest::MD5.hexdigest(@resource.value(:path)))
  end

end