Sha256: ab9cb366dfd443c482f243d817ba440215a4f81a20bc6ed6c27af7125369a02e

Contents?: true

Size: 1.04 KB

Versions: 8

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

require "shopify_cli"

module Rails
  class Command
    class Tunnel < ShopifyCLI::SubCommand
      # subcommands :auth, :start, :stop

      prerequisite_task ensure_project_type: :rails

      def call(args, _name)
        subcommand = args.shift
        case subcommand
        when "auth"
          token = args.shift
          if token.nil?
            @ctx.puts(@ctx.message("rails.tunnel.error.token_argument_missing"))
            @ctx.puts("#{self.class.help}\n#{self.class.extended_help}")
          else
            ShopifyCLI::Tunnel.auth(@ctx, token)
          end
        when "start"
          ShopifyCLI::Tunnel.start(@ctx)
        when "stop"
          ShopifyCLI::Tunnel.stop(@ctx)
        else
          @ctx.puts(self.class.help)
        end
      end

      def self.help
        ShopifyCLI::Context.message("rails.tunnel.help", ShopifyCLI::TOOL_NAME)
      end

      def self.extended_help
        ShopifyCLI::Context.message("rails.tunnel.extended_help", ShopifyCLI::TOOL_NAME)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
shopify-cli-2.6.6 lib/project_types/rails/commands/tunnel.rb
shopify-cli-2.6.5 lib/project_types/rails/commands/tunnel.rb
shopify-cli-2.6.4 lib/project_types/rails/commands/tunnel.rb
shopify-cli-2.6.3 lib/project_types/rails/commands/tunnel.rb
shopify-cli-2.6.2 lib/project_types/rails/commands/tunnel.rb
shopify-cli-2.6.1 lib/project_types/rails/commands/tunnel.rb
shopify-cli-2.6.0 lib/project_types/rails/commands/tunnel.rb
shopify-cli-2.5.0 lib/project_types/rails/commands/tunnel.rb