lib/spandx/java/index.rb in spandx-0.12.3 vs lib/spandx/java/index.rb in spandx-0.13.0
- old
+ new
@@ -11,16 +11,19 @@
def initialize(directory:, source: 'https://repo.maven.apache.org/maven2')
@directory = directory
@source = source
@name = 'maven'
+ @cache = ::Spandx::Core::Cache.new(@name, root: directory)
end
def update!(catalogue:, output:)
each do |metadata|
- name = "#{metadata.group_id}:#{metadata.artifact_id}:#{metadata.version}"
- output.puts [name, metadata.licenses_from(catalogue)].inspect
+ name = "#{metadata.group_id}:#{metadata.artifact_id}"
+ output.puts [name, metadata.version, metadata.licenses_from(catalogue)].inspect
+ @cache.insert(name, metadata.version, metadata.licenses_from(catalogue))
end
+ @cache.rebuild_index
end
def each
each_index_url do |url|
each_record_from("#{source}/.index/#{url}") do |record|