Sha256: 05dd822f18a4a6116a2ba800c28e6383b3101df97c1aeaed4b94e2706c7a8cb3
Contents?: true
Size: 1.16 KB
Versions: 20
Compression:
Stored size: 1.16 KB
Contents
# frozen_string_literal: true module ShopifyCLI module Theme class Syncer class Operation attr_accessor :method, :file COLOR_BY_STATUS = { error: :red, synced: :green, warning: :yellow, fixed: :cyan, } def initialize(ctx, method, file) @ctx = ctx @method = method @file = file end def to_s "#{method} #{file_path}" end def as_error_message as_message_with(status: :error) end def as_synced_message(color: :green) as_message_with(status: :synced, color: color) end def as_fix_message as_message_with(status: :fixed) end def file_path file&.relative_path end private def as_message_with(status:, color: nil) color ||= COLOR_BY_STATUS[status] text = @ctx.message("theme.serve.operation.status.#{status}").ljust(6) "#{timestamp} {{#{color}:#{text}}} {{>}} {{blue:#{self}}}" end def timestamp Time.now.strftime("%T") end end end end end
Version data entries
20 entries across 20 versions & 1 rubygems