Class: RubyFly::Commands::Base
- Inherits:
-
Object
- Object
- RubyFly::Commands::Base
- Defined in:
- lib/ruby_fly/commands/base.rb
Direct Known Subclasses
DestroyPipeline, GetPipeline, Login, SetPipeline, Status, UnpausePipeline, Version
Instance Attribute Summary collapse
-
#binary ⇒ Object
readonly
Returns the value of attribute binary.
-
#stderr ⇒ Object
readonly
Returns the value of attribute stderr.
-
#stdin ⇒ Object
readonly
Returns the value of attribute stdin.
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
Instance Method Summary collapse
- #configure_command(builder, opts) ⇒ Object
- #do_after(opts) ⇒ Object
- #do_around(opts, &block) ⇒ Object
- #do_before(opts) ⇒ Object
- #execute(opts = {}) ⇒ Object
-
#initialize(opts = {}) ⇒ Base
constructor
A new instance of Base.
- #instantiate_builder ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Base
Returns a new instance of Base.
8 9 10 11 12 13 |
# File 'lib/ruby_fly/commands/base.rb', line 8 def initialize(opts = {}) @binary = opts[:binary] || RubyFly.configuration.binary @stdin = stdin || RubyFly.configuration.stdin @stdout = stdout || RubyFly.configuration.stdout @stderr = stderr || RubyFly.configuration.stderr end |
Instance Attribute Details
#binary ⇒ Object (readonly)
Returns the value of attribute binary.
6 7 8 |
# File 'lib/ruby_fly/commands/base.rb', line 6 def binary @binary end |
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
6 7 8 |
# File 'lib/ruby_fly/commands/base.rb', line 6 def stderr @stderr end |
#stdin ⇒ Object (readonly)
Returns the value of attribute stdin.
6 7 8 |
# File 'lib/ruby_fly/commands/base.rb', line 6 def stdin @stdin end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
6 7 8 |
# File 'lib/ruby_fly/commands/base.rb', line 6 def stdout @stdout end |
Instance Method Details
#configure_command(builder, opts) ⇒ Object
43 44 45 |
# File 'lib/ruby_fly/commands/base.rb', line 43 def configure_command(builder, opts) builder end |
#do_after(opts) ⇒ Object
47 48 |
# File 'lib/ruby_fly/commands/base.rb', line 47 def do_after(opts) end |
#do_around(opts, &block) ⇒ Object
39 40 41 |
# File 'lib/ruby_fly/commands/base.rb', line 39 def do_around(opts, &block) block.call(opts) end |
#do_before(opts) ⇒ Object
36 37 |
# File 'lib/ruby_fly/commands/base.rb', line 36 def do_before(opts) end |
#execute(opts = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ruby_fly/commands/base.rb', line 15 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 |
#instantiate_builder ⇒ Object
30 31 32 33 34 |
# File 'lib/ruby_fly/commands/base.rb', line 30 def instantiate_builder Lino::CommandLineBuilder .for_command(binary) .with_option_separator('=') end |