sekrets 0.4.2 → 1.0.0
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/README +11 -9
- data/lib/sekrets/capistrano.rb +3 -5
- data/lib/sekrets.rb +5 -3
- data/sekrets.gemspec +1 -1
- data/test/sekrets_test.rb +1 -1
- metadata +1 -1
data/README
CHANGED
@@ -33,11 +33,17 @@ DESCRIPTION
|
|
33
33
|
|
34
34
|
# put the decryption key in a file
|
35
35
|
|
36
|
-
echo 42 > sekrets.key
|
36
|
+
echo 42 > .sekrets.key
|
37
37
|
|
38
38
|
# ignore this file in git
|
39
39
|
|
40
|
-
echo sekrets.key >> .gitgnore
|
40
|
+
echo .sekrets.key >> .gitgnore
|
41
|
+
|
42
|
+
# you now no longer need to provide the --key argument to commands
|
43
|
+
|
44
|
+
sekrets read config/settings.yml.enc
|
45
|
+
|
46
|
+
sekrets edit config/settings.yml.enc
|
41
47
|
|
42
48
|
# make sure this file gets deployed on your server
|
43
49
|
|
@@ -75,11 +81,7 @@ DESCRIPTION
|
|
75
81
|
- otherwise the code looks for a companion key file. for example, given the
|
76
82
|
file 'config/sekrets.yml.enc' sekrets will look for a key at
|
77
83
|
|
78
|
-
config
|
79
|
-
|
80
|
-
and
|
81
|
-
|
82
|
-
config/sekrets.yml.enc.k
|
84
|
+
config/.sekrets.yml.enc.key
|
83
85
|
|
84
86
|
if either of these is found to be non-empty the contents of the file will
|
85
87
|
be used as the decryption key for that file. you should *never* commit
|
@@ -87,11 +89,11 @@ DESCRIPTION
|
|
87
89
|
|
88
90
|
- next a project key file is looked for. the path of this file is
|
89
91
|
|
90
|
-
|
92
|
+
./.sekrets.key
|
91
93
|
|
92
94
|
normally and, in a rails' application
|
93
95
|
|
94
|
-
RAILS_ROOT
|
96
|
+
RAILS_ROOT/.sekrets.key
|
95
97
|
|
96
98
|
- if that is not found sekrets looks for the key in the environment under
|
97
99
|
the env var
|
data/lib/sekrets/capistrano.rb
CHANGED
@@ -1,19 +1,17 @@
|
|
1
1
|
Capistrano::Configuration.instance(:must_exist).load do
|
2
2
|
namespace :sekrets do
|
3
3
|
task :upload_key do
|
4
|
-
require 'fileutils'
|
5
|
-
|
6
4
|
rails_root = File.expand_path(File.dirname(__FILE__))
|
7
5
|
|
8
|
-
src = File.join(rails_root, 'sekrets.key')
|
9
|
-
dst = File.join(deploy_to, 'sekrets.key')
|
6
|
+
src = File.join(rails_root, '.sekrets.key')
|
7
|
+
dst = File.join(deploy_to, 'current', '.sekrets.key')
|
10
8
|
|
11
9
|
if test(?s, src)
|
12
10
|
upload(src, dst, :recursive => true)
|
13
11
|
end
|
14
12
|
end
|
15
13
|
end
|
16
|
-
|
14
|
+
|
17
15
|
|
18
16
|
before "deploy:finalize_update", "sekrets:upload_key"
|
19
17
|
end
|
data/lib/sekrets.rb
CHANGED
@@ -3,7 +3,7 @@ class Sekrets
|
|
3
3
|
Fattr(:env){ 'SEKRETS_KEY' }
|
4
4
|
Fattr(:editor){ ENV['SEKRETS_EDITOR'] || ENV['EDITOR'] || 'vim' }
|
5
5
|
Fattr(:root){ defined?(Rails.root) ? Rails.root : '.' }
|
6
|
-
Fattr(:project_key){ File.join(root, 'sekrets.key') }
|
6
|
+
Fattr(:project_key){ File.join(root, '.sekrets.key') }
|
7
7
|
Fattr(:global_key){ File.join(File.expand_path('~'), '.sekrets.key') }
|
8
8
|
|
9
9
|
#
|
@@ -19,10 +19,12 @@ class Sekrets
|
|
19
19
|
path = path_for(path)
|
20
20
|
|
21
21
|
if path
|
22
|
+
dirname, basename = File.split(path)
|
23
|
+
|
22
24
|
keyfiles =
|
23
25
|
Coerce.list_of_strings(
|
24
26
|
[:keyfile, :keyfiles].map{|k| options[k]},
|
25
|
-
%W[ #{
|
27
|
+
%W[ #{ dirname }/.#{ basename }.key #{ dirname }/.#{ basename }.k ]
|
26
28
|
)
|
27
29
|
|
28
30
|
keyfiles.each do |file|
|
@@ -284,7 +286,7 @@ BEGIN {
|
|
284
286
|
require 'tmpdir'
|
285
287
|
|
286
288
|
class Sekrets < ::String
|
287
|
-
Version = '0.
|
289
|
+
Version = '1.0.0' unless defined?(Version)
|
288
290
|
|
289
291
|
class << Sekrets
|
290
292
|
def version
|
data/sekrets.gemspec
CHANGED
data/test/sekrets_test.rb
CHANGED