Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
brew
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
brew
Commits
3755b33a
Commit
3755b33a
authored
11 years ago
by
Jack Nagel
Browse files
Options
Downloads
Patches
Plain Diff
Refactor Xcode/CLT version checks
parent
b2ff6e93
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Library/Homebrew/cmd/doctor.rb
+27
-22
27 additions, 22 deletions
Library/Homebrew/cmd/doctor.rb
Library/Homebrew/cmd/install.rb
+1
-1
1 addition, 1 deletion
Library/Homebrew/cmd/install.rb
Library/Homebrew/os/mac/xcode.rb
+12
-7
12 additions, 7 deletions
Library/Homebrew/os/mac/xcode.rb
with
40 additions
and
30 deletions
Library/Homebrew/cmd/doctor.rb
+
27
−
22
View file @
3755b33a
...
...
@@ -215,33 +215,38 @@ def check_for_broken_symlinks
end
end
def
check_for_latest_xcode
if
not
MacOS
::
Xcode
.
installed?
if
MacOS
.
version
>=
10.7
if
not
MacOS
::
CLT
.
installed?
<<-
EOS
.
undent
No developer tools installed
You should install the Command Line Tools: http://connect.apple.com
EOS
elsif
not
MacOS
::
CLT
.
latest_version?
<<-
EOS
.
undent
A newer Command Line Tools for Xcode release is available
You should install the latest version from: http://connect.apple.com
EOS
end
else
<<-
EOS
.
undent
Xcode not installed
Most stuff needs Xcode to build: http://developer.apple.com/xcode/
EOS
end
elsif
MacOS
::
Xcode
.
version
<
MacOS
::
Xcode
.
latest_version
then
<<-
EOS
.
undent
def
check_xcode_clt
if
MacOS
::
Xcode
.
installed?
__check_xcode_up_to_date
elsif
MacOS
.
version
>=
10.7
__check_clt_up_to_date
else
<<-
EOS
.
undent
Xcode not installed
Most stuff needs Xcode to build: http://developer.apple.com/xcode/
EOS
end
end
def
__check_xcode_up_to_date
if
MacOS
::
Xcode
.
outdated?
then
<<-
EOS
.
undent
Your Xcode (
#{
MacOS
::
Xcode
.
version
}
) is outdated
Please install Xcode
#{
MacOS
::
Xcode
.
latest_version
}
.
EOS
end
end
def
__check_clt_up_to_date
if
not
MacOS
::
CLT
.
installed?
then
<<-
EOS
.
undent
No developer tools installed
You should install the Command Line Tools: http://connect.apple.com
EOS
elsif
MacOS
::
CLT
.
outdated?
then
<<-
EOS
.
undent
A newer Command Line Tools for Xcode release is available
You should install the latest version from: http://connect.apple.com
EOS
end
end
def
check_for_stray_developer_directory
# if the uninstaller script isn't there, it's a good guess neither are
# any troublesome leftover Xcode files
...
...
@@ -271,7 +276,7 @@ def check_cc
end
def
check_standard_compilers
return
if
check_
for_latest_
xcode
# only check if Xcode is up to date
return
if
check_xcode
_clt
# only check if Xcode is up to date
compiler_status
=
MacOS
.
compilers_standard?
if
not
compiler_status
and
not
compiler_status
.
nil?
then
<<-
EOS
.
undent
Your compilers are different from the standard versions for your Xcode.
...
...
This diff is collapsed.
Click to expand it.
Library/Homebrew/cmd/install.rb
+
1
−
1
View file @
3755b33a
...
...
@@ -42,7 +42,7 @@ module Homebrew extend self
def
check_xcode
require
'cmd/doctor'
checks
=
Checks
.
new
%w{check_
for_latest_
xcode check_xcode_license_approved}
.
each
do
|
check
|
%w{check_xcode
_clt
check_xcode_license_approved}
.
each
do
|
check
|
out
=
checks
.
send
(
check
)
opoo
out
unless
out
.
nil?
end
...
...
This diff is collapsed.
Click to expand it.
Library/Homebrew/os/mac/xcode.rb
+
12
−
7
View file @
3755b33a
...
...
@@ -19,17 +19,18 @@ module MacOS::Xcode extend self
def
latest_version
case
MacOS
.
version
when
10.5
then
"3.1.4"
when
10.6
then
"3.2.6"
when
10.5
then
"3.1.4"
when
10.6
then
"3.2.6"
when
10.7
..
10.8
then
"4.6.2"
else
if
MacOS
.
version
>=
10.7
"4.6.2"
else
raise
"Mac OS X `
#{
MacOS
.
version
}
' is invalid"
end
raise
"Mac OS X '
#{
MacOS
.
version
}
' is invalid"
end
end
def
outdated?
version
<
latest_version
end
def
prefix
@prefix
||=
begin
path
=
Pathname
.
new
(
folder
)
...
...
@@ -158,6 +159,10 @@ module MacOS::CLT extend self
$1
.
to_i
>=
425
and
$3
.
to_i
>=
28
end
def
outdated?
!
latest_version?
end
def
version
# The pkgutils calls are slow, don't repeat if no CLT installed.
return
@version
if
@version_determined
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment