ruby_gpg2 0.1.0.pre.3 → 0.1.0.pre.4

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
  SHA256:
3
- metadata.gz: 9d840f9c3019500c8efe2d72f3a92076657d3084739380d8218ccc1eeadf24fe
4
- data.tar.gz: 5c791b3c7ecb325cd46ccc64b3c6cb0eee59597602ca00af0f7e3bdbb3ef929b
3
+ metadata.gz: 9983337ad6842d933f046ade16db182df89cc4fa92275aa287db62fdca3fa0de
4
+ data.tar.gz: a6853e170aa664350f00183a92b417083c7a5d94106f3aed81503d0055d571ae
5
5
  SHA512:
6
- metadata.gz: cec3bc2eaaf7d77fbda1f15d0b2b9e17c3c6d96d7088349d4e3975219db3068ee41160d57e523ad65f4038ffd910c5f98258247bf5291783254f97d12367dc03
7
- data.tar.gz: ee8b8a8b70d2899a94a53c6222fb808ce23a2f09137ee6ab8a6717f0495c823e254c2fdc473d9d783778b875cba00d2a7d05a3432e8f5b783aa154645f1117fc
6
+ metadata.gz: 23bca3f4f330f9e29c0ecff4df0bb3de24f3a06e9e1b139eec394395012cafa10118752229f9449cd13e827df48a8980d805e4350e6877ab46f1bb13714994e6
7
+ data.tar.gz: 00ebe337f7b596c5ae3111bc883f9ab5efb6c7cfac729cfad43bd757c01cdfccb0b241c9b5f5d54f91b93763edcf31857de2213681b34d02717a446370282941
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby_gpg2 (0.1.0.pre.3)
4
+ ruby_gpg2 (0.1.0.pre.4)
5
5
  lino (= 1.3.0)
6
6
 
7
7
  GEM
@@ -6,7 +6,7 @@ module RubyGPG2
6
6
  new(records
7
7
  .strip
8
8
  .split("\n")
9
- .collect { |record| KeyListRecord.parse(record) })
9
+ .collect { |record| ColonRecord.parse(record) })
10
10
  end
11
11
 
12
12
  include Enumerable
@@ -18,5 +18,15 @@ module RubyGPG2
18
18
  def each(&block)
19
19
  @records.each(&block)
20
20
  end
21
+
22
+ def ==(other)
23
+ other.class == self.class && other.state == state
24
+ end
25
+
26
+ protected
27
+
28
+ def state
29
+ [@records]
30
+ end
21
31
  end
22
32
  end
@@ -1,3 +1,5 @@
1
+ require 'date'
2
+
1
3
  module RubyGPG2
2
4
  class ColonRecord
3
5
  TYPES = {
@@ -65,14 +67,18 @@ module RubyGPG2
65
67
  'e' => :encrypt,
66
68
  's' => :sign,
67
69
  'c' => :certify,
70
+ 'a' => :authenticate,
68
71
  'E' => :primary_encrypt,
69
72
  'S' => :primary_sign,
70
- 'C' => :primary_certify
73
+ 'C' => :primary_certify,
74
+ 'A' => :primary_authenticate,
75
+ '?' => :unknown
71
76
  }
72
77
 
73
78
  COMPLIANCE_MODES = {
74
79
  '8' => :rfc_4880bis,
75
- '23' => :de_vs
80
+ '23' => :de_vs,
81
+ '6001' => :roca_screening_hit
76
82
  }
77
83
 
78
84
  def self.parse(record)
@@ -3,22 +3,11 @@ require 'lino'
3
3
  module RubyGPG2
4
4
  module Commands
5
5
  class Base
6
- attr_reader :binary
7
-
8
- def initialize(binary: nil)
6
+ def initialize(binary: nil, stdin: nil, stdout: nil, stderr: nil)
9
7
  @binary = binary || RubyGPG2.configuration.binary
10
- end
11
-
12
- def stdin
13
- ''
14
- end
15
-
16
- def stdout
17
- STDOUT
18
- end
19
-
20
- def stderr
21
- STDERR
8
+ @stdin = stdin || RubyGPG2.configuration.stdin
9
+ @stdout = stdout || RubyGPG2.configuration.stdout
10
+ @stderr = stderr || RubyGPG2.configuration.stderr
22
11
  end
23
12
 
24
13
  def execute(opts = {})
@@ -35,6 +24,10 @@ module RubyGPG2
35
24
  do_after(opts)
36
25
  end
37
26
 
27
+ protected
28
+
29
+ attr_reader :binary, :stdin, :stdout, :stderr
30
+
38
31
  def instantiate_builder
39
32
  Lino::CommandLineBuilder
40
33
  .for_command(binary)
@@ -2,11 +2,13 @@ require 'lino'
2
2
 
3
3
  require_relative 'base'
4
4
  require_relative 'mixins/global_config'
5
+ require_relative 'mixins/batch_config'
5
6
 
6
7
  module RubyGPG2
7
8
  module Commands
8
9
  class GenerateKey < Base
9
10
  include Mixins::GlobalConfig
11
+ include Mixins::BatchConfig
10
12
 
11
13
  def configure_command(builder, opts)
12
14
  parameter_file_path = opts[:parameter_file_path]
@@ -0,0 +1,22 @@
1
+ require 'lino'
2
+
3
+ require_relative 'base'
4
+ require_relative 'mixins/global_config'
5
+ require_relative 'mixins/colon_config'
6
+ require_relative 'mixins/with_captured_output'
7
+
8
+ module RubyGPG2
9
+ module Commands
10
+ class ListPublicKeys < Base
11
+ include Mixins::GlobalConfig
12
+ include Mixins::ColonConfig
13
+ include Mixins::WithCapturedOutput
14
+
15
+ def configure_command(builder, opts)
16
+ builder = builder.with_subcommand('--list-public-keys')
17
+ builder = super(builder, opts)
18
+ builder
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,15 @@
1
+ module RubyGPG2
2
+ module Commands
3
+ module Mixins
4
+ module BatchConfig
5
+ def configure_command(builder, opts)
6
+ batch = opts[:batch].nil? ? true : opts[:batch]
7
+
8
+ builder = super(builder, opts)
9
+ builder = builder.with_flag('--batch') if batch
10
+ builder
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module RubyGPG2
2
+ module Commands
3
+ module Mixins
4
+ module ColonConfig
5
+ def configure_command(builder, opts)
6
+ with_colons = opts[:with_colons].nil? ? true : opts[:with_colons]
7
+
8
+ builder = super(builder, opts)
9
+ builder = builder.with_flag('--with-colons') if with_colons
10
+ builder
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -3,11 +3,9 @@ module RubyGPG2
3
3
  module Mixins
4
4
  module GlobalConfig
5
5
  def configure_command(builder, opts)
6
- batch = opts[:batch].nil? ? true : opts[:batch]
7
6
  home_directory = opts[:home_directory]
8
7
 
9
8
  builder = super(builder, opts)
10
- builder = builder.with_flag('--batch') if batch
11
9
  builder = builder.with_option(
12
10
  '--homedir', home_directory, quoting: '"') if home_directory
13
11
  builder
@@ -0,0 +1,22 @@
1
+ require 'stringio'
2
+
3
+ module RubyGPG2
4
+ module Commands
5
+ module Mixins
6
+ module WithCapturedOutput
7
+ def initialize(*args)
8
+ super(*args)
9
+ @stdout = StringIO.new unless
10
+ (defined?(@stdout) && @stdout.respond_to?(:string))
11
+ end
12
+
13
+ def do_after(opts)
14
+ parse_output = opts[:parse_output].nil? ? true : opts[:parse_output]
15
+ parse_output ?
16
+ ColonOutput.parse(stdout.string) :
17
+ stdout.string
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,4 +1,5 @@
1
1
  require_relative 'commands/generate_key'
2
+ require_relative 'commands/list_public_keys'
2
3
 
3
4
  module RubyGPG2
4
5
  module Commands
@@ -1,3 +1,3 @@
1
1
  module RubyGPG2
2
- VERSION = '0.1.0.pre.3'
2
+ VERSION = '0.1.0.pre.4'
3
3
  end
data/lib/ruby_gpg2.rb CHANGED
@@ -21,10 +21,13 @@ module RubyGPG2
21
21
  end
22
22
 
23
23
  class Configuration
24
- attr_accessor :binary
24
+ attr_accessor :binary, :logger, :stdin, :stdout, :stderr
25
25
 
26
26
  def initialize
27
27
  @binary = 'gpg'
28
+ @stdin = ''
29
+ @stdout = $stdout
30
+ @stderr = $stderr
28
31
  end
29
32
  end
30
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_gpg2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre.3
4
+ version: 0.1.0.pre.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toby Clemson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-29 00:00:00.000000000 Z
11
+ date: 2020-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lino
@@ -164,7 +164,11 @@ files:
164
164
  - lib/ruby_gpg2/commands.rb
165
165
  - lib/ruby_gpg2/commands/base.rb
166
166
  - lib/ruby_gpg2/commands/generate_key.rb
167
+ - lib/ruby_gpg2/commands/list_public_keys.rb
168
+ - lib/ruby_gpg2/commands/mixins/batch_config.rb
169
+ - lib/ruby_gpg2/commands/mixins/colon_config.rb
167
170
  - lib/ruby_gpg2/commands/mixins/global_config.rb
171
+ - lib/ruby_gpg2/commands/mixins/with_captured_output.rb
168
172
  - lib/ruby_gpg2/parameter_file.rb
169
173
  - lib/ruby_gpg2/version.rb
170
174
  - ruby_gpg2.gemspec