Class: TheLocal::Sync

Inherits:
Object
  • Object
show all
Defined in:
lib/the_local/sync.rb

Overview

Orchestrates a full sync: resolves which gems are in scope (direct deps + the app), writes their agents, and writes the delegation trigger. Plain Ruby so both the install generator and the refresh rake task share one path. Returns the allowed gem names (for reporting).

Instance Method Summary collapse

Constructor Details

#initialize(registry:, destination:, direct_dependencies:, bundled_gems:) ⇒ Sync

Returns a new instance of Sync.



9
10
11
12
13
14
# File 'lib/the_local/sync.rb', line 9

def initialize(registry:, destination:, direct_dependencies:, bundled_gems:)
  @registry = registry
  @destination = destination
  @direct_dependencies = direct_dependencies
  @bundled_gems = bundled_gems
end

Instance Method Details

#callObject



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/the_local/sync.rb', line 16

def call
  allowed = Scope.allowed_gems(
    provider_gem_names: @registry.providers.map(&:gem_name),
    direct_dependencies: @direct_dependencies,
    bundled_gems: @bundled_gems
  )
  Installer.new(registry: @registry, destination: @destination, allowed_gems: allowed).call
  TriggerWriter.new(registry: @registry, destination: @destination, allowed_gems: allowed).call
  ProcessDocWriter.new(destination: @destination).call
  allowed
end