seekrit 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/bin/seekrit +15 -7
  2. metadata +4 -4
@@ -4,15 +4,22 @@ require 'seekrit/interactor'
4
4
  require 'highline/import'
5
5
  require 'fileutils'
6
6
 
7
- DATAFILE = ENV['HOME'] + '/.config/seekrit/secrets'
7
+ SEEKRIT_DIR = File.join(ENV["HOME"], ".config", "seekrit")
8
+ PRE_LOAD = "pre-load"
9
+ POST_SAVE = "post-save"
10
+ SECRETS = "secrets"
11
+
12
+ def run(file)
13
+ return unless File.exist?(file)
14
+ system "./#{file}"
15
+ end
8
16
 
9
17
  def interactor(&blk)
10
- err = nil
11
- unless File.exist?(DATAFILE)
12
- FileUtils.mkdir_p File.dirname(DATAFILE)
13
- FileUtils.touch DATAFILE
14
- end
15
- File.open(DATAFILE, "r+") do |file|
18
+ FileUtils.mkdir_p SEEKRIT_DIR
19
+ Dir.chdir SEEKRIT_DIR
20
+ run PRE_LOAD
21
+ FileUtils.touch SECRETS unless File.exist?(SECRETS)
22
+ File.open(SECRETS, "r+") do |file|
16
23
  begin
17
24
  password = lambda{ ask('Enter password: '){ |q| q.echo = false } }
18
25
  store = Seekrit::Store.new(password, file)
@@ -22,6 +29,7 @@ def interactor(&blk)
22
29
  exit 1
23
30
  end
24
31
  end
32
+ run POST_SAVE
25
33
  end
26
34
 
27
35
  command = ARGV.shift
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seekrit
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 4
10
- version: 0.2.4
9
+ - 5
10
+ version: 0.2.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Paul Battley
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-07 00:00:00 +00:00
18
+ date: 2011-02-08 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency