class Ruhoh::Publish::Rsync

Public Instance Methods

run(opts={}, config={}) click to toggle source

Deploy via rsync @param - CLI arguments @param - config hash supplied from publish.yml or publish.json

Example publish.json file: {

"rsync": {
    "command": nil,
    "user": "root",
    "host": "12.345.67.891",
    "destination": "/var/www/my-site.com"
}

}

Use “command” to specify a customized rsync command to execute.

# File lib/ruhoh/publish/rsync.rb, line 18
def run(opts={}, config={})
  @config = config
  ruhoh = Ruhoh::Program.compile

  if @config["command"]
    system(@config["command"])
  else
    system('rsync', File.join(ruhoh.config['compiled_path'], '.'), '-avz', '--delete', '--exclude', '.git', remote)
  end
  FileUtils.rm_r(ruhoh.config['compiled_path'])
end

Private Instance Methods

remote() click to toggle source
# File lib/ruhoh/publish/rsync.rb, line 32
def remote
  "#{ @config["user"] }@#{ @config["host"] }:#{ @config["destination"] }"
end