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::SKILLS_DIR, InstallLayout::HYPERDRIVE_DIR, InstallLayout::LOCK_PATH].freeze
WARN_LINES =
150
WARN_TOKENS =
1_500
MODES =
%i[preserve overwrite additive].freeze

Instance Method Summary collapse

Constructor Details

#initialize(root:, shell:, artifacts:, mode: :preserve, warnings: []) ⇒ InstallPipeline

Returns a new instance of InstallPipeline.

Raises:

  • (ArgumentError)


27
28
29
30
31
32
33
34
35
36
# File 'lib/rails/hyperdrive/install_pipeline.rb', line 27

def initialize(root:, shell:, artifacts:, mode: :preserve, warnings: [])
  raise ArgumentError, "unknown mode #{mode.inspect}" unless MODES.include?(mode)

  @root = File.expand_path(root.to_s)
  @shell = shell
  @artifacts = artifacts
  @mode = mode
  @warnings = warnings
  @result = Result.new(installed: [], updated: [], unchanged: [], skipped: [], orphaned: [], removed: [])
end

Instance Method Details

#callObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/rails/hyperdrive/install_pipeline.rb', line 38

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

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

#lockObject



62
63
64
# File 'lib/rails/hyperdrive/install_pipeline.rb', line 62

def lock
  @new_lock
end

#planObject



58
59
60
# File 'lib/rails/hyperdrive/install_pipeline.rb', line 58

def plan
  build_result.entries
end