Sha256: fd518f3c515d781d326fae1bdf31131f10677645685cc4cb07446013a4de7906
Contents?: true
Size: 1.12 KB
Versions: 16
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.to_s 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
16 entries across 16 versions & 1 rubygems