Sha256: 7ca03274b97cd2b34e91d8c353168ec10bda83ec252bb30ec43be39f6e3aadd4
Contents?: true
Size: 1.12 KB
Versions: 11
Compression:
Stored size: 1.12 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, 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 as_message_with(status: :synced) end def as_fix_message as_message_with(status: :fixed) end def file_path file&.relative_path end private def as_message_with(status:) status_color = COLOR_BY_STATUS[status] status_text = @ctx.message("theme.serve.operation.status.#{status}").ljust(6) "#{timestamp} {{#{status_color}:#{status_text}}} {{>}} {{blue:#{self}}}" end def timestamp Time.now.strftime("%T") end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems