Adjust linter rule... (#8860)

* chdir before using git

* fix rubocop complaint

* adjust lint rule

* expand logic of path env.d check

* bump
This commit is contained in:
Satadru Pramanik, DO, MPH, MEng
2023-10-31 22:16:27 -04:00
committed by GitHub
parent 1cbe12f2a9
commit 2f578f414c
4 changed files with 15 additions and 6 deletions

View File

@@ -5,7 +5,14 @@
FileUtils.rm_rf "#{HOME}/.cache/crewcache/manifest"
# Fix missing $PATH not added in install.sh
if !system("grep -q '$PATH' #{CREW_PREFIX}/etc/env.d/path") || Gem::Version.new(CREW_VERSION.to_s) < Gem::Version.new('1.36.4')
@need_path = false
if !File.file?("#{CREW_PREFIX}/etc/env.d/path")
@need_path = true
elsif !system("grep -q '$PATH' #{CREW_PREFIX}/etc/env.d/path") || Gem::Version.new(CREW_VERSION.to_s) < Gem::Version.new('1.36.4')
@need_path = true
end
if @need_path
FileUtils.mkdir_p "#{CREW_PREFIX}/etc/env.d"
File.write "#{CREW_PREFIX}/etc/env.d/path", <<~ENVD_PATH_EOF
## Inserted by Chromebrew version #{CREW_VERSION}
PATH=#{CREW_PREFIX}/bin:#{CREW_PREFIX}/sbin:#{CREW_PREFIX}/share/musl/bin:$PATH