Class: Muchkeys::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/muchkeys/cli.rb

Defined Under Namespace

Modules: MuchkeysExecutor

Instance Method Summary collapse

Instance Method Details

#__versionObject



70
71
72
73
# File 'lib/muchkeys/cli.rb', line 70

def __version
  Muchkeys.configure { |c| c.consul_url = options[:consul_url] }
  say Muchkeys::VERSION
end

#check(app_name) ⇒ Object



27
28
29
30
# File 'lib/muchkeys/cli.rb', line 27

def check(app_name)
  Muchkeys.configure { |c| c.consul_url = options[:consul_url] }
  say MuchkeysExecutor.check(app_name)
end

#decrypt(consul_key) ⇒ Object



21
22
23
24
# File 'lib/muchkeys/cli.rb', line 21

def decrypt(consul_key)
  Muchkeys.configure { |c| c.consul_url = options[:consul_url] }
  say MuchkeysExecutor.decrypt(consul_key, options[:public_key], options[:private_key])
end

#delete(key) ⇒ Object



64
65
66
67
# File 'lib/muchkeys/cli.rb', line 64

def delete(key)
  Muchkeys.configure { |c| c.consul_url = options[:consul_url] }
  say MuchkeysExecutor.delete(key)
end

#encrypt(file) ⇒ Object



13
14
15
16
# File 'lib/muchkeys/cli.rb', line 13

def encrypt(file)
  Muchkeys.configure { |c| c.consul_url = options[:consul_url] }
  say MuchkeysExecutor.encrypt(file, options[:public_key])
end

#fetch(consul_key) ⇒ Object



39
40
41
42
# File 'lib/muchkeys/cli.rb', line 39

def fetch(consul_key)
  Muchkeys.configure { |c| c.consul_url = options[:consul_url] }
  say MuchkeysExecutor.fetch(consul_key)
end

#list(app_name) ⇒ Object



33
34
35
36
# File 'lib/muchkeys/cli.rb', line 33

def list(app_name)
  Muchkeys.configure { |c| c.consul_url = options[:consul_url] }
  say MuchkeysExecutor.list(app_name)
end

#store(data, consul_key) ⇒ Object



47
48
49
50
# File 'lib/muchkeys/cli.rb', line 47

def store(data, consul_key)
  Muchkeys.configure { |c| c.consul_url = options[:consul_url] }
  say MuchkeysExecutor.store(consul_key, data, public_key: options[:public_key], private_key: options[:private_key])
end

#wipeoutObject



54
55
56
57
58
59
60
61
# File 'lib/muchkeys/cli.rb', line 54

def wipeout
  Muchkeys.configure { |c| c.consul_url = options[:consul_url] }
  unless yes?("Really clear consul instance at #{Muchkeys.config.consul_url}?", Thor::Shell::Color::RED)
    say "Nothing done!"
  else
    say MuchkeysExecutor.wipeout(app_name: options[:app_name])
  end
end