Let last_update_check use lib/const.rb last data modification time if git isn't setup yet during install. (#10304)

Signed-off-by: Satadru Pramanik <satadru@gmail.com>
This commit is contained in:
Satadru Pramanik, DO, MPH, MEng
2024-08-13 13:00:47 -04:00
committed by GitHub
parent 5621163c84
commit 4fbfe7cf8e
2 changed files with 2 additions and 3 deletions

View File

@@ -1924,8 +1924,7 @@ end
load_json
@last_update_check = `stat -c %Y #{File.join(CREW_LIB_PATH, '.git/FETCH_HEAD')}`.chomp.to_i
@last_update_check = @last_update_check.blank? ? 0 : @last_update_check
@last_update_check = File.file?(File.join(CREW_LIB_PATH, '.git/FETCH_HEAD')) ? `stat -c %Y #{File.join(CREW_LIB_PATH, '.git/FETCH_HEAD')}`.chomp.to_i : `stat -c %Y #{File.join(CREW_LIB_PATH, 'lib/const.rb')}`.chomp.to_i
crewlog("The last update was #{time_difference(@last_update_check, Time.now.to_i)} ago.")
puts "It has been more than #{CREW_UPDATE_CHECK_INTERVAL} day#{CREW_UPDATE_CHECK_INTERVAL < 2 ? '' : 's'} since crew was last updated. Please run 'crew update'".lightpurple if Time.now.to_i - @last_update_check > (CREW_UPDATE_CHECK_INTERVAL * 3600 * 24)
command_name = args.select { |k, v| v && command?(k) }.keys[0]

View File

@@ -2,7 +2,7 @@
# Defines common constants used in different parts of crew
require 'etc'
CREW_VERSION = '1.50.2'
CREW_VERSION = '1.50.3'
# Kernel architecture.
KERN_ARCH = Etc.uname[:machine]