Sha256: 098cff0e4a834b75a30e89cb51e55144adda970cd6bcedad24c65008301ef46a
Contents?: true
Size: 1.1 KB
Versions: 10
Compression:
Stored size: 1.1 KB
Contents
require 'lino' module RubyFly module Commands class Base attr_reader :binary, :stdin, :stdout, :stderr def initialize(binary: nil) @binary = binary || RubyFly.configuration.binary @stdin = stdin || RubyFly.configuration.stdin @stdout = stdout || RubyFly.configuration.stdout @stderr = stderr || RubyFly.configuration.stderr end def execute(opts = {}) builder = instantiate_builder do_before(opts) do_around(opts) do |new_opts| configure_command(builder, new_opts) .build .execute( stdin: stdin, stdout: stdout, stderr: stderr) end do_after(opts) end def instantiate_builder Lino::CommandLineBuilder .for_command(binary) .with_option_separator('=') end def do_before(opts) end def do_around(opts, &block) block.call(opts) end def configure_command(builder, opts) builder end def do_after(opts) end end end end
Version data entries
10 entries across 10 versions & 1 rubygems