Module: PuppetfileResolver::SpecSearchers::Git

Defined in:
lib/puppetfile-resolver/spec_searchers/git.rb,
lib/puppetfile-resolver/spec_searchers/git/gclone.rb,
lib/puppetfile-resolver/spec_searchers/git/github.rb,
lib/puppetfile-resolver/spec_searchers/git/gitlab.rb

Defined Under Namespace

Modules: GClone, GitHub, GitLab

Class Method Summary collapse

Class Method Details

.find_all(puppetfile_module, dependency, cache, resolver_ui, config) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/puppetfile-resolver/spec_searchers/git.rb', line 13

def self.find_all(puppetfile_module, dependency, cache, resolver_ui, config)
  dep_id = ::PuppetfileResolver::SpecSearchers::Common.dependency_cache_id(self, dependency)
  # Has the information been cached?
  return cache.load(dep_id) if cache.exist?(dep_id)

  # The git clone method takes around (1s) depending on repo size.  Not sure if the
  # other methods take longer or shorter but I preserved the legacy code for now.
  # Technically, the gclone class could replace the other classes and speed up
  # this process here.
   = GitHub.(puppetfile_module, resolver_ui, config) ||
             GitLab.(puppetfile_module, resolver_ui, config) ||
             GClone.(puppetfile_module, resolver_ui, config)

  if .nil? || .empty?
    # Cache that we couldn't find the metadata
    cache.save(dep_id, [])
    return []
  end

   = ::PuppetfileResolver::Util.symbolise_object(::JSON.parse())
  result = [Models::ModuleSpecification.new(
    name: [:name],
    origin: :git,
    version: [:version],
    metadata: 
  )]

  cache.save(dep_id, result)

  result
end