Sha256: 553b5cfc77b88ead016bfd519f627f331724d6a1bc514c7cf67b3f0905019e93

Contents?: true

Size: 1.74 KB

Versions: 11

Compression:

Stored size: 1.74 KB

Contents

# frozen_string_literal: true
module Theme
  module Commands
    class Push < ShopifyCli::Command
      prerequisite_task :ensure_themekit_installed

      options do |parser, flags|
        parser.on("--remove") { flags["remove"] = true }
        parser.on("--nodelete") { flags["nodelete"] = true }
        parser.on("--allow-live") { flags["allow-live"] = true }
        parser.on("--env=ENV") { |env| flags[:env] = env }
      end

      def call(args, _name)
        if options.flags["remove"]
          remove = true
          options.flags.delete("remove")
        end

        if options.flags[:env]
          env = options.flags[:env]
          options.flags.delete(:env)
        end

        flags = Themekit.add_flags(options.flags)

        if remove
          CLI::UI::Frame.open(@ctx.message("theme.push.remove")) do
            unless CLI::UI::Prompt.confirm(@ctx.message("theme.push.remove_confirm"))
              @ctx.abort(@ctx.message("theme.push.remove_abort"))
            end

            unless Themekit.push(@ctx, files: args, flags: flags, remove: remove, env: env)
              @ctx.abort(@ctx.message("theme.push.error.remove_error"))
            end
          end

          @ctx.done(@ctx.message("theme.push.info.remove", @ctx.root))
        else
          CLI::UI::Frame.open(@ctx.message("theme.push.push")) do
            unless Themekit.push(@ctx, files: args, flags: flags, remove: remove, env: env)
              @ctx.abort(@ctx.message("theme.push.error.push_error"))
            end
          end

          @ctx.done(@ctx.message("theme.push.info.push", @ctx.root))
        end
      end

      def self.help
        ShopifyCli::Context.message("theme.push.help", ShopifyCli::TOOL_NAME, ShopifyCli::TOOL_NAME)
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
shopify-cli-1.14.0 lib/project_types/theme/commands/push.rb
shopify-cli-1.13.1 lib/project_types/theme/commands/push.rb
shopify-cli-1.13.0 lib/project_types/theme/commands/push.rb
shopify-cli-1.12.0 lib/project_types/theme/commands/push.rb
shopify-cli-1.11.0 lib/project_types/theme/commands/push.rb
shopify-cli-1.10.0 lib/project_types/theme/commands/push.rb
shopify-cli-1.9.1 lib/project_types/theme/commands/push.rb
shopify-cli-1.9.0 lib/project_types/theme/commands/push.rb
shopify-cli-1.8.0 lib/project_types/theme/commands/push.rb
shopify-cli-1.7.1 lib/project_types/theme/commands/push.rb
shopify-cli-1.7.0 lib/project_types/theme/commands/push.rb