Remove redundant env replacement
This commit is contained in:
@@ -42,11 +42,6 @@ module Kamal::Cli
|
|||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def reload_env
|
|
||||||
reset_env
|
|
||||||
load_env
|
|
||||||
end
|
|
||||||
|
|
||||||
def load_env
|
def load_env
|
||||||
if destination = options[:destination]
|
if destination = options[:destination]
|
||||||
if File.exist?(".kamal/.env.#{destination}") || File.exist?(".kamal/.env")
|
if File.exist?(".kamal/.env.#{destination}") || File.exist?(".kamal/.env")
|
||||||
@@ -69,29 +64,6 @@ module Kamal::Cli
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def reset_env
|
|
||||||
replace_env @original_env
|
|
||||||
end
|
|
||||||
|
|
||||||
def replace_env(env)
|
|
||||||
ENV.clear
|
|
||||||
ENV.update(env)
|
|
||||||
end
|
|
||||||
|
|
||||||
def with_original_env
|
|
||||||
keeping_current_env do
|
|
||||||
reset_env
|
|
||||||
yield
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def keeping_current_env
|
|
||||||
current_env = ENV.to_h.dup
|
|
||||||
yield
|
|
||||||
ensure
|
|
||||||
replace_env(current_env)
|
|
||||||
end
|
|
||||||
|
|
||||||
def options_with_subcommand_class_options
|
def options_with_subcommand_class_options
|
||||||
options.merge(@_initializer.last[:class_options] || {})
|
options.merge(@_initializer.last[:class_options] || {})
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user