Module: Pullr::SCM::Rsync
- Includes:
- CommandLine
- Defined in:
- lib/pullr/scm/rsync.rb
Instance Method Summary collapse
-
#rsync_uri(uri) ⇒ String
Converts a given URI to one compatible with
rsync
. -
#scm_pull(uri, dest = nil) ⇒ Object
Pulls down a copy of a Rsync source repository.
-
#scm_update(path, uri = nil) ⇒ Object
Updates a local Rsync repository.
Methods included from CommandLine
Instance Method Details
#rsync_uri(uri) ⇒ String
Converts a given URI to one compatible with rsync
.
51 52 53 54 55 56 57 58 |
# File 'lib/pullr/scm/rsync.rb', line 51 def rsync_uri(uri) new_uri = uri.host new_uri = "#{uri.user}@#{new_uri}" if uri.user new_uri = "#{new_uri}:#{uri.path}" unless uri.path.empty? return new_uri end |
#scm_pull(uri, dest = nil) ⇒ Object
Pulls down a copy of a Rsync source repository.
17 18 19 20 21 22 23 |
# File 'lib/pullr/scm/rsync.rb', line 17 def scm_pull(uri,dest=nil) unless dest raise(ArgumentError,"the destination argument for clone is missing",caller) end sh 'rsync', '-a', rsync_uri(uri), dest end |
#scm_update(path, uri = nil) ⇒ Object
Updates a local Rsync repository.
34 35 36 37 38 39 40 |
# File 'lib/pullr/scm/rsync.rb', line 34 def scm_update(path,uri=nil) unless uri raise(ArgumentError,"must specify the 'uri' argument to pull from",caller) end sh 'rsync', '-v', '-a', '--delete-after', rsync_uri(uri), path end |