dotgpg 0.6.1 → 0.7.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2b9ba3d4ad515844c56c7551eb3aa1ed26dc1dbf
4
- data.tar.gz: 1780ac2133da851a289e4cfbed5ec2a249a7dae2
3
+ metadata.gz: ae23bf1b3a076ba28a7363225e5a451faa45a2f2
4
+ data.tar.gz: e5d4036715b1a7c2fad0c45463ffd86d2a1121cc
5
5
  SHA512:
6
- metadata.gz: 18d55e036791848055c9541506172dc13ffc648c13d7271af5e167d899514440a337d371c82d19687b6769aac0be209b18a02e27d250ac1beaa6fe53b808f9e2
7
- data.tar.gz: 09ac5cad94532de3c7e3c83adb049883a9bd2d898f9809d7e6dd407687770ae49bd0db77d5c550b7cbfc4f839edadf791bf43ac20f9db9f9585a666150ce9c89
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.
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'dotgpg'
3
- gem.version = '0.6.1'
3
+ gem.version = '0.7.0'
4
4
 
5
5
  gem.summary = 'gpg-encrypted backup for your dotenv files'
6
6
  gem.description = "Easy management of gpg-encrypted backup files"
@@ -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?
@@ -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.6.1
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: 2015-07-24 00:00:00.000000000 Z
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.4.5
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: