Method: Fastlane::Actions::EnvironmentVariableAction.run

Defined in:
fastlane/lib/fastlane/actions/environment_variable.rb

.run(params) ⇒ Object


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'fastlane/lib/fastlane/actions/environment_variable.rb', line 4

def self.run(params)
  values_to_set = params[:set]
  value_to_get = params[:get]
  value_to_remove = params[:remove]

  # clear out variables that were removed
  ENV[value_to_remove] = nil unless value_to_remove.nil?

  # if we have to set variables, do that now
  unless values_to_set.nil?
    values_to_set.each do |key, value|
      ENV[key] = value
    end
  end

  # finally, get the variable we requested
  return ENV[value_to_get] unless value_to_get.nil?

  # if no variable is requested, just return empty string
  return ""
end