Class: Dotenvious::CLI::EnvFileConsolidator

Inherits:
Object
  • Object
show all
Defined in:
lib/dotenvious/cli/env_file_consolidator.rb

Instance Method Summary collapse

Constructor Details

#initialize(example_file: DEFAULT_EXAMPLE_ENV_FILE, env_file: DEFAULT_ENV_FILE) ⇒ EnvFileConsolidator

Returns a new instance of EnvFileConsolidator.



9
10
11
12
# File 'lib/dotenvious/cli/env_file_consolidator.rb', line 9

def initialize(example_file: DEFAULT_EXAMPLE_ENV_FILE, env_file: DEFAULT_ENV_FILE)
  @example_file = example_file
  @env_file = env_file
end

Instance Method Details

#runObject



14
15
16
17
18
19
20
21
22
# File 'lib/dotenvious/cli/env_file_consolidator.rb', line 14

def run
  Loaders::Configuration.new.load
  Loaders::Environments.new({example_file: example_file, env_file: env_file}).load_environments
  unless all_vars_present? && all_vars_match?
    alert_user
    decision = STDIN.gets.strip
    Prompter.new(env_file).run if decision.downcase == 'y'
  end
end