class Chef::Resource::BuildEssential
Public Instance Methods
Source
# File lib/chef/resource/build_essential.rb, line 140 def install_xcode_cli_tools(label) # This script was graciously borrowed and modified from Tim Sutton's # osx-vm-templates at https://github.com/timsutton/osx-vm-templates/blob/b001475df54a9808d3d56d06e71b8fa3001fff42/scripts/xcode-cli-tools.sh bash "install Xcode Command Line Tools" do code <<-EOH # create the placeholder file that's checked by CLI updates' .dist code # in Apple's SUS catalog touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress # install it softwareupdate -i "#{label}" --verbose # Remove the placeholder to prevent perpetual appearance in the update utility rm -f /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress EOH end end
Install Xcode Command Line tools via softwareupdate CLI
@param [String] label The label (package name) to install
Source
# File lib/chef/resource/build_essential.rb, line 161 def xcode_cli_installed? !shell_out("xcode-select", "-p").error? end
Determine if the XCode Command Line Tools are installed by checking for success from ‘xcode-select -p`
@return [true, false]
Source
# File lib/chef/resource/build_essential.rb, line 169 def xcode_cli_package_label available_updates = shell_out("softwareupdate", "--list") # raise if we fail to check available_updates.error! # https://rubular.com/r/UPEE5P7mZLvXNs # this will return the match or nil available_updates.stdout[/^\s*\* (?:Label: )?(Command Line Tools.*)/, 1] end
Return to package label of the latest Xcode Command Line Tools update, if available
@return [String, NilClass]