macos-cookbook/resources/command_line_tools.rb

45 строки
1.2 KiB
Ruby
Исходник Обычный вид История

unified_mode true
2020-06-19 00:04:50 +03:00
provides :command_line_tools
Release/2.10.0 (#179) * Bump cookbook version in metadata.rb * Add `command_line_tools` resource (#176) * Update kitchen.yml to use 10.14.2 box * Add command_line_tools resource * Remove installed? check in command_line_tools library * Add command_line_tools suite * Add guard on execute block for command line tools - Add ChefSpec tests for command_line_tools - Update unnecessary tests from xcode_spec for command line tools resource * Cookstyle fixes * Add documentation for command_line_tools resource * Add link to Command Line Tools doc in README * Update documentation/resource_command_line_tools.md Co-Authored-By: ehanlon <eahanl@microsoft.com> * Bump default Xcode version in attributes file (#178) * expect correct hash for string "correct-horse-battery-staple" (#177) hash was originally for "correct-horse-battery-staplesudo" * Update CHANGELOG * New Xcode Property: download_url (#180) * version bump * Add functionality for --url support xcode resource has a new property called download_url. Most of the changes were done in xcversion which included a new routine called xcode_install_options. * fix rspec errors as Xcode.new was given one less argument * add spec tests to check download_url setting * add spec tests to check download_url setting * add spec test to test for the original behavior if download url is left blank * update xcode documentation * update changelog * Update libraries/xcversion.rb Rename xcode_install_options to download_url_option Co-Authored-By: mjmerin <33106688+mjmerin@users.noreply.github.com> * Update libraries/xcversion.rb Rename xcode_install_options to download_url_option Co-Authored-By: mjmerin <33106688+mjmerin@users.noreply.github.com> * update routine name * update xcode docs to provide an example of installing xcode from a local url * Add missing '=' for --url * Add separate integration tests for installing Xcode from Apple or from URL * Validate download_url property to prevent requirement for Apple Dev creds to be provided * Update ChefSpec tests * move XCVersion expectations to their own file * change version tests to cover apple to semantic conversion expectations * update formatting * remove nil guard since the resource default is an empty string * add another test for ignoring Apple version * update test version * update Xcode controls * Only run xcode_from_apple suite on Mojave * Update Inspec reporter * Ensure suite names have dashes instead of underscores * require some sugar * add method to determine platform compatibility for xcode object * add platform-specific expectations to xcode spec * raise exception based on compatibility method * don't require that Xcode be initialized with empty URL string * unchain version * don't run Xcode URL install for Sierra * Apply suggestions from code review Co-Authored-By: ehanlon <eahanl@microsoft.com>
2019-01-18 03:45:23 +03:00
property :compile_time, [true, false],
Release/2.10.0 (#179) * Bump cookbook version in metadata.rb * Add `command_line_tools` resource (#176) * Update kitchen.yml to use 10.14.2 box * Add command_line_tools resource * Remove installed? check in command_line_tools library * Add command_line_tools suite * Add guard on execute block for command line tools - Add ChefSpec tests for command_line_tools - Update unnecessary tests from xcode_spec for command line tools resource * Cookstyle fixes * Add documentation for command_line_tools resource * Add link to Command Line Tools doc in README * Update documentation/resource_command_line_tools.md Co-Authored-By: ehanlon <eahanl@microsoft.com> * Bump default Xcode version in attributes file (#178) * expect correct hash for string "correct-horse-battery-staple" (#177) hash was originally for "correct-horse-battery-staplesudo" * Update CHANGELOG * New Xcode Property: download_url (#180) * version bump * Add functionality for --url support xcode resource has a new property called download_url. Most of the changes were done in xcversion which included a new routine called xcode_install_options. * fix rspec errors as Xcode.new was given one less argument * add spec tests to check download_url setting * add spec tests to check download_url setting * add spec test to test for the original behavior if download url is left blank * update xcode documentation * update changelog * Update libraries/xcversion.rb Rename xcode_install_options to download_url_option Co-Authored-By: mjmerin <33106688+mjmerin@users.noreply.github.com> * Update libraries/xcversion.rb Rename xcode_install_options to download_url_option Co-Authored-By: mjmerin <33106688+mjmerin@users.noreply.github.com> * update routine name * update xcode docs to provide an example of installing xcode from a local url * Add missing '=' for --url * Add separate integration tests for installing Xcode from Apple or from URL * Validate download_url property to prevent requirement for Apple Dev creds to be provided * Update ChefSpec tests * move XCVersion expectations to their own file * change version tests to cover apple to semantic conversion expectations * update formatting * remove nil guard since the resource default is an empty string * add another test for ignoring Apple version * update test version * update Xcode controls * Only run xcode_from_apple suite on Mojave * Update Inspec reporter * Ensure suite names have dashes instead of underscores * require some sugar * add method to determine platform compatibility for xcode object * add platform-specific expectations to xcode spec * raise exception based on compatibility method * don't require that Xcode be initialized with empty URL string * unchain version * don't run Xcode URL install for Sierra * Apply suggestions from code review Co-Authored-By: ehanlon <eahanl@microsoft.com>
2019-01-18 03:45:23 +03:00
description: 'Install the Xcode Command Line Tools at compile time.',
default: false, desired_state: false
action :install do
command_line_tools = CommandLineTools.new
execute "install #{command_line_tools.version}" do
command ['softwareupdate', '--install', command_line_tools.version]
not_if { ::File.exist?('/Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib') }
live_stream true
end
file 'sentinel to request on-demand install' do
path '/tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress'
action :delete
end
end
action :upgrade do
command_line_tools = CommandLineTools.new
execute "upgrade #{command_line_tools.version}" do
command ['softwareupdate', '--install', command_line_tools.latest_from_catalog]
not_if { command_line_tools.version == command_line_tools.latest_from_catalog }
live_stream true
end
file 'sentinel to request on-demand install' do
path '/tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress'
Release/2.10.0 (#179) * Bump cookbook version in metadata.rb * Add `command_line_tools` resource (#176) * Update kitchen.yml to use 10.14.2 box * Add command_line_tools resource * Remove installed? check in command_line_tools library * Add command_line_tools suite * Add guard on execute block for command line tools - Add ChefSpec tests for command_line_tools - Update unnecessary tests from xcode_spec for command line tools resource * Cookstyle fixes * Add documentation for command_line_tools resource * Add link to Command Line Tools doc in README * Update documentation/resource_command_line_tools.md Co-Authored-By: ehanlon <eahanl@microsoft.com> * Bump default Xcode version in attributes file (#178) * expect correct hash for string "correct-horse-battery-staple" (#177) hash was originally for "correct-horse-battery-staplesudo" * Update CHANGELOG * New Xcode Property: download_url (#180) * version bump * Add functionality for --url support xcode resource has a new property called download_url. Most of the changes were done in xcversion which included a new routine called xcode_install_options. * fix rspec errors as Xcode.new was given one less argument * add spec tests to check download_url setting * add spec tests to check download_url setting * add spec test to test for the original behavior if download url is left blank * update xcode documentation * update changelog * Update libraries/xcversion.rb Rename xcode_install_options to download_url_option Co-Authored-By: mjmerin <33106688+mjmerin@users.noreply.github.com> * Update libraries/xcversion.rb Rename xcode_install_options to download_url_option Co-Authored-By: mjmerin <33106688+mjmerin@users.noreply.github.com> * update routine name * update xcode docs to provide an example of installing xcode from a local url * Add missing '=' for --url * Add separate integration tests for installing Xcode from Apple or from URL * Validate download_url property to prevent requirement for Apple Dev creds to be provided * Update ChefSpec tests * move XCVersion expectations to their own file * change version tests to cover apple to semantic conversion expectations * update formatting * remove nil guard since the resource default is an empty string * add another test for ignoring Apple version * update test version * update Xcode controls * Only run xcode_from_apple suite on Mojave * Update Inspec reporter * Ensure suite names have dashes instead of underscores * require some sugar * add method to determine platform compatibility for xcode object * add platform-specific expectations to xcode spec * raise exception based on compatibility method * don't require that Xcode be initialized with empty URL string * unchain version * don't run Xcode URL install for Sierra * Apply suggestions from code review Co-Authored-By: ehanlon <eahanl@microsoft.com>
2019-01-18 03:45:23 +03:00
action :delete
end
end
def after_created
return unless compile_time
Array(action).each do |action|
run_action(action)
end
end