Class: Capistrano::SCM::Rsync
- Inherits:
-
Plugin
- Object
- Plugin
- Capistrano::SCM::Rsync
- Defined in:
- lib/capistrano/scm/rsync.rb
Instance Method Summary collapse
- #copy_local_to_remote(role) ⇒ Object
- #create_release ⇒ Object
- #define_tasks ⇒ Object
- #register_hooks ⇒ Object
- #set_defaults ⇒ Object
Instance Method Details
#copy_local_to_remote(role) ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/capistrano/scm/rsync.rb', line 35 def copy_local_to_remote(role) if dry_run? puts "Would execute: #{rsync_command(role).inspect}" return end RakeFileUtils.sh(*rsync_command(role)) end |
#create_release ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/capistrano/scm/rsync.rb', line 44 def create_release # Skip copying if we've already synced straight to the release directory. return unless remote_cache copy = [ 'rsync', fetch(:rsync_options)[:args][:cache_to_release], File.join(remote_directory, '/').shellescape, '.' ].flatten backend.execute(*copy) end |
#define_tasks ⇒ Object
26 27 28 |
# File 'lib/capistrano/scm/rsync.rb', line 26 def define_tasks eval_rakefile(File.('../tasks/rsync.rake', __FILE__)) end |
#register_hooks ⇒ Object
30 31 32 33 |
# File 'lib/capistrano/scm/rsync.rb', line 30 def register_hooks after 'deploy:new_release_path', 'rsync:create_release' before 'deploy:set_current_revision', 'rsync:set_current_revision' end |
#set_defaults ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/capistrano/scm/rsync.rb', line 6 def set_defaults set_if_empty :rsync_options, # The local directory to be copied to the server. source: 'app', # The cache directory on the server that receives files # from the source directory. Relative to shared_path or # an absolute path. # Saves you rsyncing your whole app folder each time. If # set to nil Capistrano::SCM::Rsync will sync directly to # the release_path. cache: 'cache', # Arguments passed to rsync when... args: { # ...copying the local directory to the server. local_to_remote: [], # ...copying the cache directory to the release_path. cache_to_release: %w(--archive --acls --xattrs) } end |