summaryrefslogtreecommitdiff
path: root/lib/puppet/provider/vcsrepo.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/provider/vcsrepo.rb')
-rw-r--r--lib/puppet/provider/vcsrepo.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/puppet/provider/vcsrepo.rb b/lib/puppet/provider/vcsrepo.rb
new file mode 100644
index 0000000..c560e93
--- /dev/null
+++ b/lib/puppet/provider/vcsrepo.rb
@@ -0,0 +1,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