Sha256: 514e8f5038b32a4a9d7b66f60e0739c638550e1ab946995c4974b2edde12ee6c

Contents?: true

Size: 897 Bytes

Versions: 32

Compression:

Stored size: 897 Bytes

Contents

require 'lino'

module RubyLeiningen
  module Commands
    class Base
      attr_reader :binary

      def initialize(binary: nil)
        @binary = binary || RubyLeiningen.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)
      end

      def do_before(opts)
      end

      def configure_command(builder, opts)
        builder
      end

      def do_after(opts)
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
ruby_leiningen-0.24.0.pre.6 lib/ruby_leiningen/commands/base.rb
ruby_leiningen-0.24.0.pre.5 lib/ruby_leiningen/commands/base.rb
ruby_leiningen-0.24.0.pre.4 lib/ruby_leiningen/commands/base.rb
ruby_leiningen-0.24.0.pre.3 lib/ruby_leiningen/commands/base.rb
ruby_leiningen-0.24.0.pre.2 lib/ruby_leiningen/commands/base.rb
ruby_leiningen-0.24.0.pre.1 lib/ruby_leiningen/commands/base.rb
ruby_leiningen-0.23.0 lib/ruby_leiningen/commands/base.rb
ruby_leiningen-0.22.0.pre.1 lib/ruby_leiningen/commands/base.rb
ruby_leiningen-0.21.0 lib/ruby_leiningen/commands/base.rb
ruby_leiningen-0.20.0.pre.1 lib/ruby_leiningen/commands/base.rb
ruby_leiningen-0.19.0 lib/ruby_leiningen/commands/base.rb
ruby_leiningen-0.18.0.pre.1 lib/ruby_leiningen/commands/base.rb
ruby_leiningen-0.17.0 lib/ruby_leiningen/commands/base.rb
ruby_leiningen-0.16.0.pre.1 lib/ruby_leiningen/commands/base.rb
ruby_leiningen-0.15.0 lib/ruby_leiningen/commands/base.rb
ruby_leiningen-0.14.0.pre.1 lib/ruby_leiningen/commands/base.rb
ruby_leiningen-0.13.0 lib/ruby_leiningen/commands/base.rb
ruby_leiningen-0.12.0.pre.2 lib/ruby_leiningen/commands/base.rb
ruby_leiningen-0.12.0.pre.1 lib/ruby_leiningen/commands/base.rb
ruby_leiningen-0.11.0 lib/ruby_leiningen/commands/base.rb