Module: Pult::Executor::Enver
- Included in:
- Pult::Executor
- Defined in:
- lib/init/struct.rb,
lib/pult/executor/enver.rb
Constant Summary collapse
- CURRENT =
ENV.to_h
- ENVS =
ENV['PULT_ENV_DEFAULT'] || ENV['PULT_ENV_BASE']
- ENV_BASE =
!!ENV['PULT_ENV_BASE']
- DEFAULT_VARS =
ENVS&.split(/=.+?"?\n/)
- DEFAULT =
DEFAULT_VARS ? CURRENT.select{|k, v| DEFAULT_VARS.include?(k) } : CURRENT
- RESOLVER =
{ default: DEFAULT, current: CURRENT }
Instance Method Summary collapse
Instance Method Details
#with_env(resolver_or_env) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/pult/executor/enver.rb', line 19 def with_env resolver_or_env env = RESOLVER[resolver_or_env] || resolver_or_env if env.is_a?(Hash) ENV_BASE ? env_set!(env) : env_set(env) yield env_set!(CURRENT) else raise ArgumentError, 'Env not resolved' end end |