Class: Roger::Release::Finalizers::Rsync

Inherits:
Base show all
Defined in:
lib/roger/release/finalizers/rsync.rb

Overview

Finalizes the release by uploading your project with rsync to a remote server

See Also:

  • for options

Instance Attribute Summary

Attributes inherited from Processors::Base

#options, #release

Instance Method Summary collapse

Methods inherited from Processors::Base

#call, #name

Instance Method Details

#default_optionsObject

Parameters:

  • Hash

    options The options

  • options (Hash)

    a customizable set of options



19
20
21
22
23
24
25
26
27
# File 'lib/roger/release/finalizers/rsync.rb', line 19

def default_options
  {
    rsync: "rsync",
    remote_path: "",
    host: nil,
    username: nil,
    ask: true
  }
end

#performObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/roger/release/finalizers/rsync.rb', line 29

def perform
  # Validate options
  validate_options!

  return unless prompt_for_upload

  check_rsync_command(@options[:rsync])

  local_path = @release.build_path.to_s
  remote_path = @options[:remote_path]

  local_path += "/" unless local_path =~ %r{/\Z}
  remote_path += "/" unless remote_path =~ %r{/\Z}

  release.log(self, "Starting upload of #{(@release.build_path + '*')} to #{@options[:host]}")
  rsync(@options[:rsync], local_path, remote_path)
end