summaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
authorMarc Chamberland <chamberland.marc@gmail.com>2020-02-24 14:19:03 -0500
committerMarc Chamberland <chamberland.marc@gmail.com>2020-02-24 14:19:03 -0500
commitba1f7c0d3afb0b82185c60f4367dd8b0936ebc42 (patch)
treeebc4a9991a65d17b47dd60229d8407e71238b78d /Rakefile
parent8a0ef12a66480e520c0ea7ea97e30ef13f0bef49 (diff)
downloadchef-ba1f7c0d3afb0b82185c60f4367dd8b0936ebc42.tar.gz
Templating powershell extensions to inject distro constants
Signed-off-by: Marc Chamberland <chamberland.marc@gmail.com>
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile9
1 files changed, 9 insertions, 0 deletions
diff --git a/Rakefile b/Rakefile
index 643d70015b..b54411af4c 100644
--- a/Rakefile
+++ b/Rakefile
@@ -22,6 +22,7 @@ begin
require_relative "tasks/dependencies"
require_relative "tasks/announce"
require_relative "tasks/docs"
+ require_relative "lib/chef/dist"
rescue LoadError => e
puts "Skipping missing rake dep: #{e}"
end
@@ -35,6 +36,14 @@ task :super_install do
Dir.chdir(path)
sh("rake install")
end
+
+# Templating the powershell extensions so we can inject distro constants
+ template_file = ::File.join(::File.dirname(__FILE__), "distro", "templates", "powershell", "chef", "chef.psm1.erb")
+ psm1_path = ::File.join(::File.dirname(__FILE__), "distro", "powershell", "chef")
+ FileUtils.mkdir_p psm1_path
+ template = ERB.new(IO.read(template_file))
+ chef_psm1 = template.result
+ File.open(::File.join(psm1_path, "chef.psm1"), "w") { |f| f.write(chef_psm1) }
end
task install: :super_install