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

Create a publisher using the give host information.



36
37
38
39
40
41
# File 'lib/rake/contrib/sshpublisher.rb', line 36

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

Upload the local directory to the remote directory.



44
45
46
47
48
# File 'lib/rake/contrib/sshpublisher.rb', line 44

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