Module: LinuxAdmin::Mountable
Defined Under Namespace
Modules: ClassMethods
Constant Summary
Constants included from Common
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.
3 4 5 |
# File 'lib/linux_admin/mountable.rb', line 3 def fs_type @fs_type end |
#mount_point ⇒ Object
Returns the value of attribute mount_point.
4 5 6 |
# File 'lib/linux_admin/mountable.rb', line 4 def mount_point @mount_point end |
Class Method Details
.included(base) ⇒ Object
20 21 22 |
# File 'lib/linux_admin/mountable.rb', line 20 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#format_to(filesystem) ⇒ Object
24 25 26 27 28 |
# File 'lib/linux_admin/mountable.rb', line 24 def format_to(filesystem) run!(cmd(:mke2fs), :params => { '-t' => filesystem, nil => self.path}) @fs_type = filesystem end |
#mount(mount_point) ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/linux_admin/mountable.rb', line 30 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
41 42 43 |
# File 'lib/linux_admin/mountable.rb', line 41 def umount run!(cmd(:umount), :params => { nil => [@mount_point] }) end |