doctor: add check_access_homebrew_repository

This commit is contained in:
Xu Cheng 2015-09-29 16:19:32 +08:00
parent 3c54d12cec
commit ff132a9ddb

View File

@ -424,10 +424,18 @@ class Checks
__check_subdir_access "share/man" __check_subdir_access "share/man"
end end
def check_access_homebrew_repository
unless HOMEBREW_REPOSITORY.writable_real? then <<-EOS.undent
The #{HOMEBREW_REPOSITORY} is not writable.
You should probably `chown` #{HOMEBREW_REPOSITORY}
EOS
end
end
def check_access_usr_local def check_access_usr_local
return unless HOMEBREW_PREFIX.to_s == "/usr/local" return unless HOMEBREW_PREFIX.to_s == "/usr/local"
unless File.writable_real?("/usr/local") then <<-EOS.undent unless HOMEBREW_PREFIX.writable_real? then <<-EOS.undent
The /usr/local directory is not writable. The /usr/local directory is not writable.
Even if this directory was writable when you installed Homebrew, other Even if this directory was writable when you installed Homebrew, other
software may change permissions on this directory. Some versions of the software may change permissions on this directory. Some versions of the
@ -435,6 +443,7 @@ class Checks
You should probably change the ownership and permissions of /usr/local You should probably change the ownership and permissions of /usr/local
back to your user account. back to your user account.
sudo chown $(whoami):admin /usr/local
EOS EOS
end end
end end