description cache invalid if updated w/o EVAL_ALL
When updating description cache, if eval_all not set, clear cache rather than leaving it out of date. This fixes an issue where, if a user sets `--eval-all` on the command line to run description searches, but HOMEBREW_EVAL_ALL isn't set in the environment the cache is never updated.
This commit is contained in:
		
							parent
							
								
									3aeef5aef2
								
							
						
					
					
						commit
						e8c71646c1
					
				@ -68,6 +68,14 @@ class CacheStoreDatabase
 | 
			
		||||
    db.delete(key)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  # Deletes all content from the underlying database (if it already exists).
 | 
			
		||||
  def clear!
 | 
			
		||||
    return unless created?
 | 
			
		||||
 | 
			
		||||
    dirty!
 | 
			
		||||
    db.clear
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  # Closes the underlying database (if it is created and open).
 | 
			
		||||
  def write_if_dirty!
 | 
			
		||||
    return unless dirty?
 | 
			
		||||
 | 
			
		||||
@ -41,7 +41,10 @@ class DescriptionCacheStore < CacheStore
 | 
			
		||||
  # @param report [Report] an update report generated by cmd/update.rb
 | 
			
		||||
  # @return [nil]
 | 
			
		||||
  def update_from_report!(report)
 | 
			
		||||
    return unless Homebrew::EnvConfig.eval_all?
 | 
			
		||||
    unless Homebrew::EnvConfig.eval_all?
 | 
			
		||||
      database.clear!
 | 
			
		||||
      return
 | 
			
		||||
    end
 | 
			
		||||
    return populate_if_empty! if database.empty?
 | 
			
		||||
    return if report.empty?
 | 
			
		||||
 | 
			
		||||
@ -60,7 +63,10 @@ class DescriptionCacheStore < CacheStore
 | 
			
		||||
  # @param formula_names [Array] the formulae to update
 | 
			
		||||
  # @return [nil]
 | 
			
		||||
  def update_from_formula_names!(formula_names)
 | 
			
		||||
    return unless Homebrew::EnvConfig.eval_all?
 | 
			
		||||
    unless Homebrew::EnvConfig.eval_all?
 | 
			
		||||
      database.clear!
 | 
			
		||||
      return
 | 
			
		||||
    end
 | 
			
		||||
    return populate_if_empty! if database.empty?
 | 
			
		||||
 | 
			
		||||
    formula_names.each do |name|
 | 
			
		||||
@ -108,7 +114,10 @@ class CaskDescriptionCacheStore < DescriptionCacheStore
 | 
			
		||||
  # @param report [Report] an update report generated by cmd/update.rb
 | 
			
		||||
  # @return [nil]
 | 
			
		||||
  def update_from_report!(report)
 | 
			
		||||
    return unless Homebrew::EnvConfig.eval_all?
 | 
			
		||||
    unless Homebrew::EnvConfig.eval_all?
 | 
			
		||||
      database.clear!
 | 
			
		||||
      return
 | 
			
		||||
    end
 | 
			
		||||
    return populate_if_empty! if database.empty?
 | 
			
		||||
    return if report.empty?
 | 
			
		||||
 | 
			
		||||
@ -124,7 +133,10 @@ class CaskDescriptionCacheStore < DescriptionCacheStore
 | 
			
		||||
  # @param cask_tokens [Array] the casks to update
 | 
			
		||||
  # @return [nil]
 | 
			
		||||
  def update_from_cask_tokens!(cask_tokens)
 | 
			
		||||
    return unless Homebrew::EnvConfig.eval_all?
 | 
			
		||||
    unless Homebrew::EnvConfig.eval_all?
 | 
			
		||||
      database.clear!
 | 
			
		||||
      return
 | 
			
		||||
    end
 | 
			
		||||
    return populate_if_empty! if database.empty?
 | 
			
		||||
 | 
			
		||||
    cask_tokens.each do |token|
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user