module Deployment module Methods module Repository def get_dir_from_samba(source, target) Helper.validates_presence_of @cdb['samba_repository'], 'Samba repository not set' samba = Provider::Repository.new samba.repository = @cdb['samba_repository'] samba.samba_mountpoints = @cdb['samba_mountpoints'] samba.method = 'samba' samba.worker = self samba.get_from_repository(source, File.join($recipe_config[:deploy_home], target)) end def get_file_from_maven(source, target) Helper.validates_presence_of @cdb['maven_repository'], 'Maven repository not set' maven = Provider::Repository.new maven.repository = @cdb['maven_repository'] maven.user = @cdb['maven_user'] maven.password = @cdb['maven_password'] maven.method = 'maven' maven.get_from_repository(source, File.join($recipe_config[:deploy_home], target)) end def get_file_via_scp(source, target, options = {}) Helper.validates_presence_of @cdb['scp_source_host'], \ 'scp source host not set' Helper.validates_presence_of @cdb['scp_source_user'], \ 'scp source user not set' scp = Provider::Repository.new scp.host = @cdb['scp_source_host'] scp.user = @cdb['scp_source_user'] if options[:ssh_key_file] scp.sshkey = File.join(File.dirname($exec_file_path), \ options[:ssh_key_file]) else scp.sshkey = File.join(File.dirname($exec_file_path), \ @cdb['ssh_key_file']) end scp.method = 'scp' scp.get_from_repository(source, File.join($recipe_config[:deploy_home], target)) end def get_file_via_svn(source, target, options = {}) Helper.validates_presence_of @cdb['svn_binary'], \ 'svn binary not set' Helper.validates_presence_of @cdb['svn_source_base_url'], \ 'svn base url not set' Helper.validates_presence_of @cdb['svn_source_user'], \ 'svn source user not set' Helper.validates_presence_of @cdb['svn_source_command'], \ 'svn command not set' svn = Provider::Repository.new svn.svnbinary = @cdb['svn_binary'] svn.user = @cdb['svn_source_user'] svn.password = @cdb['svn_source_password'] if @cdb['svn_source_password'] svn.method = 'svn' if options[:svn_command] svn.svncmd = options[:svn_command] else svn.svncmd = @cdb['svn_source_command'] + " -r#{options[:revision]}" end if options[:svn_repository] svn.repository = options[:svn_repository] else svn.repository = @cdb['svn_source_base_url'] end svn.get_from_repository(source, \ File.join($recipe_config[:deploy_home], target)) end def git_fetch(options = {}) publisher = ::Provider::Git.new publisher.repository_url = options[:git_repository_url] || @cdb['git_repository_url'] publisher.repository_local_dir = options[:git_repository_local] || @cdb['git_repository_local'] publisher.fetch end def git_checkout(branch_name, options = {}) publisher = ::Provider::Git.new publisher.repository_url = options[:git_repository_url] || @cdb['git_repository_url'] publisher.repository_local_dir = options[:git_repository_local] || @cdb['git_repository_local'] publisher.checkout(branch_name, options) end def git_submodule(submodule_option, options = {}) publisher = ::Provider::Git.new publisher.repository_url = options[:git_repository_url] || @cdb['git_repository_url'] publisher.repository_local_dir = options[:git_repository_local] || @cdb['git_repository_local'] publisher.submodule(submodule_option, options) end def git_tag(tag_name, options = {}) publisher = ::Provider::Git.new publisher.repository_url = options[:git_repository_url] || @cdb['git_repository_url'] publisher.repository_local_dir = options[:git_repository_local] || @cdb['git_repository_local'] publisher.tag(tag_name, options) end end end end