Class: RbRsync::RbRsync
- Inherits:
-
Object
- Object
- RbRsync::RbRsync
- Defined in:
- lib/rbrsync/rbrsync.rb
Constant Summary collapse
- @@boolean_methods =
[]
Instance Attribute Summary collapse
- #from ⇒ Object
-
#from_host ⇒ Object
Returns the value of attribute from_host.
-
#from_path ⇒ Object
Returns the value of attribute from_path.
-
#from_user ⇒ Object
Returns the value of attribute from_user.
-
#rsync ⇒ Object
the path to rsync.
- #to ⇒ Object
-
#to_host ⇒ Object
Returns the value of attribute to_host.
-
#to_path ⇒ Object
Returns the value of attribute to_path.
-
#to_user ⇒ Object
Returns the value of attribute to_user.
Class Method Summary collapse
Instance Method Summary collapse
-
#command ⇒ Object
returns the rsync command that would be executed.
-
#go! ⇒ Object
perform the sync.
-
#initialize(from = nil, to = nil) ⇒ RbRsync
constructor
A new instance of RbRsync.
- #no ⇒ Object
Constructor Details
#initialize(from = nil, to = nil) ⇒ RbRsync
Returns a new instance of RbRsync.
7 8 9 10 11 12 13 |
# File 'lib/rbrsync/rbrsync.rb', line 7 def initialize from=nil, to=nil @options = {} self.from = from self.to = to self.rsync = "rsync" end |
Instance Attribute Details
#from ⇒ Object
222 223 224 |
# File 'lib/rbrsync/rbrsync.rb', line 222 def from @from ||= build_path(from_user, from_host, from_path) end |
#from_host ⇒ Object
Returns the value of attribute from_host.
219 220 221 |
# File 'lib/rbrsync/rbrsync.rb', line 219 def from_host @from_host end |
#from_path ⇒ Object
Returns the value of attribute from_path.
219 220 221 |
# File 'lib/rbrsync/rbrsync.rb', line 219 def from_path @from_path end |
#from_user ⇒ Object
Returns the value of attribute from_user.
219 220 221 |
# File 'lib/rbrsync/rbrsync.rb', line 219 def from_user @from_user end |
#rsync ⇒ Object
the path to rsync
218 219 220 |
# File 'lib/rbrsync/rbrsync.rb', line 218 def rsync @rsync end |
#to ⇒ Object
227 228 229 |
# File 'lib/rbrsync/rbrsync.rb', line 227 def to @to ||= build_path(to_user, to_host, to_path) end |
#to_host ⇒ Object
Returns the value of attribute to_host.
220 221 222 |
# File 'lib/rbrsync/rbrsync.rb', line 220 def to_host @to_host end |
#to_path ⇒ Object
Returns the value of attribute to_path.
220 221 222 |
# File 'lib/rbrsync/rbrsync.rb', line 220 def to_path @to_path end |
#to_user ⇒ Object
Returns the value of attribute to_user.
220 221 222 |
# File 'lib/rbrsync/rbrsync.rb', line 220 def to_user @to_user end |
Class Method Details
.boolean_methods ⇒ Object
251 252 253 |
# File 'lib/rbrsync/rbrsync.rb', line 251 def self.boolean_methods @@boolean_methods end |
Instance Method Details
#command ⇒ Object
returns the rsync command that would be executed
237 238 239 |
# File 'lib/rbrsync/rbrsync.rb', line 237 def command build_command.join ' ' end |
#go! ⇒ Object
perform the sync
242 243 244 245 246 247 248 249 |
# File 'lib/rbrsync/rbrsync.rb', line 242 def go! raise ArgumentError.new("a source and destination must be specified") if to.nil? || from.nil? status = Open4.popen4(command) do |pid, stdin, stdout, stderr| puts stderr.read if stderr end end |