lib/poolparty/plugins/git.rb in auser-poolparty-1.2.8 vs lib/poolparty/plugins/git.rb in auser-poolparty-1.2.9
- old
+ new
@@ -1,28 +1,42 @@
-module PoolParty
- class GitResource
-
- plugin :git do
+=begin rdoc
+speficy a git repo that should be checked out to all the nodes.
+
+has_git_repos(:name => "xnot",
+ :source => "git://github.com/auser/xnot.org.git",
+ :dir => "/var/www",
+ :owner => 'www-data',
+ :deploy_key => 'pool_cloud.rsa')
+=end
+module PoolParty
+ module Plugin
+ class Git < Plugin
def loaded(*args)
has_package(:name => "git-core")
end
end
- plugin :git_repo do
+ class GitRepo < Plugin
dsl_methods :name,
:repo,
:dir,
:owner,
:requires_user,
- :deploy_key
-
+ :deploy_key,
+ :source
+
def loaded(opts={}, &block)
raise DirectoryMissingError.new unless dir
has_package("git-core")
has_git_repository
end
+
+ # retrieve/set source. If source is not set, try and use name.
+ def source(n=nil)
+ n.nil? ? (dsl_options[:source] ? dsl_options[:source] : dsl_options[:source]= name) : dsl_options[:source]=n
+ end
def has_git_repository
has_directory(::File.dirname(dir))
has_directory(:name => "#{dir}", :requires => get_directory("#{::File.dirname(dir)}"))
@@ -73,9 +87,10 @@
end
end
end
+
class DirectoryMissingError < StandardError
def initialize
super("You must include a directory for the git repo set by to")
end
end
\ No newline at end of file