diff options
author | Robb Kidd <rkidd@chef.io> | 2020-04-25 14:32:47 -0400 |
---|---|---|
committer | Robb Kidd <rkidd@chef.io> | 2020-04-28 11:50:00 -0400 |
commit | c9edf666ed038650dac66ef46256cca9217718ce (patch) | |
tree | 126b5385a095a9f37351f5a8c091517f3c43bad5 /Rakefile | |
parent | 87eb4537b3502da5b7ba95ada4fbe91f11e3311f (diff) | |
download | chef-c9edf666ed038650dac66ef46256cca9217718ce.tar.gz |
give good names to the rake tasks that run before install
Renamed "super_install" to something a bit more descriptive and added a
description. Moved the rendering of the powershell extension out of
"super_install" and into its own named task. These are both now under a
pre_install namespace and included in a 'pre_install:all' task.
The 'install' task now depends on 'pre_install:all`. Here's hoping names
here will help future humans (us) when dealing with these tasks.
Signed-off-by: Robb Kidd <robb@thekidds.org>
Diffstat (limited to 'Rakefile')
-rw-r--r-- | Rakefile | 41 |
1 files changed, 25 insertions, 16 deletions
@@ -29,24 +29,32 @@ end ENV["CHEF_LICENSE"] = "accept-no-persist" -# hack the chef-config install to run before the traditional install task -task :super_install do - %w{chef-utils chef-config}.each do |gem| - path = ::File.join(::File.dirname(__FILE__), gem) - Dir.chdir(path) - sh("rake install") +namespace :pre_install do + desc "Runs 'rake install' for the gems that live in subdirectories in this repo" + task :install_gems_from_dirs do + %w{chef-utils chef-config}.each do |gem| + path = ::File.join(::File.dirname(__FILE__), gem) + Dir.chdir(path) do + sh("rake install") + end + end 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) } + desc "Renders the powershell extensions with distro flavoring" + task :render_powershell_extension do + 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 all: ["pre_install:install_gems_from_dirs", "pre_install:render_powershell_extension"] end -task install: :super_install +# hack in all the preinstall tasks to occur before the tradtional install task +task install: "pre_install:all" # make sure we build the correct gemspec on windows gemspec = Gem.win_platform? ? "chef-universal-mingw32" : "chef" @@ -55,8 +63,9 @@ Bundler::GemHelper.install_tasks name: gemspec # this gets appended to the normal bundler install helper task :install do chef_bin_path = ::File.join(::File.dirname(__FILE__), "chef-bin") - Dir.chdir(chef_bin_path) - sh("rake install:force") + Dir.chdir(chef_bin_path) do + sh("rake install:force") + end end task :pedant, :chef_zero_spec |