Sha256: 23b8efa8ca0dc2fbbee555a0ba1f15e268b7a29f88e0c477304239d8f6e31365
Contents?: true
Size: 956 Bytes
Versions: 7
Compression:
Stored size: 956 Bytes
Contents
require 'itamae' module Itamae class Recipe attr_reader :path attr_reader :runner attr_reader :resources attr_reader :delayed_actions def initialize(runner, path) @runner = runner @path = path @resources = ResourceCollection.new @delayed_actions = [] load_resources end def node @runner.node end def run(options = {}) @resources.each do |resource| # do action specified in the recipe resource.run(nil, dry_run: options[:dry_run]) end @delayed_actions.uniq.each do |action, resource| resource.run(action, dry_run: options[:dry_run]) end end private def load_resources 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) @resources << resource end end end
Version data entries
7 entries across 7 versions & 1 rubygems