Class: Nanoc::Deploying::Deployers::Rsync Private

Inherits:
Nanoc::Deploying::Deployer show all
Defined in:
lib/nanoc/deploying/deployers/rsync.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A deployer that deploys a site using rsync.

The configuration has should include a ‘:dst` value, a string containing the destination to where rsync should upload its data. It will likely be in `host:path` format. It should not end with a slash. For example, `“example.com:/var/www/sites/mysite/html”`.

Examples:

A deployment configuration with public and staging configurations


deploy:
  public:
    kind: rsync
    dst: "ectype:sites/stoneship/public"
  staging:
    kind: rsync
    dst: "ectype:sites/stoneship-staging/public"
    options: [ "-glpPrtvz" ]

Constant Summary collapse

DEFAULT_OPTIONS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Default rsync options

[
  '--group',
  '--links',
  '--perms',
  '--partial',
  '--progress',
  '--recursive',
  '--times',
  '--verbose',
  '--compress',
  '--exclude=".hg"',
  '--exclude=".svn"',
  '--exclude=".git"',
].freeze

Instance Attribute Summary

Attributes inherited from Nanoc::Deploying::Deployer

#config, #dry_run, #source_path

Instance Method Summary collapse

Methods inherited from Nanoc::Deploying::Deployer

#initialize

Constructor Details

This class inherits a constructor from Nanoc::Deploying::Deployer

Instance Method Details

#runObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/nanoc/deploying/deployers/rsync.rb', line 45

def run
  # Get params
  src = source_path + '/'
  dst = config[:dst]
  options = config[:options] || DEFAULT_OPTIONS

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

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