Sha256: b60c5ee05aadb15f1ee7e8f5358ae50211d25239b896e612795da6ce2dbfa864
Contents?: true
Size: 1.19 KB
Versions: 3
Compression:
Stored size: 1.19 KB
Contents
require 'itamae' module Itamae class Recipe attr_reader :path attr_reader :runner attr_reader :dependencies attr_reader :delayed_actions def initialize(runner, path) @runner = runner @path = path @dependencies = RecipeDependencies.new @delayed_actions = [] load_dependencies end def node @runner.node end def run(options = {}) @dependencies.each do |resource| case resource when Resource::Base resource.run(nil, dry_run: options[:dry_run]) when Recipe resource.run(options) end end @delayed_actions.uniq.each do |action, resource| resource.run(action, dry_run: options[:dry_run]) end end private def load_dependencies instance_eval(File.read(@path), @path, 1) end def method_missing(method, name, &block) klass = Resource.get_resource_class(method) resource = klass.new(self, name, &block) @dependencies << resource end def include_recipe(target) target = ::File.expand_path(target, File.dirname(@path)) recipe = Recipe.new(@runner, target) @dependencies << recipe end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
itamae-1.0.0.beta13 | lib/itamae/recipe.rb |
itamae-1.0.0.beta12 | lib/itamae/recipe.rb |
itamae-1.0.0.beta11 | lib/itamae/recipe.rb |