diff options
author | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-02-08 08:50:52 -0800 |
---|---|---|
committer | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-02-08 08:51:29 -0800 |
commit | a955967fc934377ca4f7161bf775ff1b6cd5d230 (patch) | |
tree | 4691ab505490f8f40bb1d82e7e6beca3f83c8f55 /lib/chef/resource/dsc_script.rb | |
parent | 3b1df86ecf403071b94e1ce3cb06ec28f106f179 (diff) | |
download | chef-a955967fc934377ca4f7161bf775ff1b6cd5d230.tar.gz |
Modified dsc_script imports to not use hash rocket
New Syntax:
dsc_script 'Foo' do
imports "FooModule", "FooResource", "BarResource"
...
end
or
dsc_script 'Foo' do
imports "FooModule"
...
end
Diffstat (limited to 'lib/chef/resource/dsc_script.rb')
-rw-r--r-- | lib/chef/resource/dsc_script.rb | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/chef/resource/dsc_script.rb b/lib/chef/resource/dsc_script.rb index 43a64c4628..cf96ef6b7f 100644 --- a/lib/chef/resource/dsc_script.rb +++ b/lib/chef/resource/dsc_script.rb @@ -29,6 +29,7 @@ class Chef @allowed_actions.push(:run) @action = :run @resource_name = :dsc_script + @imports = {} end def code(arg=nil) @@ -89,12 +90,17 @@ class Chef ) end - def imports(arg=nil) - set_or_return( - :imports, - arg, - :kind_of => [ Hash ] - ) + def imports(module_name=nil, *args) + if module_name + @imports[module_name] ||= [] + if args.length == 0 + @imports[module_name] << '*' + else + @imports[module_name].push(*args) + end + else + @imports + end end def flags(arg=nil) |