Method: Env.initialize

Defined in:
lib/autosparkle/environment/environment.rb

.initialize(options, command) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/autosparkle/environment/environment.rb', line 27

def initialize(options, command)
  project_path = options.project_path
  workspace_path = options.workspace_path

  project_directory_path = File.dirname(workspace_path || project_path) if workspace_path || project_path
  ENV['PROJECT_DIRECTORY_PATH'] = project_directory_path

  load_environment(project_directory_path, options.env)

  @variables = DefaultEnvironmentVariables.new

  case command
  when Command::EXPORT
    initialize_export(options)
  when Command::PACKAGE
    initialize_package(options)
  when Command::DISTRIBUTE
    initialize_distribute(options)
  when Command::AUTOMATE
    initialize_automate(options)
  end

  puts_if_verbose "Running the script with the #{options.env} environment...\n"
end