Module: Bashly::Script::Introspection::EnvironmentVariables

Included in:
Command
Defined in:
lib/bashly/script/introspection/environment_variables.rb

Instance Method Summary collapse

Instance Method Details

#default_environment_variablesObject

Returns an array of all the Environment Variables with default values



6
7
8
# File 'lib/bashly/script/introspection/environment_variables.rb', line 6

def default_environment_variables
  environment_variables.select(&:default)
end

#environment_variablesObject

Returns an array of EnvironmentVariable objects



11
12
13
14
15
16
17
# File 'lib/bashly/script/introspection/environment_variables.rb', line 11

def environment_variables
  return [] unless options['environment_variables']

  options['environment_variables'].map do |options|
    EnvironmentVariable.new options
  end
end

#public_environment_variablesObject

Returns only environment variables that are not private



20
21
22
# File 'lib/bashly/script/introspection/environment_variables.rb', line 20

def public_environment_variables
  environment_variables.reject(&:private)
end

#required_environment_variablesObject

Returns an array of all the required EnvironmentVariables



25
26
27
# File 'lib/bashly/script/introspection/environment_variables.rb', line 25

def required_environment_variables
  environment_variables.select(&:required)
end

#validated_environment_variablesObject

Returns an array of all the environment_variables with a validation



30
31
32
# File 'lib/bashly/script/introspection/environment_variables.rb', line 30

def validated_environment_variables
  environment_variables.select(&:validate)
end

#visible_environment_variablesObject

Returns only public environment variables, or both public and private environment variables if Settings.private_reveal_key is set



36
37
38
# File 'lib/bashly/script/introspection/environment_variables.rb', line 36

def visible_environment_variables
  Settings.private_reveal_key ? environment_variables : public_environment_variables
end

#whitelisted_environment_variablesObject

Returns an array of all the environment_variables with a whitelist arg



41
42
43
# File 'lib/bashly/script/introspection/environment_variables.rb', line 41

def whitelisted_environment_variables
  environment_variables.select(&:allowed)
end