Class: Irgat::Kwallet

Inherits:
Irgat
  • Object
show all
Defined in:
lib/modules/kwallet.rb

Instance Attribute Summary

Attributes inherited from Irgat

#action, #commands_launched, #config, #config_module, #folders, #init_time, #log_process, #programs

Instance Method Summary collapse

Methods inherited from Irgat

#help, #load_config, #process

Methods included from Dependencies

#check_dependencies

Methods included from Execs

#execute_command, #exit_with_error

Methods included from Mail

#send_email

Methods included from Log

#log, #output_log, #report_to_email, #report_to_log

Methods included from Help

#show_help

Constructor Details

#initialize(values = []) ⇒ Kwallet

initialize the Class… make default operations



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/modules/kwallet.rb', line 35

def initialize(values = [])
  # Create and irgat process
  irgat_process = Irgat.new()
  # Get the instance variables
  @config = irgat_process.config
  # load options for subsystem
  @config_module = self.load_config
  @init_time = Time.now
  # build the programs needed
  need_programs = ["dcop", "gpg"]
  
  # get kwallet code at start
  @code ||= get_kwallet_int_code[:output].strip
  @log_to_output = true # FIXME

end

Instance Method Details

#default(args) ⇒ Object



52
53
54
# File 'lib/modules/kwallet.rb', line 52

def default(args)
  do_petition(args)
end

#do_petition(args) ⇒ Object



62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/modules/kwallet.rb', line 62

def do_petition(args)
  petition = args.shift
  if !petition or petition == ""
    log("text","No petition registered. Options are: list, show", 1)
  else
    if !args.empty?
      self.send(petition, (args))
    else
      self.send(petition)
    end
  end
end

#kk(args) ⇒ Object



56
57
58
59
60
# File 'lib/modules/kwallet.rb', line 56

def kk(args)
execute_command("ls /med","kk")
exit
#      execute_command("su - \n\n\n","kk de lavaka")
end

#list(args = []) ⇒ Object



89
90
91
92
93
94
95
96
97
98
99
# File 'lib/modules/kwallet.rb', line 89

def list( args = [])
  option = args.first
  if !option
    return " List stored objects. Specify a folder from list: #{ show_folders[:output].gsub(/\n/,' ') }"
  else
    if option == "all"
    else
      show_passwd_list(option.strip)
    end
  end
end

#show(arg = []) ⇒ Object



75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/modules/kwallet.rb', line 75

def show( arg = [])
  puts arg.inspect
  args = arg.split(' ')
  folder = args.shift
  entry  = args.shift
  puts folder
  puts entry
  if !folder || !entry
    return "Select a folder or entry"
  else
    return "Value: #{ get_passwd_entry(folder,entry) }"
  end
end