Class: ShopifyCLI::Tasks::EnsureEnv

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

Instance Method Summary collapse

Instance Method Details

#call(ctx, regenerate: false, required: [:api_key, :secret]) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/shopify_cli/tasks/ensure_env.rb', line 6

def call(ctx, regenerate: false, required: [:api_key, :secret])
  @ctx = ctx
  env_data =
    begin
      Resources::EnvFile.parse_external_env
    rescue Errno::ENOENT
      {}
    end

  return {} if !regenerate && required.all? { |property| env_data[property] }

  org = fetch_org
  write_env(env_data, org)
  org
end