#-- # Author:: Daniel DeLeo ( "-E CODE", :long => "--exec CODE", :description => "a string of Chef code to execute" deps do require 'chef/shef/ext' end def run scripts = Array(name_args) context = Object.new Shef::Extensions.extend_context_object(context) if config[:exec] context.instance_eval(config[:exec], "-E Argument", 0) elsif !scripts.empty? scripts.each do |script| file = File.expand_path(script) context.instance_eval(IO.read(file), file, 0) end else script = STDIN.read context.instance_eval(script, "STDIN", 0) end end end