Class: Gemkeeper::ConfigGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/gemkeeper/config_generator.rb

Overview

Isolates merge/build logic from CLI commands so setup-adjacent features share a single path.

Instance Method Summary collapse

Constructor Details

#initialize(manifest:, lockfile_versions:) ⇒ ConfigGenerator

Returns a new instance of ConfigGenerator.



8
9
10
11
# File 'lib/gemkeeper/config_generator.rb', line 8

def initialize(manifest:, lockfile_versions:)
  @manifest = manifest
  @lockfile_versions = lockfile_versions
end

Instance Method Details

#build(output_path, force:, global_output_path: nil) ⇒ Object



13
14
15
16
17
18
# File 'lib/gemkeeper/config_generator.rb', line 13

def build(output_path, force:, global_output_path: nil)
  existing = force ? {} : (load_existing(output_path) || {})
  matched = matched_gems

  existing.empty? ? build_fresh(matched, global_output_path:) : merge(existing, matched)
end