-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathRakefile
48 lines (40 loc) · 1.71 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#
# Author:: John McCrae (<[email protected]>)
# Copyright:: Copyright, Chef Software Inc.
# Copyright:: Copyright, Progress Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
begin
require "rubocop/rake_task"
require "rspec/core/rake_task"
require "rubygems"
require "rake"
require "chefstyle"
rescue LoadError => e
puts "Skipping missing rake dep: #{e}"
end
desc "Builds and Copies powershell_exec related binaries from the latest built Habitat Packages"
task :update_chef_powershell_dlls do
raise "This task must be run on Windows since we are installing a Windows targeted package!" unless Gem.win_platform?
require "mkmf"
raise "Unable to locate Habitat cli. Please install Habitat cli before invoking this task!" unless find_executable "hab"
sh("hab pkg build Habitat")
sh("hab pkg install chef/chef-powershell-shim")
x64 = `hab pkg path chef/chef-powershell-shim`.chomp.tr("\\", "/")
FileUtils.rm_rf(Dir["bin/ruby_bin_folder/AMD64/*"])
puts "Copying #{x64}/bin/* to chef-powershell/bin/ruby_bin_folder/AMD64"
FileUtils.cp_r(Dir["#{x64}/bin/*"], "chef-powershell/bin/ruby_bin_folder/AMD64")
end
task all: %w{update_chef_powershell_dlls}.freeze