Class: ShopifyCLI::Tasks::EnsureAuthenticated

Inherits:
ShopifyCLI::Task show all
Defined in:
lib/shopify_cli/tasks/ensure_authenticated.rb

Instance Method Summary collapse

Instance Method Details

#call(ctx) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/shopify_cli/tasks/ensure_authenticated.rb', line 6

def call(ctx)
  return if ShopifyCLI::Environment.acceptance_test?
  unless ShopifyCLI::IdentityAuth.authenticated?
    raise ShopifyCLI::Abort,
      ctx.message("core.identity_auth.login_prompt", ShopifyCLI::TOOL_NAME)
  end
  if ShopifyCLI::IdentityAuth.environment_auth_token?
    ctx.puts(ctx.message("core.identity_auth.token_authentication",
      ShopifyCLI::Constants::EnvironmentVariables::AUTH_TOKEN))
  end
end