Class: Rails::Hyperdrive::InstallPipeline

Inherits:
Object
  • Object
show all
Defined in:
lib/rails/hyperdrive/install_pipeline.rb

Overview

The application root is explicit and no Rails constant is touched, so any process that can see the bundle can run this.

Defined Under Namespace

Classes: Result

Constant Summary collapse

ARTIFACT_DESTINATIONS =
(InstallLayout.dest_roots + [InstallLayout::LOCK_PATH]).freeze
WARN_LINES =
150
WARN_TOKENS =
1_500
MODES =
%i[preserve overwrite additive sidecar merge].freeze

Instance Method Summary collapse

Constructor Details

#initialize(root:, shell:, artifacts:, mode: :preserve, report: BundlerArtifactDiscovery::Report.new) ⇒ InstallPipeline

Returns a new instance of InstallPipeline.

Raises:

  • (ArgumentError)


29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/rails/hyperdrive/install_pipeline.rb', line 29

def initialize(root:, shell:, artifacts:, mode: :preserve, report: BundlerArtifactDiscovery::Report.new)
  raise ArgumentError, "unknown mode #{mode.inspect}" unless MODES.include?(mode)

  @root = File.expand_path(root.to_s)
  @shell = shell
  @artifacts = artifacts
  @mode = mode
  @report = report
  @bundled_gems = Array(report.bundled_gems).map(&:to_s)
  @skipped_gems = Array(report.skipped_gems).map(&:to_s)
  @result = Result.new(
    installed: [], updated: [], unchanged: [], skipped: [], orphaned: [], removed: [], merged: [], sidecars: []
  )
end

Instance Method Details

#callObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/rails/hyperdrive/install_pipeline.rb', line 44

def call
  return halt_schema_ahead if old_lock.schema_ahead?

  @new_lock = LockFile.new(abs(InstallLayout::LOCK_PATH)).carry_settings(old_lock)
  @plan = plan

  report_collisions
  report_disabled
  guidelines = install_artifacts
  remove_disabled
  remove_stale_support_files
  remove_stale_dests
  carry_orphans
  eager_guidelines = write_index_md(guidelines)
  write_claude_md(guidelines)
  write_lock
  print_warnings
  print_notices
  print_footprint(guidelines: eager_guidelines)
  warn_if_destinations_gitignored
  @result
end

#lockObject



71
72
73
# File 'lib/rails/hyperdrive/install_pipeline.rb', line 71

def lock
  @new_lock
end

#planObject



67
68
69
# File 'lib/rails/hyperdrive/install_pipeline.rb', line 67

def plan
  build_result.entries
end