class Nanoc::Extra::Deployers::Scp

Very simple nanoc plugin for deploy via scp.

@example A deployment configuration

deploy:
  default:
    kind: scp
    dst:  "yourname@sftp.domain.org:/public_html"

Constants

DEFAULT_OPTIONS

Public Instance Methods

run() click to toggle source
# File lib/nanoc/extra/deployers/scp.rb, line 15
def run
  src = source_path + '/'
  dst = config[:dst]
  options = config[:options] || DEFAULT_OPTIONS

  raise 'No dst found in deployment configuration' if dst.nil?
  raise 'dst requires no trailing slash' if dst[-1, 1] == '/'

  if dry_run
    warn 'Performing a dry-run; no actions will actually be performed'
    run_shell_cmd(['echo', 'scp', options, src, dst].flatten)
  else
    run_shell_cmd(['scp', options, src, dst].flatten)
  end
end

Private Instance Methods

run_shell_cmd(cmd) click to toggle source
# File lib/nanoc/extra/deployers/scp.rb, line 33
def run_shell_cmd(cmd)
  piper = Nanoc::Extra::Piper.new(stdout: $stdout, stderr: $stderr)
  piper.run(cmd, nil)
end