Sha256: 40ece22441b60063a6c9275943ac54fd9288393cb3cad8577bdcfa96561052b3

Contents?: true

Size: 1.44 KB

Versions: 1

Compression:

Stored size: 1.44 KB

Contents

require 'ruby_gpg2/version'
require 'ruby_gpg2/commands'
require 'ruby_gpg2/parameter_file_contents'
require 'ruby_gpg2/colon_output'
require 'ruby_gpg2/status_output'
require 'ruby_gpg2/key'
require 'ruby_gpg2/user_id'

module RubyGPG2
  class << self
    attr_writer :configuration

    def configuration
      @configuration ||= Configuration.new
    end

    def configure
      yield(configuration)
    end

    def reset!
      @configuration = nil
    end
  end

  module ClassMethods
    def decrypt(opts = {})
      Commands::Decrypt.new.execute(opts)
    end

    def encrypt(opts = {})
      Commands::Encrypt.new.execute(opts)
    end

    def export(opts = {})
      Commands::Export.new.execute(opts)
    end

    def export_secret_keys(opts = {})
      Commands::ExportSecretKeys.new.execute(opts)
    end

    def generate_key(opts = {})
      Commands::GenerateKey.new.execute(opts)
    end

    def import(opts = {})
      Commands::Import.new.execute(opts)
    end

    def list_public_keys(opts = {})
      Commands::ListPublicKeys.new.execute(opts)
    end

    def list_secret_keys(opts = {})
      Commands::ListSecretKeys.new.execute(opts)
    end
  end

  extend ClassMethods

  def self.included(other)
    other.extend(ClassMethods)
  end

  class Configuration
    attr_accessor :binary, :logger, :stdin, :stdout, :stderr

    def initialize
      @binary = 'gpg'
      @stdin = ''
      @stdout = $stdout
      @stderr = $stderr
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby_gpg2-0.1.0.pre.24 lib/ruby_gpg2.rb