Skip to content

Commit

Permalink
Cannot use xcodebuild if we've just got the command line tools
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamgilbert committed Nov 8, 2016
1 parent 8a8ba08 commit 0db0cf8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
10 changes: 10 additions & 0 deletions lib/facter/xcode_command_line_tools.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Facter.add(:xcode_command_line_tools) do
confine kernel: 'Darwin'
setcode do
if Facter.value(:xcode_active_directory).include? '.app'
true
else
false
end
end
end
1 change: 0 additions & 1 deletion lib/facter/xcode_product.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
if Facter.value(:xcode_tools_present) == false
# Oh man this is bad, but we need this file to exist
Facter::Util::Resolution.exec('/usr/bin/touch /private/tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress')
# Facter::Util::Resolution.exec('/usr/sbin/softwareupdate -l | grep "\*.*Command Line" | head -n 1 | awk -F"*" \'{print $2}\' | sed -e \'s/^ *//\' | tr -d \'\n\'')
swupd_out = Facter::Util::Resolution.exec('/usr/sbin/softwareupdate -l')
output = nil
swupd_out.each_line do |line|
Expand Down
4 changes: 3 additions & 1 deletion manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
ensure => 'present'
} ->

exec {'/usr/bin/xcode-select -r': } ->

exec { "/usr/sbin/softwareupdate -i \"${xcode_product}\" --verbose":
logoutput => true,
timeout => 0,
Expand All @@ -14,7 +16,7 @@

}

unless $facts['xcode_license_accepted'] {
if $facts['xcode_license_accepted'] == false and $facts['xcode_command_line_tools'] == false {
exec { '/usr/bin/xcodebuild -license accept': }
}

Expand Down

0 comments on commit 0db0cf8

Please sign in to comment.