Skip to content

Commit

Permalink
Break cache if Gemfile.lock or .rubocop.yml change.
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuapinter committed Sep 24, 2024
1 parent 5c63068 commit bcca3cd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/erb_lint/cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ def initialize(config, cache_dir = nil)
@cache_dir = cache_dir || CACHE_DIRECTORY
@hits = []
@new_results = []
@gemfile_lock = File.read("Gemfile.lock") if File.exist?("Gemfile.lock")
@rubocop_config = File.read(".rubocop.yml") if File.exist?(".rubocop.yml")
puts "Cache mode is on"
end

Expand Down Expand Up @@ -76,7 +78,7 @@ def checksum(filename, file_content)
mode = File.stat(filename).mode

digester.update(
"#{mode}#{config.to_hash}#{ERBLint::VERSION}#{file_content}",
"#{mode}#{config.to_hash}#{ERBLint::VERSION}#{@rubocop_config}#{@gemfile_lock}#{file_content}",
)
digester.hexdigest
rescue Errno::ENOENT
Expand Down

0 comments on commit bcca3cd

Please sign in to comment.