Class: ConfigliereScript

Inherits:
Configliere::CommandClient
  • Object
show all
Defined in:
bin/configliere

Instance Method Summary collapse

Instance Method Details

#change_keyObject



68
69
70
71
72
73
74
75
# File 'bin/configliere', line 68

def change_key
  param = get(handle)
  new_key = option_or_ask(:new_key)
  new_hsh = param.to_decrypted
  new_param = Configliere::Param.new(new_key, new_hsh)
  store.put! handle, new_param
  Log.info "Changed param key for #{handle}: #{new_param}"
end

#decryptObject



41
42
43
44
45
# File 'bin/configliere', line 41

def decrypt
  Log.info "Storing info for #{handle} in **DECRYPTED** form."
  param = get(handle)
  store.put_decrypted!(handle, param)
end

#deleteObject



53
54
55
56
# File 'bin/configliere', line 53

def delete
  Log.info "Permanently deleting stored info for #{handle}. O, I die, Horatio."
  store.delete! handle, options[:key]
end

#encryptObject



38
# File 'bin/configliere', line 38

def encrypt() fix end

#fixObject



33
34
35
36
# File 'bin/configliere', line 33

def fix
  Log.info "Fixing stored info for #{handle}"
  store.fix!(handle, option_or_ask(:key))
end

#listObject



48
49
50
# File 'bin/configliere', line 48

def list
  puts "List of param names: #{store.handles.inspect}"
end

#process_options!(*args) ⇒ Object



20
21
22
23
24
# File 'bin/configliere', line 20

def process_options! *args
  super *args
  self.command = options[:_rest].shift.to_sym rescue nil
  self.handle  = options[:_rest].shift.to_sym rescue nil
end

#setObject



59
60
61
62
63
64
65
# File 'bin/configliere', line 59

def set
  param = get(handle)
  param.merge! external_options
  store.put handle, param
  store.save!
  Log.info "Stored configuration for #{handle}: #{param}"
end

#showObject



78
79
80
81
# File 'bin/configliere', line 78

def show
  param = get(handle)
  puts "Stored info for #{handle}:\n  #{param.to_s}"
end

#usageObject



9
10
11
12
13
14
15
16
17
18
# File 'bin/configliere', line 9

def usage
%Q{Client for the configliere gem: manipulate configuration and passwords for automated scripts

usage: #{File.basename($0)} command handle [...--option=val...]
where
  command:             One of: #{COMMANDS.keys[0..-2].join(', ')} or #{COMMANDS.keys.last}
  handle:              Name of the configliere group (within the configliere_file) or path to a configliere YAML file.

Configuration taken from #{configliere_file} by default.}
end