Class: Monster::Remote::Sync
- Inherits:
-
Object
- Object
- Monster::Remote::Sync
- Defined in:
- lib/monster/remote/sync.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
writeonly
Sets the attribute host.
-
#port ⇒ Object
writeonly
Sets the attribute port.
-
#verbose ⇒ Object
writeonly
Sets the attribute verbose.
Instance Method Summary collapse
-
#initialize(wrapper, local_dir = nil, remote_dir = nil, verbose = nil) ⇒ Sync
constructor
A new instance of Sync.
- #start(user = nil, password = nil, host = "localhost", port = 21) ⇒ Object
Constructor Details
#initialize(wrapper, local_dir = nil, remote_dir = nil, verbose = nil) ⇒ Sync
Returns a new instance of Sync.
8 9 10 11 12 13 |
# File 'lib/monster/remote/sync.rb', line 8 def initialize(wrapper, local_dir=nil, remote_dir=nil, verbose=nil) @wrapper = wrapper local_dir && @local_dir = local_dir remote_dir && @remote_dir = remote_dir verbose && @verbose = verbose end |
Instance Attribute Details
#host=(value) ⇒ Object (writeonly)
Sets the attribute host
6 7 8 |
# File 'lib/monster/remote/sync.rb', line 6 def host=(value) @host = value end |
#port=(value) ⇒ Object (writeonly)
Sets the attribute port
6 7 8 |
# File 'lib/monster/remote/sync.rb', line 6 def port=(value) @port = value end |
#verbose=(value) ⇒ Object (writeonly)
Sets the attribute verbose
6 7 8 |
# File 'lib/monster/remote/sync.rb', line 6 def verbose=(value) @verbose = value end |
Instance Method Details
#start(user = nil, password = nil, host = "localhost", port = 21) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/monster/remote/sync.rb', line 15 def start(user = nil, password = nil, host = "localhost", port = 21) @host = host @port = port @user = user || "" @password = password || "" @wrapper || raise(MissingProtocolWrapperError) local_dir || raise(MissingLocalDirError) remote_dir || raise(MissingRemoteDirError) out("syncing from: #{local_dir} to: #{remote_dir}") open(@wrapper) do |wrapper| out("connection openned, using: #{wrapper}") copy_to_remote(wrapper, local_dir) end end |