Class: Itamae::Runner
- Inherits:
-
Object
- Object
- Itamae::Runner
- Defined in:
- lib/itamae/runner.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
Returns the value of attribute children.
-
#node ⇒ Object
Returns the value of attribute node.
-
#tmpdir ⇒ Object
Returns the value of attribute tmpdir.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(node) ⇒ Runner
constructor
A new instance of Runner.
- #load_recipes(paths) ⇒ Object
- #run(options) ⇒ Object
Constructor Details
#initialize(node) ⇒ Runner
Returns a new instance of Runner.
93 94 95 96 97 98 99 100 |
# File 'lib/itamae/runner.rb', line 93 def initialize(node) @node = node @tmpdir = "/tmp/itamae_tmp" @children = RecipeChildren.new Backend.instance.run_command(["mkdir", "-p", @tmpdir]) Backend.instance.run_command(["chmod", "777", @tmpdir]) end |
Instance Attribute Details
#children ⇒ Object
Returns the value of attribute children.
91 92 93 |
# File 'lib/itamae/runner.rb', line 91 def children @children end |
#node ⇒ Object
Returns the value of attribute node.
89 90 91 |
# File 'lib/itamae/runner.rb', line 89 def node @node end |
#tmpdir ⇒ Object
Returns the value of attribute tmpdir.
90 91 92 |
# File 'lib/itamae/runner.rb', line 90 def tmpdir @tmpdir end |
Class Method Details
.run(recipe_files, backend_type, options) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/itamae/runner.rb', line 8 def run(recipe_files, backend_type, ) Logger.info "Starting Itamae..." (backend_type, ) runner = self.new(()) runner.load_recipes(recipe_files) if dot_file = [:dot] Logger.info "Writing dependency graph in DOT to #{dot_file}..." open(dot_file, 'w') do |f| f.write(runner.children.deps_in_dot) end return end runner.run(dry_run: [:dry_run]) end |
Instance Method Details
#load_recipes(paths) ⇒ Object
102 103 104 105 106 107 108 |
# File 'lib/itamae/runner.rb', line 102 def load_recipes(paths) paths.each do |path| recipe = Recipe.new(self, File.(path)) children << recipe recipe.load end end |
#run(options) ⇒ Object
110 111 112 |
# File 'lib/itamae/runner.rb', line 110 def run() children.run() end |