Class: LcpRuby::SkillsInstaller
- Inherits:
-
Object
- Object
- LcpRuby::SkillsInstaller
- Defined in:
- lib/lcp_ruby/skills_installer.rb
Overview
Installs (copies/refreshes) the gem-bundled ‘lcp-*` Claude Code skills into a target `.claude/skills/` directory. Rails-free.
Refresh is an exact mirror of the gem’s ‘lcp-*` set: each shipped skill dir is replaced wholesale, orphaned `lcp-*` dirs are pruned (when `prune: true`), and non-`lcp-*` skills are NEVER touched. The installer does no I/O logging —the caller (CLI prints, generator maps to Thor `say`) reports from Result.
Defined Under Namespace
Classes: Result
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(target:, source: LcpRuby::GemPaths.skills, prune: true) ⇒ SkillsInstaller
constructor
A new instance of SkillsInstaller.
Constructor Details
#initialize(target:, source: LcpRuby::GemPaths.skills, prune: true) ⇒ SkillsInstaller
Returns a new instance of SkillsInstaller.
21 22 23 24 25 |
# File 'lib/lcp_ruby/skills_installer.rb', line 21 def initialize(target:, source: LcpRuby::GemPaths.skills, prune: true) @target = target @source = source @prune = prune end |
Instance Method Details
#call ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/lcp_ruby/skills_installer.rb', line 27 def call created = [] updated = [] removed = [] FileUtils.mkdir_p(@target) shipped = source_skill_names shipped.each do |name| dest = File.join(@target, name) existed = Dir.exist?(dest) FileUtils.rm_rf(dest) FileUtils.cp_r(File.join(@source, name), dest) (existed ? updated : created) << name end if @prune target_skill_names.each do |name| next if shipped.include?(name) FileUtils.rm_rf(File.join(@target, name)) removed << name end end Result.new(created: created.sort, updated: updated.sort, removed: removed.sort) end |