Class: KPM::Sha1Checker
- Inherits:
-
Object
- Object
- KPM::Sha1Checker
- Defined in:
- lib/kpm/sha1_checker.rb
Class Method Summary collapse
Instance Method Summary collapse
- #add_or_modify_entry!(coordinates, remote_sha1) ⇒ Object
- #all_sha1 ⇒ Object
- #artifact_info(coordinates) ⇒ Object
- #cache_artifact_info(coordinates_with_maybe_latest, artifact_info) ⇒ Object
- #cache_killbill_info(version, dependencies) ⇒ Object
-
#initialize(sha1_file, logger = nil) ⇒ Sha1Checker
constructor
A new instance of Sha1Checker.
- #killbill_info(version) ⇒ Object
- #remove_entry!(coordinates) ⇒ Object
- #sha1(coordinates) ⇒ Object
Constructor Details
#initialize(sha1_file, logger = nil) ⇒ Sha1Checker
Returns a new instance of Sha1Checker.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/kpm/sha1_checker.rb', line 13 def initialize(sha1_file, logger = nil) @sha1_file = sha1_file init! if logger.nil? @logger = Logger.new(STDOUT) @logger.level = Logger::INFO else @logger = logger end end |
Class Method Details
.from_file(sha1_file, logger = nil) ⇒ Object
9 10 11 |
# File 'lib/kpm/sha1_checker.rb', line 9 def self.from_file(sha1_file, logger = nil) Sha1Checker.new(sha1_file, logger) end |
Instance Method Details
#add_or_modify_entry!(coordinates, remote_sha1) ⇒ Object
33 34 35 36 |
# File 'lib/kpm/sha1_checker.rb', line 33 def add_or_modify_entry!(coordinates, remote_sha1) sha1_cache[coordinates] = remote_sha1 save! end |
#all_sha1 ⇒ Object
29 30 31 |
# File 'lib/kpm/sha1_checker.rb', line 29 def all_sha1 sha1_cache end |
#artifact_info(coordinates) ⇒ Object
44 45 46 |
# File 'lib/kpm/sha1_checker.rb', line 44 def artifact_info(coordinates) nexus_cache[coordinates] end |
#cache_artifact_info(coordinates_with_maybe_latest, artifact_info) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/kpm/sha1_checker.rb', line 48 def cache_artifact_info(coordinates_with_maybe_latest, artifact_info) return if artifact_info.nil? if coordinates_with_maybe_latest.end_with?('LATEST') return nil if artifact_info[:version].nil? coordinates = coordinates_with_maybe_latest.gsub(/LATEST$/, artifact_info[:version]) else coordinates = coordinates_with_maybe_latest end # See BaseArtifact#artifact_info nexus_keys = i[sha1 version repository_path is_tgz] nexus_cache[coordinates] = artifact_info.select { |key, _| nexus_keys.include? key } save! end |
#cache_killbill_info(version, dependencies) ⇒ Object
69 70 71 72 |
# File 'lib/kpm/sha1_checker.rb', line 69 def cache_killbill_info(version, dependencies) killbill_cache[version] = dependencies save! end |
#killbill_info(version) ⇒ Object
65 66 67 |
# File 'lib/kpm/sha1_checker.rb', line 65 def killbill_info(version) killbill_cache[version] end |
#remove_entry!(coordinates) ⇒ Object
38 39 40 41 42 |
# File 'lib/kpm/sha1_checker.rb', line 38 def remove_entry!(coordinates) sha1_cache.delete(coordinates) nexus_cache.delete(coordinates) save! end |
#sha1(coordinates) ⇒ Object
25 26 27 |
# File 'lib/kpm/sha1_checker.rb', line 25 def sha1(coordinates) sha1_cache[coordinates] end |