Sha256: 79d58a7147495e5bb318ab8ffca0eb18b25a453ec4ee7619fae5c5b294e0ec12

Contents?: true

Size: 1.9 KB

Versions: 575

Compression:

Stored size: 1.9 KB

Contents

module Fastlane
  module Actions
    class EnvironmentVariableAction < Action
      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

      def self.author
        "taquitos"
      end

      def self.available_options
        [
          FastlaneCore::ConfigItem.new(
            key: :set,
            env_name: 'FL_ENVIRONMENT_VARIABLE_SET',
            description: 'Set the environment variables named',
            optional: true,
            type: Hash
          ),
          FastlaneCore::ConfigItem.new(
            key: :get,
            env_name: 'FL_ENVIRONMENT_VARIABLE_GET',
            description: 'Get the environment variable named',
            optional: true,
            is_string: true
          ),
          FastlaneCore::ConfigItem.new(
            key: :remove,
            env_name: 'FL_ENVIRONMENT_VARIABLE_REMOVE',
            description: 'Remove the environment variable named',
            optional: true,
            is_string: true
          )
        ]
      end

      def self.description
        "Sets/gets env vars for Fastlane.swift. Don't use in ruby, use `ENV[key] = val`"
      end

      def self.step_text
        nil
      end

      def self.category
        :misc
      end

      def self.return_type
        :string
      end

      def self.is_supported?(platform)
        true
      end
    end
  end
end

Version data entries

575 entries across 575 versions & 2 rubygems

Version Path
fastlane-2.130.0.beta.20190828200015 fastlane/lib/fastlane/actions/environment_variable.rb
fastlane-2.130.0.beta.20190827200051 fastlane/lib/fastlane/actions/environment_variable.rb
fastlane-2.130.0.beta.20190826200016 fastlane/lib/fastlane/actions/environment_variable.rb
fastlane-2.130.0.beta.20190825200030 fastlane/lib/fastlane/actions/environment_variable.rb
fastlane-2.130.0.beta.20190824200021 fastlane/lib/fastlane/actions/environment_variable.rb
fastlane-2.130.0.beta.20190823200017 fastlane/lib/fastlane/actions/environment_variable.rb
fastlane-2.130.0.beta.20190822200101 fastlane/lib/fastlane/actions/environment_variable.rb
fastlane-2.130.0.beta.20190821200034 fastlane/lib/fastlane/actions/environment_variable.rb
fastlane-2.130.0.beta.20190820200024 fastlane/lib/fastlane/actions/environment_variable.rb
fastlane-2.130.0.beta.20190819200109 fastlane/lib/fastlane/actions/environment_variable.rb
fastlane-2.130.0.beta.20190818200034 fastlane/lib/fastlane/actions/environment_variable.rb
fastlane-2.130.0.beta.20190817200018 fastlane/lib/fastlane/actions/environment_variable.rb
fastlane-2.130.0.beta.20190816200015 fastlane/lib/fastlane/actions/environment_variable.rb
fastlane-2.130.0.beta.20190815200057 fastlane/lib/fastlane/actions/environment_variable.rb
fastlane-2.130.0.beta.20190814200010 fastlane/lib/fastlane/actions/environment_variable.rb
fastlane-2.129.0 fastlane/lib/fastlane/actions/environment_variable.rb
fastlane-2.129.0.beta.20190813200016 fastlane/lib/fastlane/actions/environment_variable.rb
fastlane-2.129.0.beta.20190811200106 fastlane/lib/fastlane/actions/environment_variable.rb
fastlane-2.129.0.beta.20190810200059 fastlane/lib/fastlane/actions/environment_variable.rb
fastlane-2.129.0.beta.20190809200051 fastlane/lib/fastlane/actions/environment_variable.rb