Class: Gemkeeper::CLI::Commands::Manifest::Generate

Inherits:
Dry::CLI::Command
  • Object
show all
Defined in:
lib/gemkeeper/cli/commands/manifest/generate.rb

Instance Method Summary collapse

Instance Method Details

#call(lockfile_path:, **options) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/gemkeeper/cli/commands/manifest/generate.rb', line 17

def call(lockfile_path:, **options)
  path = manifest_path(options)
  manifest = ManifestReader.load(path)
  manifest.clear! if options[:force]
  result = ManifestBuilder.build(lockfile_path:, manifest:)

  if result.empty?
    puts "No internal gem sources found in #{lockfile_path}"
    return
  end

  if result.any_changes?
    manifest.save(path)
    puts "Wrote #{path}"
  end

  print_summary(result, result.any_changes? ? nil : "Manifest up to date, no changes")
rescue UnresolvableGemError, ManifestConflictError => error
  warn "Error: #{error.message}"
  exit 1
end