ftpmvc-gpg 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ftpmvc-gpg.gemspec +1 -1
- data/lib/ftpmvc/filter/gpg.rb +3 -7
- data/lib/ftpmvc/gpg.rb +1 -0
- data/lib/ftpmvc/gpg/input.rb +20 -0
- data/lib/ftpmvc/gpg/version.rb +1 -1
- data/spec/integration/ftpmvc/filter/gpg_spec.rb +2 -2
- data/spec/lib/ftpmvc/filter/gpg_spec.rb +10 -10
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46d0c3cb7a9f589b541eeeed74100c71ed3b5fac
|
4
|
+
data.tar.gz: ab39079c0dd1e4cf3422095ea1f7d9f11a44bfb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b9cf85cc40517a6793c10bc45fed0dccde27a5d95caa4f9658e3ca18bad8fc86a530385ed643007848c15630ee037a033b3ab6f5234840bcf1aa9493c9ac620
|
7
|
+
data.tar.gz: 5c51f19670e91ecb200157c5e2d8afbd9e6669241d0fd1fbecdc25112f719cbb837d45f8df5edd04be40062f975b6b74e73f88518576013f406c72e27ddbca41
|
data/ftpmvc-gpg.gemspec
CHANGED
@@ -21,6 +21,6 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.6"
|
22
22
|
spec.add_development_dependency "rake"
|
23
23
|
spec.add_development_dependency "guard-rspec"
|
24
|
-
spec.add_dependency "ftpmvc", '>= 0.
|
24
|
+
spec.add_dependency "ftpmvc", '>= 0.9.0'
|
25
25
|
spec.add_dependency "gpgme"
|
26
26
|
end
|
data/lib/ftpmvc/filter/gpg.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'ftpmvc/filter/base'
|
2
|
+
require 'ftpmvc/gpg/input'
|
2
3
|
require 'gpgme'
|
3
|
-
require 'ftpd/stream'
|
4
4
|
|
5
5
|
module FTPMVC
|
6
6
|
module Filter
|
@@ -32,12 +32,8 @@ module FTPMVC
|
|
32
32
|
@chain.directory?(remove_extension(path))
|
33
33
|
end
|
34
34
|
|
35
|
-
def put(path,
|
36
|
-
|
37
|
-
while bytes = stream.read
|
38
|
-
buffer << bytes
|
39
|
-
end
|
40
|
-
@chain.put(remove_extension(path), ::Ftpd::Stream.new(@crypto.decrypt(buffer), 'B'))
|
35
|
+
def put(path, input)
|
36
|
+
@chain.put(remove_extension(path), FTPMVC::GPG::Input.new(@crypto.decrypt(input.read_all)))
|
41
37
|
end
|
42
38
|
|
43
39
|
protected
|
data/lib/ftpmvc/gpg.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'ftpmvc/input'
|
2
|
+
|
3
|
+
module FTPMVC
|
4
|
+
module GPG
|
5
|
+
class Input
|
6
|
+
|
7
|
+
include FTPMVC::Input
|
8
|
+
|
9
|
+
def initialize(data)
|
10
|
+
@data = data
|
11
|
+
end
|
12
|
+
|
13
|
+
def read
|
14
|
+
while chunk = @data.read(GPGME::Data::BLOCK_SIZE)
|
15
|
+
yield chunk
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/ftpmvc/gpg/version.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
require 'ftpmvc/filter/gpg'
|
2
|
+
require 'ftpmvc/string_input'
|
2
3
|
require 'ftpmvc/file'
|
3
4
|
require 'ftpmvc/directory'
|
4
|
-
require 'ftpd/stream'
|
5
5
|
|
6
6
|
describe FTPMVC::Filter::Gpg do
|
7
7
|
let(:other_filter_class) do
|
8
8
|
Class.new(FTPMVC::Filter::Base) do
|
9
|
-
attr_reader :
|
10
|
-
def put(path,
|
11
|
-
@
|
9
|
+
attr_reader :input
|
10
|
+
def put(path, input)
|
11
|
+
@input = input
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -100,7 +100,7 @@ describe FTPMVC::Filter::Gpg do
|
|
100
100
|
end
|
101
101
|
|
102
102
|
describe '#put' do
|
103
|
-
let(:
|
103
|
+
let(:input) { FTPMVC::StringInput.new('encrypted content') }
|
104
104
|
before do
|
105
105
|
allow_any_instance_of(GPGME::Crypto)
|
106
106
|
.to receive(:decrypt)
|
@@ -110,12 +110,12 @@ describe FTPMVC::Filter::Gpg do
|
|
110
110
|
it 'removes .pgp extension from filename' do
|
111
111
|
expect(other_filter)
|
112
112
|
.to receive(:put)
|
113
|
-
.with('/secret/passwords.txt', kind_of(
|
114
|
-
gpg_filter.put('/secret/passwords.txt.pgp',
|
113
|
+
.with('/secret/passwords.txt', kind_of(FTPMVC::Input))
|
114
|
+
gpg_filter.put('/secret/passwords.txt.pgp', input)
|
115
115
|
end
|
116
|
-
it 'decrypts the
|
117
|
-
gpg_filter.put('/secret/passwords.txt.pgp',
|
118
|
-
expect(other_filter.
|
116
|
+
it 'decrypts the input' do
|
117
|
+
gpg_filter.put('/secret/passwords.txt.pgp', input)
|
118
|
+
expect(other_filter.input.read_all).to eq 'decrypted content'
|
119
119
|
end
|
120
120
|
end
|
121
121
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ftpmvc-gpg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- André Aizim Kelmanson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02
|
11
|
+
date: 2015-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.9.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 0.9.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: gpgme
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- ftpmvc-gpg.gemspec
|
99
99
|
- lib/ftpmvc/filter/gpg.rb
|
100
100
|
- lib/ftpmvc/gpg.rb
|
101
|
+
- lib/ftpmvc/gpg/input.rb
|
101
102
|
- lib/ftpmvc/gpg/version.rb
|
102
103
|
- spec/fixtures/data.gpg
|
103
104
|
- spec/integration/ftpmvc/filter/gpg_spec.rb
|