Class: Gitfyncy::Remote
- Inherits:
-
Object
- Object
- Gitfyncy::Remote
- Defined in:
- lib/gitfyncy.rb
Instance Method Summary collapse
- #command(cmd) ⇒ Object
-
#initialize(remote, path) ⇒ Remote
constructor
A new instance of Remote.
- #scp(paths) ⇒ Object
- #ssh_rm(paths) ⇒ Object
Constructor Details
#initialize(remote, path) ⇒ Remote
Returns a new instance of Remote.
14 15 16 17 |
# File 'lib/gitfyncy.rb', line 14 def initialize(remote, path) @remote = remote @path = Gitfyncy.slashify path end |
Instance Method Details
#command(cmd) ⇒ Object
19 20 21 22 |
# File 'lib/gitfyncy.rb', line 19 def command(cmd) puts "#{Gitfyncy::PREFIX}: #{cmd}" system cmd end |
#scp(paths) ⇒ Object
24 25 26 27 |
# File 'lib/gitfyncy.rb', line 24 def scp(paths) return if paths.empty? command "rsync -zR #{paths.to_a.join ' '} #{@remote}:#{@path}" end |
#ssh_rm(paths) ⇒ Object
29 30 31 32 |
# File 'lib/gitfyncy.rb', line 29 def ssh_rm(paths) return if paths.empty? command "ssh #{@remote} 'cd #{@path}; rm -f #{paths.to_a.join ' '}'" end |