Sha256: 7c01b66a8c236f6a7cb26163e972207a58d001674de67955d43a857eb4e88d91
Contents?: true
Size: 1.49 KB
Versions: 16
Compression:
Stored size: 1.49 KB
Contents
module PoolParty class Git virtual_resource(:git) do def loaded(opts={}, parent=self) has_git_repos end def has_git_repos has_package(:name => "git-core") has_exec({:name => "git-#{name}", :requires => get_package("git-core"), :requires => [get_directory("#{cwd}"), get_package("git-core")]}) do command parent.user ? "git clone #{parent.user}@#{parent.source} #{parent.path}" : "git clone #{parent.source} #{parent.to ? parent.to : ""}" cwd "#{parent.cwd if parent.cwd}" creates "#{::File.join( (parent.cwd ? parent.cwd : cwd), ::File.basename(parent.source, ::File.extname(parent.source)) )}/.git" end has_exec(:name => "update-#{name}", :requires => get_exec("git-#{name}")) do cwd ::File.dirname(get_exec("git-#{parent.name}").creates) command "git pull" end end def at(dir) cwd dir has_directory(:name => "#{dir}", :requires => get_directory("#{::File.dirname(dir)}")) end # Since git is not a native type, we have to say which core resource # it is using to be able to require it def class_type_name "exec" end # Because we are requiring an exec, instead of a built-in package of the git, we have to overload # the to_s method and prepend it with the same name as above def key "git-#{name}" end end end end
Version data entries
16 entries across 16 versions & 1 rubygems