Class: Rush::Connection::Remote
- Inherits:
-
Object
- Object
- Rush::Connection::Remote
- Defined in:
- lib/rush/remote.rb
Overview
wrapper of command
sshfs '-o idmap=user <user_name>@<server_address>:<path> <local_path>'
Instance Attribute Summary collapse
-
#full_remote_path ⇒ Object
readonly
Returns the value of attribute full_remote_path.
-
#local_path ⇒ Object
readonly
Returns the value of attribute local_path.
-
#remote_path ⇒ Object
readonly
Returns the value of attribute remote_path.
-
#remote_server ⇒ Object
readonly
Returns the value of attribute remote_server.
-
#remote_user ⇒ Object
readonly
Returns the value of attribute remote_user.
Instance Method Summary collapse
- #connect ⇒ Object (also: #mount)
- #disconnect ⇒ Object (also: #umount)
-
#initialize(full_remote_path, local_path) ⇒ Remote
constructor
A new instance of Remote.
- #method_missing(meth, *args, &block) ⇒ Object
Constructor Details
#initialize(full_remote_path, local_path) ⇒ Remote
Returns a new instance of Remote.
10 11 12 13 14 15 16 17 |
# File 'lib/rush/remote.rb', line 10 def initialize(full_remote_path, local_path) local_path = local_path.full_path if local_path.respond_to?(:full_path) @full_remote_path = full_remote_path @local_path = Rush::Dir.new(local_path) @local_path.create unless @local_path.exists? @remote_user, server_and_path = *full_remote_path.split('@', 2) @remote_server, @remote_address = *server_and_path.split(':', 2) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
29 30 31 |
# File 'lib/rush/remote.rb', line 29 def method_missing(meth, *args, &block) @local_path.send(meth, *args, &block) end |
Instance Attribute Details
#full_remote_path ⇒ Object (readonly)
Returns the value of attribute full_remote_path.
8 9 10 |
# File 'lib/rush/remote.rb', line 8 def full_remote_path @full_remote_path end |
#local_path ⇒ Object (readonly)
Returns the value of attribute local_path.
8 9 10 |
# File 'lib/rush/remote.rb', line 8 def local_path @local_path end |
#remote_path ⇒ Object (readonly)
Returns the value of attribute remote_path.
8 9 10 |
# File 'lib/rush/remote.rb', line 8 def remote_path @remote_path end |
#remote_server ⇒ Object (readonly)
Returns the value of attribute remote_server.
8 9 10 |
# File 'lib/rush/remote.rb', line 8 def remote_server @remote_server end |
#remote_user ⇒ Object (readonly)
Returns the value of attribute remote_user.
8 9 10 |
# File 'lib/rush/remote.rb', line 8 def remote_user @remote_user end |
Instance Method Details
#connect ⇒ Object Also known as: mount
19 20 21 |
# File 'lib/rush/remote.rb', line 19 def connect system "sshfs -o idmap=user #{full_remote_path} #{local_path}" end |
#disconnect ⇒ Object Also known as: umount
24 25 26 |
# File 'lib/rush/remote.rb', line 24 def disconnect system "fusermount -u #{local_path.full_path}" end |