Class: Quo::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/quo/install/install_generator.rb

Overview

Installs the bundled Claude Code skill into the host application's .claude/skills/quo/ directory. Optionally appends a short "Quo" section to the project's top-level CLAUDE.md.

Constant Summary collapse

CLAUDE_MD_MARKER =
"## Quo"
CLAUDE_MD_FRAGMENT =
<<~MD
  #{CLAUDE_MD_MARKER}

  This project uses the [Quo gem](https://github.com/stevegeek/quo) for
  query objects. See `.claude/skills/quo/SKILL.md` for usage guidance,
  including the class-vs-instance composition rules.
MD

Instance Method Summary collapse

Instance Method Details

#copy_skillObject



31
32
33
# File 'lib/generators/quo/install/install_generator.rb', line 31

def copy_skill
  directory ".", ".claude/skills/quo"
end

#maybe_append_claude_mdObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/generators/quo/install/install_generator.rb', line 35

def maybe_append_claude_md
  return unless options[:with_claude_md]

  path = "CLAUDE.md"
  full_path = File.join(destination_root, path)
  if File.exist?(full_path)
    if File.read(full_path).include?(CLAUDE_MD_MARKER)
      say_status :skip, "#{path} already contains '#{CLAUDE_MD_MARKER}' section", :yellow
    else
      append_to_file path, "\n#{CLAUDE_MD_FRAGMENT}"
    end
  else
    create_file path, CLAUDE_MD_FRAGMENT
  end
end

#show_post_install_messageObject



51
52
53
54
55
56
57
58
59
60
# File 'lib/generators/quo/install/install_generator.rb', line 51

def show_post_install_message
  say ""
  say "Quo skill installed at .claude/skills/quo/", :green
  say "Claude Code will pick it up automatically on the next session.", :green
  if options[:with_claude_md]
    say "CLAUDE.md updated with a pointer to the skill.", :green
  end
  say ""
  say "Run with --force after upgrading Quo to refresh the skill content."
end