Class: Senren::Rails::Installer

Inherits:
Object
  • Object
show all
Defined in:
lib/senren/rails/installer.rb

Overview

Idempotent installer that lays down the .senren directory, base component, stylesheet, and initial llms files. Reused by the install generator and by ad-hoc rake task entry points.

Constant Summary collapse

INSTALL_GENERATOR_TEMPLATES =
File.expand_path(
  '../../generators/senren/install/templates', __dir__
).freeze
STATIC_FILES =
{
  'conventions.md.tt' => :conventions_file,
  'installed_components.yml.tt' => :installed_components,
  'base_component.rb.tt' => :base_component_path,
  'senren.css.tt' => :stylesheet_path
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(paths: HostPaths.new, stdout: $stdout) ⇒ Installer

Returns a new instance of Installer.



13
14
15
16
# File 'lib/senren/rails/installer.rb', line 13

def initialize(paths: HostPaths.new, stdout: $stdout)
  @paths  = paths
  @stdout = stdout
end

Instance Attribute Details

#pathsObject (readonly)

Returns the value of attribute paths.



11
12
13
# File 'lib/senren/rails/installer.rb', line 11

def paths
  @paths
end

#stdoutObject (readonly)

Returns the value of attribute stdout.



11
12
13
# File 'lib/senren/rails/installer.rb', line 11

def stdout
  @stdout
end

Instance Method Details

#run!(force: false) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/senren/rails/installer.rb', line 18

def run!(force: false)
  paths.ensure_dirs!
  install_static_files(force: force)
  mirror_registry
  SkillWriter.new(paths: paths).sync!
  LlmsWriter.new(paths: paths).generate!
  print_next_steps
  true
end