sekrets 1.10.0 → 1.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/bin/sekrets +11 -16
  4. data/lib/sekrets.rb +24 -8
  5. data/sekrets.gemspec +1 -1
  6. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eae5557799ee5e82130f9e7a15a298f166b10f49
4
- data.tar.gz: 3d9e87c57cbb35dfb8826fece73e93eeee51cb3d
3
+ metadata.gz: d4dd69d78364d9acd5caa6fca9607e5e1443fe8e
4
+ data.tar.gz: ab7f57bec13c2916b19a6dea4831ca1dca155662
5
5
  SHA512:
6
- metadata.gz: c81545e69ac61d60c5bb36bc5f4f99596c554fdc5c34e97f908458fd6e38a47c7ca1c072d3ceb7313acae958a78d73506c02a18ca525d7b2a7e71baa1d2e7a93
7
- data.tar.gz: 4b35556bd48a4183f3c8e9e232553201e03d55f0b5baa8494d50d6e16f610bfae6d70b78cde456165c7a9dec0f7010221e2cc6a66ec09a1f38ab2ae246dd6e2c
6
+ metadata.gz: 207fffa3fedbe325336c420e4929670a7136ac05a8c023462e9f883f007fa488f3abe3abb1d90d5554758984a4db5969f0c243252462c0da5753c3713a95e618
7
+ data.tar.gz: 901db375c92b81deb9222c0e3856b8f6d7838f606231a0affaf5b18a2bfbe606ddc7a93205f20bfae88ef470cd079ad281e3d253c4b097aa42084d0f85ffb450
data/README.md CHANGED
@@ -14,7 +14,7 @@ sekrets is a command line tool and library used to securely manage encrypted fil
14
14
 
15
15
  sekrets provides commandline tools and a library to manage and access encrypted files in your code base.
16
16
 
17
- It allows one to check encrypted infomation into a repository and to manage it alongside the rest of the code base. It elimnates the need to check in unencrypted information, keys, or other sensitive infomation.
17
+ It allows one to check encrypted information into a repository and to manage it alongside the rest of the code base. It eliminates the need to check in unencrypted information, keys, or other sensitive information.
18
18
 
19
19
  sekrets provides both a general mechanism for managing arbitrary encrypted files and a specific mechanism for managing encrypted config files.
20
20
 
@@ -94,7 +94,7 @@ see `Sekrets.key_for` for explicit details
94
94
 
95
95
  ## KEY DISTRIBUTION
96
96
 
97
- sekrets does *not* attempt to solve the key distribution problem for you,with one exception:
97
+ sekrets does *not* attempt to solve the key distribution problem for you, with one exception:
98
98
 
99
99
  If you are using capistrano to do a *vanilla* ssh based deploy, a simple recipe is provided which will detect a local keyfile and scp it onto the remote server(s) on deploy.
100
100
 
@@ -63,9 +63,9 @@ Main {
63
63
  sekrets provides commandline tools and a library to manage and access
64
64
  encrypted files in your code base.
65
65
 
66
- it allows one to check encrypted infomation into a repository and to manage
67
- it alongside the rest of the code base. it elimnates the need to check in
68
- unencrypted information, keys, or other sensitive infomation.
66
+ it allows one to check encrypted information into a repository and to manage
67
+ it alongside the rest of the code base. it eliminates the need to check in
68
+ unencrypted information, keys, or other sensitive information.
69
69
 
70
70
  sekrets provides both a general mechanism for managing arbitrary encrypted
71
71
  files and a specific mechanism for managing encrypted config files.
@@ -323,21 +323,16 @@ Main {
323
323
  basename = File.basename(path)
324
324
  encrypted = nil
325
325
 
326
- Sekrets.tmpdir do
327
- IO.binwrite(basename, decrypted)
326
+ tmpfile = Sekrets.tmpfile_for(basename, decrypted)
327
+ command = "#{ Sekrets.editor } #{ tmpfile }"
328
328
 
329
- command = "#{ Sekrets.editor } #{ basename }"
329
+ status = Sekrets.system(command)
330
330
 
331
- if defined?(Bundler.with_clean_env)
332
- Bundler.with_clean_env{ system(command) }
333
- else
334
- system(command)
335
- end
336
-
337
- if $?.exitstatus == 0
338
- content = IO.binread(basename)
339
- Sekrets.write(path, content, :key => key)
340
- end
331
+ if status == 0
332
+ content = IO.binread(tmpfile)
333
+ Sekrets.write(path, content, :key => key)
334
+ else
335
+ abort "command `#{ command }` failed and no new `#{ path }` was saved!"
341
336
  end
342
337
  end
343
338
  }
@@ -158,7 +158,23 @@ class Sekrets
158
158
  dirname
159
159
  end
160
160
  end
161
-
161
+
162
+ def Sekrets.tmpfile_for(basename, data)
163
+ tmpfile = File.join(Sekrets.tmpdir, basename)
164
+ IO.binwrite(tmpfile, data)
165
+ tmpfile
166
+ end
167
+
168
+ def Sekrets.system(command)
169
+ if defined?(Bundler.with_clean_env)
170
+ Bundler.with_clean_env{ Kernel.system(command) }
171
+ else
172
+ Kernel.system(command)
173
+ end
174
+
175
+ return $?.exitstatus
176
+ end
177
+
162
178
  #
163
179
  def Sekrets.openw(arg, &block)
164
180
  opened = false
@@ -181,7 +197,7 @@ class Sekrets
181
197
  open(tmp, 'wb+')
182
198
  end
183
199
 
184
- close =
200
+ close =
185
201
  proc do
186
202
  io.close if opened
187
203
  atomic_move.call
@@ -214,7 +230,7 @@ class Sekrets
214
230
  open(arg, 'rb+')
215
231
  end
216
232
 
217
- close =
233
+ close =
218
234
  proc do
219
235
  io.close if opened
220
236
  end
@@ -254,14 +270,14 @@ class Sekrets
254
270
  unindent(
255
271
  <<-'_v_'
256
272
  #! /usr/bin/env ruby
257
-
273
+
258
274
  require 'pathname'
259
275
  ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
260
276
  Pathname.new(__FILE__).realpath)
261
-
277
+
262
278
  require 'rubygems'
263
279
  require 'bundler/setup'
264
-
280
+
265
281
  dirname = File.dirname(__FILE__)
266
282
 
267
283
  root = File.dirname(dirname)
@@ -340,7 +356,7 @@ BEGIN {
340
356
  require 'tmpdir'
341
357
 
342
358
  class Sekrets < ::String
343
- Version = '1.10.0' unless defined?(Version)
359
+ Version = '1.11.0' unless defined?(Version)
344
360
 
345
361
  class << Sekrets
346
362
  def version
@@ -493,7 +509,7 @@ BEGIN {
493
509
  warn "missing \#{ key }!"
494
510
  end
495
511
  end
496
-
512
+
497
513
  __
498
514
  fd.puts(code)
499
515
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification::new do |spec|
7
7
  spec.name = "sekrets"
8
- spec.version = "1.10.0"
8
+ spec.version = "1.11.0"
9
9
  spec.platform = Gem::Platform::RUBY
10
10
  spec.summary = "securely manage encrypted files and settings"
11
11
  spec.description = "sekrets is a command line tool and library used to securely manage encrypted files and settings in your rails' applications and git repositories."
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sekrets
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0
4
+ version: 1.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ara T. Howard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-05 00:00:00.000000000 Z
11
+ date: 2018-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  version: '0'
122
122
  requirements: []
123
123
  rubyforge_project: codeforpeople
124
- rubygems_version: 2.6.8
124
+ rubygems_version: 2.6.14
125
125
  signing_key:
126
126
  specification_version: 4
127
127
  summary: securely manage encrypted files and settings