Method: Jets::CLI#set_jets_env_from_cli_arg!

Defined in:
lib/jets/cli.rb

#set_jets_env_from_cli_arg!Object

Adjust JETS_ENV before boot_jets is called for the ‘jets deploy` command. Must do this early in the process before Jets.boot because because `bundler_require` is called as part of the bootup process. It sets the Jets.env to whatever the JETS_ENV is at the time to require the right bundler group.

Defaults to development when not set.



62
63
64
65
66
67
68
69
70
# File 'lib/jets/cli.rb', line 62

def set_jets_env_from_cli_arg!
  # Pretty tricky, we need to use the raw @given_args as thor_args eventually calls Commands::Base#eager_load!
  # which uses Jets.env before we get a chance to override ENV['JETS_ENV']
  command, env = @given_args[0..1]
  return unless %w[deploy delete].include?(command)
  env = nil if env&.starts_with?('-')
  return unless env
  ENV['JETS_ENV'] = env ? env : 'development'
end