Module: TheLocal::Refresh
- Defined in:
- lib/the_local/refresh.rb
Overview
Re-syncs a host’s locals from its current bundle. Discovers providers by reading their committed agent files from each bundled gem’s path on disk (see DiskProviders) — no gem code is loaded, so a fragile gem can’t crash the install and a provider needs no register/require wiring at install time to contribute. Then gathers the direct and bundled gem names from a Bundler definition and runs a Sync. Both the provider discovery and the definition are injectable so the logic stays testable without a real bundle.
Class Method Summary collapse
- .call(destination:, definition: Bundler.definition, load_providers: -> { DiskProviders.load(registry: TheLocal.registry, specs: specs_from(definition)) }) ⇒ Object
- .specs_from(definition) ⇒ Object
Class Method Details
.call(destination:, definition: Bundler.definition, load_providers: -> { DiskProviders.load(registry: TheLocal.registry, specs: specs_from(definition)) }) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/the_local/refresh.rb', line 12 def self.call(destination:, definition: Bundler.definition, load_providers: -> { DiskProviders.load(registry: TheLocal.registry, specs: specs_from(definition)) }) TheLocal.reset! load_providers.call Sync.new( registry: TheLocal.registry, destination: destination, direct_dependencies: definition.dependencies.map(&:name), bundled_gems: definition.specs.map(&:name) ).call end |
.specs_from(definition) ⇒ Object
24 25 26 |
# File 'lib/the_local/refresh.rb', line 24 def self.specs_from(definition) definition.specs.map { |spec| { name: spec.name, path: spec.full_gem_path } } end |