method
check_home_permissions
v2_6_3 -
Show latest stable
-
0 notes -
Class: Doctor
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378
- 1_9_2_180
- 1_9_3_125
- 1_9_3_392
- 2_1_10
- 2_2_9
- 2_4_6
- 2_5_5
- 2_6_3 (0)
- What's this?
check_home_permissions()
private
Hide source
# File lib/bundler/cli/doctor.rb, line 98 def check_home_permissions require "find" files_not_readable_or_writable = [] files_not_rw_and_owned_by_different_user = [] files_not_owned_by_current_user_but_still_rw = [] Find.find(Bundler.home.to_s).each do |f| if !File.writable?(f) || !File.readable?(f) if File.stat(f).uid != Process.uid files_not_rw_and_owned_by_different_user << f else files_not_readable_or_writable << f end elsif File.stat(f).uid != Process.uid files_not_owned_by_current_user_but_still_rw << f end end ok = true if files_not_owned_by_current_user_but_still_rw.any? Bundler.ui.warn "Files exist in the Bundler home that are owned by another " "user, but are still readable/writable. These files are:\n - #{files_not_owned_by_current_user_but_still_rw.join("\n - ")}" ok = false end if files_not_rw_and_owned_by_different_user.any? Bundler.ui.warn "Files exist in the Bundler home that are owned by another " "user, and are not readable/writable. These files are:\n - #{files_not_rw_and_owned_by_different_user.join("\n - ")}" ok = false end if files_not_readable_or_writable.any? Bundler.ui.warn "Files exist in the Bundler home that are not " "readable/writable by the current user. These files are:\n - #{files_not_readable_or_writable.join("\n - ")}" ok = false end ok end