Module: Deployment::Methods::Remote
- Defined in:
- lib/depengine/dsl/remote.rb
Instance Method Summary collapse
- #remote_execute(command, options = {}) ⇒ Object
- #remove_old_releases(path, num_of_releases_to_keep = 1, release_name_shema = nil, options = {}) ⇒ Object
- #rsync(source, target, options = {}) ⇒ Object
Instance Method Details
#remote_execute(command, options = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/depengine/dsl/remote.rb', line 4 def remote_execute(command, = {}) Helper.validates_presence_of command, 'No command to execute!' Helper.validates_presence_of @cdb['ssh_key_file'], 'SSH keyfile not set' publisher = ::Publisher::Ssh.new publisher.remote_host = [:remote_host] || @cdb['remote_host'] publisher.remote_user = [:remote_user] || @cdb['remote_user'] publisher.ssh_key_file = [:ssh_key_file] || @cdb['ssh_key_file'] publisher.remote_execute(command) end |
#remove_old_releases(path, num_of_releases_to_keep = 1, release_name_shema = nil, options = {}) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/depengine/dsl/remote.rb', line 44 def remove_old_releases(path, num_of_releases_to_keep = 1, release_name_shema = nil, = {}) Helper.validates_presence_of path, 'No path in which the releases are' release_name_shema = /[0-9]{4}\-[0-9]{2}\-[0-9]{2}_[0-9]+.*/ unless release_name_shema # e.g. timestamps like 2014-04-11_1397227004 publisher = ::Publisher::Ssh.new publisher.remote_host = [:remote_host] || @cdb['remote_host'] publisher.remote_user = [:remote_user] || @cdb['remote_user'] publisher.ssh_key_file = [:ssh_key_file] || @cdb['ssh_key_file'] publisher.remove_old_releases(path, num_of_releases_to_keep, release_name_shema) end |
#rsync(source, target, options = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/depengine/dsl/remote.rb', line 15 def rsync(source, target, = {}) if [:local].nil? or [:local] == false Helper.validates_presence_of @cdb['ssh_key_file'], 'SSH-keyfile not set' end Helper.validates_presence_of source Helper.validates_presence_of target publisher = ::Publisher::Rsync.new publisher.remote_host = [:remote_host] || @cdb['remote_host'] publisher.remote_user = [:remote_user] || @cdb['remote_user'] publisher.ssh_key_file = [:ssh_key_file] || @cdb['ssh_key_file'] # publisher.ssh_key_file = File.join(File.dirname($exec_file_path), \ # publisher.ssh_key_file) if [:local].nil? or [:local] == false Helper.validates_presence_of publisher.remote_host, 'Remote host not set' Helper.validates_presence_of publisher.remote_user, 'Remote user not set' end if source[0].chr == '/' source_path = source else source_path = File.join($recipe_config[:deploy_home], source) end publisher.sync(source_path, target, ) end |