Class: HttpLockrInit
- Inherits:
-
Object
- Object
- HttpLockrInit
- Defined in:
- lib/lockr/http/httplockrinit.rb
Instance Method Summary collapse
Instance Method Details
#getLoadBrowser ⇒ Object
30 31 32 |
# File 'lib/lockr/http/httplockrinit.rb', line 30 def getLoadBrowser return @load_browser end |
#getPwdMgr ⇒ Object
26 27 28 |
# File 'lib/lockr/http/httplockrinit.rb', line 26 def getPwdMgr return @pwdmgr end |
#parse_options ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/lockr/http/httplockrinit.rb', line 34 def () = {} optparse = OptionParser.new do|opts| # Set a banner, displayed at the top # of the help screen. opts. = "Usage: httplockr [options]" [:keyfile] = nil opts.on( '-k', '--keyfile FILE', 'the FILE to use as key for the password encryption') do |file| [:keyfile] = File.(file) end [:vault] = 'vault.yaml' opts.on( '-v', '--vault FILE', 'FILE is the name of the vault to store the password sets') do |file| [:vault] = File.(file) end [:browser] = false opts.on( '-b', '--browser', 'open browser windows for lockr') do |d| [:browser] = true end # This displays the help screen, all programs are # assumed to have this option. opts.on( '-h', '--help', 'Display this screen' ) do puts opts exit end opts.on('--version', 'Show version') do puts "HttpLockr #{LockrVer::VERSION} (#{LockrVer::DATE})" exit end opts.separator "" opts.separator "For detailed instructions on how to use HttpLockr, please visit http://lockr.byteblues.com" end # Parse the command-line. Remember there are two forms # of the parse method. The 'parse' method simply parses # ARGV, while the 'parse!' method parses ARGV and removes # any options found there, as well as any parameters for # the options. What's left is the list of files to resize. optparse.parse! end |
#start ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/lockr/http/httplockrinit.rb', line 7 def start() = () unless [:keyfile] puts 'Please provide a keyfile' raise ArgumentError end configfile = Configuration.new() cfg = nil if configfile.config cfg = configfile.config[:lockr] end [:vault] = File.(cfg[:vault]) if [:vault] == 'vault.yaml' and cfg != nil @pwdmgr = PasswordManager.new( [:keyfile], [:vault]) @load_browser = [:browser] end |