Class: Construi::Target
- Inherits:
-
Object
- Object
- Construi::Target
- Defined in:
- lib/construi/target.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #commands ⇒ Object
- #initial_image ⇒ Object
-
#initialize(name, config) ⇒ Target
constructor
A new instance of Target.
- #run ⇒ Object
Constructor Details
#initialize(name, config) ⇒ Target
Returns a new instance of Target.
8 9 10 11 |
# File 'lib/construi/target.rb', line 8 def initialize(name, config) @name = name @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
6 7 8 |
# File 'lib/construi/target.rb', line 6 def config @config end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/construi/target.rb', line 6 def name @name end |
Instance Method Details
#commands ⇒ Object
13 14 15 |
# File 'lib/construi/target.rb', line 13 def commands @config.commands end |
#initial_image ⇒ Object
29 30 31 |
# File 'lib/construi/target.rb', line 29 def initial_image return Image.from(@config) end |
#run ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/construi/target.rb', line 17 def run puts "Running #{name}...".green final_image = IntermediateImage.seed(initial_image).reduce(commands) do |image, command| puts puts " > #{command}".green image.run(command, @config.env) end final_image.delete end |