Sha256: f3dca97a0c407b2d1d7e6b0ee1af8b8bd0d274920993c4ec78aaa956c9da57e5

Contents?: true

Size: 960 Bytes

Versions: 18

Compression:

Stored size: 960 Bytes

Contents

require 'lino'

module RubyEasyRSA
  module Commands
    class Base
      attr_reader :binary

      def initialize(binary: nil)
        @binary = binary || RubyEasyRSA.configuration.binary
      end

      def stdin
        ''
      end

      def stdout
        STDOUT
      end

      def stderr
        STDERR
      end

      def execute(opts = {})
        builder = instantiate_builder

        do_before(opts)
        builder = configure_command(builder, opts)
        builder
            .build
            .execute(
                stdin: stdin,
                stdout: stdout,
                stderr: stderr)
        do_after(opts)
      end

      def instantiate_builder
        Lino::CommandLineBuilder
            .for_command(binary)
            .with_option_separator('=')
      end

      def do_before(opts)
      end

      def configure_command(builder, opts)
        builder
      end

      def do_after(opts)
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
ruby_easy_rsa-0.10.0.pre.7 lib/ruby_easy_rsa/commands/base.rb
ruby_easy_rsa-0.10.0.pre.6 lib/ruby_easy_rsa/commands/base.rb
ruby_easy_rsa-0.10.0.pre.5 lib/ruby_easy_rsa/commands/base.rb
ruby_easy_rsa-0.10.0.pre.4 lib/ruby_easy_rsa/commands/base.rb
ruby_easy_rsa-0.10.0.pre.3 lib/ruby_easy_rsa/commands/base.rb
ruby_easy_rsa-0.10.0.pre.2 lib/ruby_easy_rsa/commands/base.rb
ruby_easy_rsa-0.10.0.pre.1 lib/ruby_easy_rsa/commands/base.rb
ruby_easy_rsa-0.9.0 lib/ruby_easy_rsa/commands/base.rb
ruby_easy_rsa-0.8.0.pre.1 lib/ruby_easy_rsa/commands/base.rb
ruby_easy_rsa-0.7.0 lib/ruby_easy_rsa/commands/base.rb
ruby_easy_rsa-0.6.0.pre.2 lib/ruby_easy_rsa/commands/base.rb
ruby_easy_rsa-0.6.0.pre.1 lib/ruby_easy_rsa/commands/base.rb
ruby_easy_rsa-0.5.0 lib/ruby_easy_rsa/commands/base.rb
ruby_easy_rsa-0.4.0.pre.1 lib/ruby_easy_rsa/commands/base.rb
ruby_easy_rsa-0.3.0 lib/ruby_easy_rsa/commands/base.rb
ruby_easy_rsa-0.2.0.pre.11 lib/ruby_easy_rsa/commands/base.rb
ruby_easy_rsa-0.2.0.pre.10 lib/ruby_easy_rsa/commands/base.rb
ruby_easy_rsa-0.2.0.pre.9 lib/ruby_easy_rsa/commands/base.rb