Class: Rake::SshFilePublisher

Inherits:
Object
  • Object
show all
Includes:
DSL
Defined in:
lib/rake/contrib/sshpublisher.rb

Overview

Publish a list of files to an existing remote directory.

Constant Summary

Constants included from FileUtilsExt

FileUtilsExt::DEFAULT

Constants included from FileUtils

FileUtils::LN_SUPPORTED, FileUtils::RUBY

Instance Method Summary collapse

Methods included from FileUtilsExt

#nowrite, #rake_check_options, #rake_merge_option, #rake_output_message, #verbose, #when_writing

Methods included from FileUtils

#ruby, #safe_ln, #sh, #split_all

Constructor Details

#initialize(host, remote_dir, local_dir, *files) ⇒ SshFilePublisher

Creates an SSH publisher which will scp all files in local_dir to remote_dir on host.



46
47
48
49
50
51
# File 'lib/rake/contrib/sshpublisher.rb', line 46

def initialize(host, remote_dir, local_dir, *files)
  @host = host
  @remote_dir = remote_dir
  @local_dir = local_dir
  @files = files
end

Instance Method Details

#uploadObject

Uploads the files



55
56
57
58
59
# File 'lib/rake/contrib/sshpublisher.rb', line 55

def upload
  @files.each do |fn|
    sh "scp", "-q", "#{@local_dir}/#{fn}", "#{@host}:#{@remote_dir}"
  end
end