Module: LinuxAdmin::Mountable
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#fs_type ⇒ Object
Returns the value of attribute fs_type.
-
#mount_point ⇒ Object
Returns the value of attribute mount_point.
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Common
Instance Attribute Details
#fs_type ⇒ Object
Returns the value of attribute fs_type.
8 9 10 |
# File 'lib/linux_admin/mountable.rb', line 8 def fs_type @fs_type end |
#mount_point ⇒ Object
Returns the value of attribute mount_point.
9 10 11 |
# File 'lib/linux_admin/mountable.rb', line 9 def mount_point @mount_point end |
Class Method Details
.included(base) ⇒ Object
25 26 27 |
# File 'lib/linux_admin/mountable.rb', line 25 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#format_to(filesystem) ⇒ Object
29 30 31 32 33 |
# File 'lib/linux_admin/mountable.rb', line 29 def format_to(filesystem) run!(cmd(:mke2fs), :params => { '-t' => filesystem, nil => self.path}) @fs_type = filesystem end |
#mount(mount_point) ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/linux_admin/mountable.rb', line 35 def mount(mount_point) FileUtils.mkdir(mount_point) unless File.directory?(mount_point) if self.class.mount_point_exists?(mount_point) raise ArgumentError, "disk already mounted at #{mount_point}" end run!(cmd(:mount), :params => { nil => [self.path, mount_point] }) @mount_point = mount_point end |
#umount ⇒ Object
46 47 48 |
# File 'lib/linux_admin/mountable.rb', line 46 def umount run!(cmd(:umount), :params => { nil => [@mount_point] }) end |