Sha256: 92712128d501ebbc61acb755918d074285eeec25bf8b8d60fb3289ccfbeaa0b5

Contents?: true

Size: 909 Bytes

Versions: 27

Compression:

Stored size: 909 Bytes

Contents

require 'lino'

module RubyFly
  module Commands
    class Base
      attr_reader :binary

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

      def stdin
        ''
      end

      def stdout
        STDOUT
      end

      def stderr
        STDERR
      end

      def execute(opts = {})
        builder = instantiate_builder

        do_before(opts)
        configure_command(builder, opts)
            .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)
      end

      def do_after(opts)
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
ruby_fly-0.23.0 lib/ruby_fly/commands/base.rb
ruby_fly-0.22.0.pre.2 lib/ruby_fly/commands/base.rb
ruby_fly-0.22.0.pre.1 lib/ruby_fly/commands/base.rb
ruby_fly-0.21.0 lib/ruby_fly/commands/base.rb
ruby_fly-0.20.0.pre.1 lib/ruby_fly/commands/base.rb
ruby_fly-0.19.0 lib/ruby_fly/commands/base.rb
ruby_fly-0.18.0.pre.1 lib/ruby_fly/commands/base.rb
ruby_fly-0.17.0 lib/ruby_fly/commands/base.rb
ruby_fly-0.16.0.pre.2 lib/ruby_fly/commands/base.rb
ruby_fly-0.16.0.pre.1 lib/ruby_fly/commands/base.rb
ruby_fly-0.15.0 lib/ruby_fly/commands/base.rb
ruby_fly-0.14.0.pre.1 lib/ruby_fly/commands/base.rb
ruby_fly-0.13.0 lib/ruby_fly/commands/base.rb
ruby_fly-0.12.0.pre.1 lib/ruby_fly/commands/base.rb
ruby_fly-0.11.0 lib/ruby_fly/commands/base.rb
ruby_fly-0.10.0.pre.1 lib/ruby_fly/commands/base.rb
ruby_fly-0.9.0 lib/ruby_fly/commands/base.rb
ruby_fly-0.8.0.pre.pre.2 lib/ruby_fly/commands/base.rb
ruby_fly-0.8.0.pre.pre.1 lib/ruby_fly/commands/base.rb
ruby_fly-0.7.0 lib/ruby_fly/commands/base.rb