Class: Makit::Rake::RunCommand

Inherits:
Clamp::Command
  • Object
show all
Defined in:
lib/makit/rake/cli.rb

Overview

CLI command for managing rake-related functionality Command to run rake tasks

Instance Method Summary collapse

Instance Method Details

#executeObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/makit/rake/cli.rb', line 19

def execute
  target_path = resolve_target(target)

  signal_usage_error "Target directory does not exist: #{target_path}" unless Dir.exist?(target_path)

  Dir.chdir(target_path) do
    puts "Running rake task '#{task}' in #{target_path}".colorize(:blue)

    # Build rake command with options

    rake_cmd = build_rake_command

    # Execute the command

    result = system(rake_cmd)

    if result
      puts "Rake task '#{task}' completed successfully".colorize(:green)
    else
      puts "Rake task '#{task}' failed".colorize(:red)
      exit(1)
    end
  end
end