Class: Senren::Rails::HostPaths

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

Overview

Resolves canonical paths inside a host Rails application. Accepts an explicit root for tests; defaults to Rails.root when present.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root = nil) ⇒ HostPaths

Returns a new instance of HostPaths.



10
11
12
# File 'lib/senren/rails/host_paths.rb', line 10

def initialize(root = nil)
  @root = Pathname.new(root || ::Rails.root).expand_path
end

Instance Attribute Details

#rootObject (readonly)

Returns the value of attribute root.



8
9
10
# File 'lib/senren/rails/host_paths.rb', line 8

def root
  @root
end

Instance Method Details

#agent_rules_fileObject



19
# File 'lib/senren/rails/host_paths.rb', line 19

def agent_rules_file      = senren_dir.join('agent-rules.md')

#base_component_pathObject



22
# File 'lib/senren/rails/host_paths.rb', line 22

def base_component_path   = components_dir.join('base_component.rb')

#claude_mdObject



32
# File 'lib/senren/rails/host_paths.rb', line 32

def claude_md             = root.join('CLAUDE.md')

#codex_agents_mdObject



33
# File 'lib/senren/rails/host_paths.rb', line 33

def codex_agents_md       = root.join('AGENTS.md')

#components_dirObject



21
# File 'lib/senren/rails/host_paths.rb', line 21

def components_dir        = root.join('app', 'components', 'senren')

#conventions_fileObject



18
# File 'lib/senren/rails/host_paths.rb', line 18

def conventions_file      = senren_dir.join('conventions.md')

#copilot_instructionsObject



29
# File 'lib/senren/rails/host_paths.rb', line 29

def copilot_instructions  = github_dir.join('copilot-instructions.md')

#cursor_rule_fileObject



31
# File 'lib/senren/rails/host_paths.rb', line 31

def cursor_rule_file      = cursor_rules_dir.join('senren.mdc')

#cursor_rules_dirObject



30
# File 'lib/senren/rails/host_paths.rb', line 30

def cursor_rules_dir      = root.join('.cursor', 'rules')

#ensure_agent_dirs!Object



40
41
42
# File 'lib/senren/rails/host_paths.rb', line 40

def ensure_agent_dirs!
  [senren_dir, github_dir, cursor_rules_dir].each(&:mkpath)
end

#ensure_dirs!Object



35
36
37
38
# File 'lib/senren/rails/host_paths.rb', line 35

def ensure_dirs!
  [senren_dir, components_dir, stimulus_dir,
   stylesheet_path.dirname, github_dir, cursor_rules_dir].each(&:mkpath)
end

#github_dirObject



28
# File 'lib/senren/rails/host_paths.rb', line 28

def github_dir            = root.join('.github')

#installed_componentsObject



17
# File 'lib/senren/rails/host_paths.rb', line 17

def installed_components  = senren_dir.join('installed_components.yml')

#registry_mirrorObject



16
# File 'lib/senren/rails/host_paths.rb', line 16

def registry_mirror       = senren_dir.join('registry.yml')

#senren_dirObject



14
# File 'lib/senren/rails/host_paths.rb', line 14

def senren_dir            = root.join('.senren')

#skill_fileObject



15
# File 'lib/senren/rails/host_paths.rb', line 15

def skill_file            = senren_dir.join('skill.md')

#stimulus_dirObject



26
# File 'lib/senren/rails/host_paths.rb', line 26

def stimulus_dir          = root.join('app', 'javascript', 'controllers', 'senren')

#stylesheet_pathObject



24
# File 'lib/senren/rails/host_paths.rb', line 24

def stylesheet_path       = root.join('app', 'assets', 'stylesheets', 'senren.css')