Class: Clacky::DeployTools::ReportDeployStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/clacky/default_skills/deploy/tools/report_deploy_status.rb

Overview

Report deployment status to user with formatted output

Constant Summary collapse

VALID_STATUSES =
%w[analyzing deploying checking success failed].freeze
STATUS_ICONS =
{
  'analyzing' => '🔍',
  'deploying' => '🚀',
  'checking' => '',
  'success' => '🎉',
  'failed' => ''
}.freeze
STATUS_COLORS =
{
  'analyzing' => :cyan,
  'deploying' => :yellow,
  'checking' => :blue,
  'success' => :green,
  'failed' => :red
}.freeze

Class Method Summary collapse

Class Method Details

.execute(status:, message:) ⇒ Hash

Execute the report_deploy_status command

Parameters:

  • status (String)

    Deployment status (analyzing, deploying, checking, success, failed)

  • message (String)

    Status message to display

Returns:

  • (Hash)

    Result of the report operation



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/clacky/default_skills/deploy/tools/report_deploy_status.rb', line 30

def self.execute(status:, message:)
  unless VALID_STATUSES.include?(status)
    return {
      error: "Invalid status",
      details: "Status must be one of: #{VALID_STATUSES.join(', ')}",
      provided: status
    }
  end

  icon = STATUS_ICONS[status]
  formatted_message = format_message(status, message, icon)
  
  # Output to stdout
  puts formatted_message
  
  {
    success: true,
    status: status,
    message: message,
    timestamp: Time.now.iso8601
  }
end

.format_message(status, message, icon) ⇒ String

Format the status message with icon and styling

Parameters:

  • status (String)

    Deployment status

  • message (String)

    Status message

  • icon (String)

    Emoji icon for status

Returns:

  • (String)

    Formatted message



59
60
61
62
63
64
# File 'lib/clacky/default_skills/deploy/tools/report_deploy_status.rb', line 59

def self.format_message(status, message, icon)
  timestamp = Time.now.strftime("%H:%M:%S")
  status_label = status.upcase.ljust(10)
  
  "#{icon} [#{timestamp}] #{status_label} #{message}"
end