Module: DeeBee::Command

Defined in:
lib/dee_bee/command.rb

Class Method Summary collapse

Class Method Details

.optionsObject



6
7
8
# File 'lib/dee_bee/command.rb', line 6

def options
  @options ||= parse_options
end

.runObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/dee_bee/command.rb', line 10

def run
  if options.empty?
    print(red, "Dee Bee needs some work to do, please specify an operation parameter.", reset, "\n")
    exit
  end

  configuration = DeeBee::Configuration.new(options[:settings_yaml])

  print(yellow, "\nDee Bee buzzing at #{Time.now}", reset, "\n")

  if !!options[:perform_backup]
    DeeBee::Backup.new(configuration).execute
  end

  if !!options[:perform_rotation]
    DeeBee::FileRotation.new(configuration).execute
  end

  if !!options[:perform_cloud_sync]
    DeeBee::CloudSync.new(configuration).execute
  end

  if !!options[:perform_all]
    DeeBee::Backup.new(configuration).execute
    DeeBee::FileRotation.new(configuration).execute
    DeeBee::CloudSync.new(configuration).execute
  end
end