Class: SourceMonitor::Setup::Workflow

Inherits:
Object
  • Object
show all
Defined in:
lib/source_monitor/setup/workflow.rb

Defined Under Namespace

Classes: RequirementError

Constant Summary collapse

DEFAULT_MOUNT_PATH =
"/source_monitor".freeze

Instance Method Summary collapse

Constructor Details

#initialize(dependency_checker: DependencyChecker.new, prompter: Prompter.new, gemfile_editor: GemfileEditor.new, bundle_installer: BundleInstaller.new, node_installer: NodeInstaller.new, install_generator: InstallGenerator.new, migration_installer: MigrationInstaller.new, initializer_patcher: InitializerPatcher.new, procfile_patcher: ProcfilePatcher.new, queue_config_patcher: QueueConfigPatcher.new, devise_detector: method(:default_devise_detector), verifier: Verification::Runner.new, skills_installer: SkillsInstaller.new) ⇒ Workflow

Returns a new instance of Workflow.



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/source_monitor/setup/workflow.rb', line 31

def initialize(
  dependency_checker: DependencyChecker.new,
  prompter: Prompter.new,
  gemfile_editor: GemfileEditor.new,
  bundle_installer: BundleInstaller.new,
  node_installer: NodeInstaller.new,
  install_generator: InstallGenerator.new,
  migration_installer: MigrationInstaller.new,
  initializer_patcher: InitializerPatcher.new,
  procfile_patcher: ProcfilePatcher.new,
  queue_config_patcher: QueueConfigPatcher.new,
  devise_detector: method(:default_devise_detector),
  verifier: Verification::Runner.new,
  skills_installer: SkillsInstaller.new
)
  @dependency_checker = dependency_checker
  @prompter = prompter
  @gemfile_editor = gemfile_editor
  @bundle_installer = bundle_installer
  @node_installer = node_installer
  @install_generator = install_generator
  @migration_installer = migration_installer
  @initializer_patcher = initializer_patcher
  @procfile_patcher = procfile_patcher
  @queue_config_patcher = queue_config_patcher
  @devise_detector = devise_detector
  @verifier = verifier
  @skills_installer = skills_installer
end

Instance Method Details

#runObject

Raises:



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/source_monitor/setup/workflow.rb', line 61

def run
  summary = dependency_checker.call
  raise RequirementError, summary if summary.errors?

  mount_path = prompter.ask("Mount SourceMonitor at which path?", default: DEFAULT_MOUNT_PATH)

  gemfile_editor.ensure_entry
  bundle_installer.install
  node_installer.install_if_needed
  install_generator.run(mount_path: mount_path)
  migration_installer.install
  initializer_patcher.ensure_navigation_hint(mount_path: mount_path)
  procfile_patcher.patch
  queue_config_patcher.patch

  if devise_available? && prompter.yes?("Wire Devise authentication hooks into SourceMonitor?", default: true)
    initializer_patcher.ensure_devise_hooks
  end

  verifier.call

  if prompter.yes?("Install Claude Code skills for using SourceMonitor?", default: true)
    skills_installer.install(target_dir: skills_target_dir, group: :consumer)
    if prompter.yes?("Also install contributor skills for engine development?", default: false)
      skills_installer.install(target_dir: skills_target_dir, group: :contributor)
    end
  end
end