Class: DDSL::Command::Base
- Inherits:
-
Object
- Object
- DDSL::Command::Base
- Includes:
- DSL
- Defined in:
- lib/ddsl/command/base.rb
Direct Known Subclasses
Docker::Build, Docker::Login, Docker::Pull, Docker::Push, Docker::Run, DockerCompose::Build, DockerCompose::Run
Instance Attribute Summary collapse
-
#shell ⇒ Object
readonly
Returns the value of attribute shell.
Instance Method Summary collapse
- #exec_after_block(spec) ⇒ Object
- #exec_before_block(spec) ⇒ Object
-
#initialize(shell = DDSL::Shell.new) ⇒ Base
constructor
A new instance of Base.
- #run(spec) ⇒ Object
Methods included from DSL
Constructor Details
Instance Attribute Details
#shell ⇒ Object (readonly)
Returns the value of attribute shell.
10 11 12 |
# File 'lib/ddsl/command/base.rb', line 10 def shell @shell end |
Instance Method Details
#exec_after_block(spec) ⇒ Object
36 37 38 |
# File 'lib/ddsl/command/base.rb', line 36 def exec_after_block(spec) instance_exec(spec, &after_block) unless after_block.nil? end |
#exec_before_block(spec) ⇒ Object
32 33 34 |
# File 'lib/ddsl/command/base.rb', line 32 def exec_before_block(spec) instance_exec(spec, &before_block) unless before_block.nil? end |
#run(spec) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/ddsl/command/base.rb', line 16 def run(spec) exec_before_block(spec) argv = [ executable, .call(spec), command, .call(spec), arguments.call(spec).values ].flatten @shell.call!(argv) exec_after_block(spec) end |