Class: Gemkeeper::CLI::Commands::Setup

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

Instance Method Summary collapse

Instance Method Details

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



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/gemkeeper/cli/commands/setup.rb', line 19

def call(lockfile_path:, **options)
  manifest_path = options[:manifest] || ManifestReader::DEFAULT_PATH
  output_path = options[:config] || File.join(Dir.pwd, Configuration::DEFAULT_CONFIG_FILENAME)

  manifest = ManifestReader.load(manifest_path)
  lockfile_versions = LockfileParser.parse(lockfile_path)

  matched = match_gems(manifest, lockfile_versions)

  write_config(matched, output_path, force: options[:force])
  print_bundler_instructions(output_path, manifest)
rescue ManifestNotFoundError => e
  warn "Error: #{e.message}"
  exit 1
end