Class: Wdmc::TimeMachine
- Inherits:
-
Thor
- Object
- Thor
- Wdmc::TimeMachine
- Includes:
- Enumerable
- Defined in:
- lib/wdmc/timemachine.rb
Instance Method Summary collapse
- #get ⇒ Object
-
#initialize(*args) ⇒ TimeMachine
constructor
A new instance of TimeMachine.
- #set(name) ⇒ Object
Constructor Details
#initialize(*args) ⇒ TimeMachine
Returns a new instance of TimeMachine.
5 6 7 8 |
# File 'lib/wdmc/timemachine.rb', line 5 def initialize(*args) @wdmc = Wdmc::Client.new super end |
Instance Method Details
#get ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/wdmc/timemachine.rb', line 11 def get get_tm = @wdmc.get_tm puts "Time Machine".upcase.color(:magenta) puts "\sBackup Share\t\t: ".color(:whitesmoke) + get_tm[:backup_share] puts "\sEnabled\t\t: ".color(:whitesmoke) + get_tm[:backup_enabled].color(:green) if get_tm[:backup_enabled] == 'true' puts "\sEnabled\t\t: ".color(:whitesmoke) + get_tm[:backup_enabled].color(:orange) if get_tm[:backup_enabled] == 'false' if get_tm[:backup_size_limit] == '0' puts "\sSize Limit\t\t: ".color(:whitesmoke) + "unlimited" else puts "\sSize Limit\t\t: ".color(:whitesmoke) + Filesize.from("#{get_tm[:backup_size_limit]} B").to_s('GB') end end |
#set(name) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/wdmc/timemachine.rb', line 27 def set( name ) share_exists = @wdmc.share_exists?( name ) abort "\nShare does not exist: ".color(:yellow) + "#{name}".color(:cyan) unless share_exists.include?( name ) data = { :backup_enabled => [:backup_enabled], :backup_size_limit => Filesize.from("#{[:backup_size_limit]}").to_i } puts "Set TimeMachine:\s".color(:whitesmoke) + "OK".color(:green) if @wdmc.set_tm( data ) end |