Class: ClaudeCodeSlashCommands::Installer
- Inherits:
-
Object
- Object
- ClaudeCodeSlashCommands::Installer
- Defined in:
- lib/claude_code_slash_commands/installer.rb
Instance Method Summary collapse
-
#initialize(commands_source: nil, commands_target: nil, repo: nil, local: false) ⇒ Installer
constructor
A new instance of Installer.
- #install ⇒ Object
Constructor Details
#initialize(commands_source: nil, commands_target: nil, repo: nil, local: false) ⇒ Installer
Returns a new instance of Installer.
11 12 13 14 15 16 17 |
# File 'lib/claude_code_slash_commands/installer.rb', line 11 def initialize(commands_source: nil, commands_target: nil, repo: nil, local: false) @gem_root = Pathname.new(__dir__).parent.parent @commands_source = commands_source || @gem_root.join("commands") @commands_target = commands_target || Pathname.new(Dir.home).join(".claude", "commands") @repo = repo || "andyw8/claude_code_slash_commands" @local = local end |
Instance Method Details
#install ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/claude_code_slash_commands/installer.rb', line 19 def install ensure_target_directory if @local commands = fetch_commands_from_local if commands.empty? puts "❌ No command files found in local commands/ directory" return end commands.each do |command_file| install_command_from_local(command_file) end else commands = fetch_commands_from_github if commands.empty? puts "❌ No command files found to install" return end commands.each do |command| install_command_from_github(command) end end puts "✅ Installation complete!" rescue => e puts "❌ Installation failed: #{e.}" exit(1) end |