Class: Jets::Builders::Purger
- Inherits:
-
Object
- Object
- Jets::Builders::Purger
- Defined in:
- lib/jets/builders/purger.rb
Instance Method Summary collapse
-
#initialize ⇒ Purger
constructor
A new instance of Purger.
- #purge ⇒ Object
-
#version_changed? ⇒ Boolean
When jets changes versions major or minor version consider it a big enough can to purge the cache.
- #write_version ⇒ Object
Constructor Details
Instance Method Details
#purge ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/jets/builders/purger.rb', line 9 def purge if version_changed? last_version = @last_version || "unknown" puts "The jets version has changed enough since the last build to merit refreshing the build cache." puts "Current jets version: #{Jets::VERSION} Last built jets version: #{last_version}" puts "Removing /tmp/jets/#{@project_name} to start fresh." FileUtils.rm_rf("/tmp/jets/#{@project_name}") end write_version end |
#version_changed? ⇒ Boolean
When jets changes versions major or minor version consider it a big enough can to purge the cache
21 22 23 24 25 26 27 28 |
# File 'lib/jets/builders/purger.rb', line 21 def version_changed? return true unless File.exist?(@version_file) @last_version = IO.read(@version_file).strip last_major, last_minor, _ = @last_version.split('.') current_major, current_minor, _ = Jets::VERSION.split('.') last_major != current_major || last_minor != current_minor end |