lockr 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/lockr.rb CHANGED
@@ -8,11 +8,15 @@ require 'lockr/action/add'
8
8
  require 'lockr/action/list'
9
9
  require 'lockr/action/remove'
10
10
  require 'lockr/action/show'
11
+ require 'lockr/config'
11
12
  require 'lockr/pwdgen'
13
+ require 'lockr/version'
12
14
 
13
15
  class Lockr
16
+
14
17
  def run()
15
18
  options = parse_options()
19
+ merge_config( options)
16
20
  validate_options( options)
17
21
  acquire_additional_input( options)
18
22
  process_actions( options)
@@ -58,6 +62,14 @@ class Lockr
58
62
  puts opts
59
63
  exit
60
64
  end
65
+
66
+ opts.on('-v', '--version', 'Show version') do
67
+ puts "Lockr #{LockrVer::VERSION} (#{LockrVer::DATE})"
68
+ exit
69
+ end
70
+
71
+ opts.separator ""
72
+ opts.separator "For detailed instructions on how to use Lockr, please visit http://lockr.byteblues.com"
61
73
  end
62
74
 
63
75
  # Parse the command-line. Remember there are two forms
@@ -70,6 +82,21 @@ class Lockr
70
82
  options
71
83
  end
72
84
 
85
+ def merge_config( options)
86
+ configfile = Configuration.new()
87
+
88
+ if configfile.config.nil?
89
+ return
90
+ end
91
+
92
+ unless configfile.config.has_key?( :lockr)
93
+ return
94
+ end
95
+
96
+ cfg = configfile.config[:lockr]
97
+ options[:vault] = File.expand_path(cfg[:vault]) if options[:vault] == 'vault.yaml'
98
+ end
99
+
73
100
  def validate_options( options)
74
101
  if options[:action].nil?
75
102
  puts 'Please provide an action (--action)'
@@ -0,0 +1,15 @@
1
+ class Configuration
2
+ CONFIG_FILE = '.lockr'
3
+ attr_reader :config
4
+
5
+ def initialize()
6
+ @config = nil
7
+
8
+ filename = File.expand_path("~/#{CONFIG_FILE}")
9
+ if File.exists?( filename)
10
+ File.open( filename, 'r') do |f|
11
+ @config = YAML::load(f)
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,4 @@
1
+ module LockrVer
2
+ VERSION = "0.2.1"
3
+ DATE = "2012-08-10"
4
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lockr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-06 00:00:00.000000000 Z
12
+ date: 2012-08-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: highline
16
- requirement: &70213081483480 !ruby/object:Gem::Requirement
16
+ requirement: &70152742830400 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70213081483480
24
+ version_requirements: *70152742830400
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bundler
27
- requirement: &70213081482560 !ruby/object:Gem::Requirement
27
+ requirement: &70152742829840 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70213081482560
35
+ version_requirements: *70152742829840
36
36
  description: Store your passwords AES encrypted in a simple yaml file
37
37
  email: info@byteblues.com
38
38
  executables:
@@ -48,8 +48,10 @@ files:
48
48
  - lib/lockr/action/remove.rb
49
49
  - lib/lockr/action/show.rb
50
50
  - lib/lockr/encryption/aes.rb
51
+ - lib/lockr/config.rb
51
52
  - lib/lockr/pwdgen.rb
52
53
  - lib/lockr/pwdstore.rb
54
+ - lib/lockr/version.rb
53
55
  - !binary |-
54
56
  YmluL2xvY2ty
55
57
  homepage: http://lockr.byteblues.com/