dotgpg 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/dotgpg.gemspec +1 -1
- data/lib/dotgpg/cli.rb +14 -0
- data/spec/cli_spec.rb +23 -0
- data/spec/fixture/basic/c +1 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae23bf1b3a076ba28a7363225e5a451faa45a2f2
|
4
|
+
data.tar.gz: e5d4036715b1a7c2fad0c45463ffd86d2a1121cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf0f2fc6f55b50ac107212f027058cfd28fd2a71a78c6b46056fe6d583f9b6b126241ad18d4dff4c48ee7570b3259086f1d049d889723b972d72391414775c9a
|
7
|
+
data.tar.gz: b8b08d85ac6508821150af62587d68200468165c8e46c98b94f24ae5dfc49ad33d3da311335133f5bbce2d21b389517be08069da21e54b771ebf84e01f7a78e9
|
data/README.md
CHANGED
@@ -38,6 +38,15 @@ $ dotgpg edit production.gpg
|
|
38
38
|
[ opens your $EDITOR ]
|
39
39
|
```
|
40
40
|
|
41
|
+
#### dotgpg create
|
42
|
+
|
43
|
+
To create an encrypted file from piped input, use `dotgpg create`. I recommend you use the `.gpg` suffix so that other tools know what these files contain.
|
44
|
+
|
45
|
+
```
|
46
|
+
$ echo foo | dotgpg create bar.gpg
|
47
|
+
|
48
|
+
```
|
49
|
+
|
41
50
|
#### dotgpg cat
|
42
51
|
|
43
52
|
To read encrypted files, `dotgpg cat` them.
|
data/dotgpg.gemspec
CHANGED
data/lib/dotgpg/cli.rb
CHANGED
@@ -108,6 +108,20 @@ class Dotgpg
|
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
|
+
desc "create FILE", "create an encrypted file with contents that have been piped in"
|
112
|
+
def create(file)
|
113
|
+
return if helped?
|
114
|
+
files = [file]
|
115
|
+
dir = Dotgpg::Dir.closest(*files)
|
116
|
+
fail "not in a dotgpg directory" unless dir
|
117
|
+
|
118
|
+
fail "No input received" if STDIN.tty?
|
119
|
+
dir.encrypt file, STDIN.read
|
120
|
+
|
121
|
+
rescue GPGME::Error::BadPassphrase => e
|
122
|
+
fail e.message
|
123
|
+
end
|
124
|
+
|
111
125
|
desc "edit FILES...", "edit and re-encrypt files"
|
112
126
|
def edit(*files)
|
113
127
|
return if helped?
|
data/spec/cli_spec.rb
CHANGED
@@ -210,6 +210,29 @@ describe Dotgpg::Cli do
|
|
210
210
|
end
|
211
211
|
end
|
212
212
|
|
213
|
+
describe "create" do
|
214
|
+
before do
|
215
|
+
Dotgpg.passphrase = 'test'
|
216
|
+
@path = $fixture + rand.to_s.gsub(".", "")
|
217
|
+
Dotgpg::Cli.new.invoke(:init, [@path.to_s])
|
218
|
+
Dotgpg::Dir.new(@path).encrypt @path + "a", "Bad test\n"
|
219
|
+
allow(STDIN).to receive(:read).and_return('Some test data here')
|
220
|
+
allow(STDIN).to receive(:tty?).and_return(false)
|
221
|
+
end
|
222
|
+
|
223
|
+
it "creates a new encrypted file from command line input" do
|
224
|
+
path = (@path + "a").to_s
|
225
|
+
@dotgpg.send(:create, path)
|
226
|
+
expect {Dotgpg::Dir.new(@path).decrypt(path, $stdout)}.to output('Some test data here').to_stdout
|
227
|
+
end
|
228
|
+
|
229
|
+
it "should fail if no input given" do
|
230
|
+
path = (@path + "b").to_s
|
231
|
+
allow(STDIN).to receive(:tty?).and_return(true)
|
232
|
+
expect { @dotgpg.send(:create, path) }.to raise_error("No input received")
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
213
236
|
describe "edit" do
|
214
237
|
before do
|
215
238
|
Dotgpg.passphrase = 'test'
|
@@ -0,0 +1 @@
|
|
1
|
+
spec/fixture/basic/../
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dotgpg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Conrad Irwin
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain:
|
11
11
|
- certs/gem-public_cert.pem
|
12
|
-
date:
|
12
|
+
date: 2016-11-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -102,6 +102,7 @@ files:
|
|
102
102
|
- spec/fixture/basic/README.md
|
103
103
|
- spec/fixture/basic/a
|
104
104
|
- spec/fixture/basic/b/c
|
105
|
+
- spec/fixture/basic/c
|
105
106
|
- spec/fixture/gnupghome/pubring.gpg
|
106
107
|
- spec/fixture/gnupghome/pubring.gpg~
|
107
108
|
- spec/fixture/gnupghome/random_seed
|
@@ -130,8 +131,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
131
|
version: '0'
|
131
132
|
requirements: []
|
132
133
|
rubyforge_project:
|
133
|
-
rubygems_version: 2.
|
134
|
+
rubygems_version: 2.6.8
|
134
135
|
signing_key:
|
135
136
|
specification_version: 4
|
136
137
|
summary: gpg-encrypted backup for your dotenv files
|
137
138
|
test_files: []
|
139
|
+
has_rdoc:
|