-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Install Command Line Tools as part of Xcode setup #79
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My only legitimate concern here is that I don't see where CommandLineTools.new.product
is used in the xcode
resource. I do see a unit test for it though, which leads me to believe something is missing.
libraries/command_line_tools.rb
Outdated
end | ||
|
||
def available_products | ||
shell_out('softwareupdate -l').stdout |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Break the command into separate arguments and use the long version of the list
option?
shell_out('softwareupdate', '--list').stdout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. Done.
resources/xcode.rb
Outdated
end | ||
|
||
execute 'install Xcode CLT' do | ||
command lazy { "softwareupdate --verbose -i '#{CommandLineTools.new}'" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple legitimate questions:
- Based on the unit test, do we need to use
CommandLineTools.new.product
in the command? - Do we want to be live-streaming here? If not, is the
verbose
option needed?
Nitpicks. Could we:
- extract the command to a list variable for readability (clearer that we need
CommandLineTools
in quotes) - use the long version of the
install
option
execute 'install Xcode CLT' do
install_clt_command = ['softwareupdate', '--install', "'#{CommandLineTools.new}'"]
command lazy { install_clt_command }
action :nothing
notifies :delete, 'file[sentinel to make CLT available]', :immediately
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, fixed. And yep, but not with verbose
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CommandLineTools
also is handled by the command array properly (something I hadn't tested before)
Finding available software | ||
Software Update found the following new or updated software: | ||
* Command Line Tools (macOS El Capitan version 10.11) for Xcode-8.2 | ||
\tCommand Line Tools (macOS El Capitan version 10.11) for Xcode (8.2), 150374K [recommended] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, neat. I didn't realize you could use\t
for a tab in a heredoc!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant to use <<~
here actually - the tabs make more sense in that context.
Looks great. Thanks for making the changes quickly. |
This PR ensures the
xcode-install
gem can be installed into Chef gems by verifying that Command Line Tools are installed. If not installed, a temporary file is created to trigger thesoftwareupdate -l
command into providing the product name for the latest CLT, which is then downloaded and installed.Fixes #79.