Class: Abt::Providers::Harvest::Commands::Clear

Inherits:
BaseCommand show all
Defined in:
lib/abt/providers/harvest/commands/clear.rb

Instance Attribute Summary

Attributes inherited from BaseCommand

#config, #path

Attributes inherited from BaseCommand

#ari, #cli, #flags

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseCommand

#initialize

Methods inherited from BaseCommand

#initialize

Constructor Details

This class inherits a constructor from Abt::Providers::Harvest::BaseCommand

Class Method Details

.descriptionObject



12
13
14
# File 'lib/abt/providers/harvest/commands/clear.rb', line 12

def self.description
  "Clear harvest configuration"
end

.flagsObject



16
17
18
19
20
21
22
# File 'lib/abt/providers/harvest/commands/clear.rb', line 16

def self.flags
  [
    ["-g", "--global",
     "Clear global instead of local harvest configuration (credentials etc.)"],
    ["-a", "--all", "Clear all harvest configuration"]
  ]
end

.usageObject



8
9
10
# File 'lib/abt/providers/harvest/commands/clear.rb', line 8

def self.usage
  "abt clear harvest"
end

Instance Method Details

#performObject



24
25
26
27
28
29
30
31
# File 'lib/abt/providers/harvest/commands/clear.rb', line 24

def perform
  abort("Flags --global and --all cannot be used together") if flags[:global] && flags[:all]

  config.clear_local unless flags[:global]
  config.clear_global if flags[:global] || flags[:all]

  warn("Configuration cleared")
end