Sha256: 7650b25f492b345930ae070df75b9bd93d1d1b2cb717d59572d0c4ffd9c4181e

Contents?: true

Size: 1.53 KB

Versions: 86

Compression:

Stored size: 1.53 KB

Contents

module Fastlane
  module Actions
    class EnsureEnvVarsAction < Action
      def self.run(params)
        variables = params[:env_vars]

        variables.each do |variable|
          next unless ENV[variable].to_s.strip.empty?

          UI.user_error!("Missing environment variable '#{variable}'")
        end

        is_one = variables.length == 1

        UI.success("Environment variable#{is_one ? '' : 's'} '#{variables.join('\', \'')}' #{is_one ? 'is' : 'are'} set!")
      end

      def self.description
        'Raises an exception if the specified env vars are not set'
      end

      def self.details
        'This action will check if some environment variables are set.'
      end

      def self.available_options
        [
          FastlaneCore::ConfigItem.new(key: :env_vars,
                                       description: 'The environment variables names that should be checked',
                                       type: Array,
                                       verify_block: proc do |value|
                                         UI.user_error!('Specify at least one environment variable name') if value.empty?
                                       end)
        ]
      end

      def self.authors
        ['revolter']
      end

      def self.example_code
        [
          'ensure_env_vars(
            env_vars: [\'GITHUB_USER_NAME\', \'GITHUB_API_TOKEN\']
          )'
        ]
      end

      def self.category
        :misc
      end

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

Version data entries

86 entries across 86 versions & 1 rubygems

Version Path
fastlane-2.151.1 fastlane/lib/fastlane/actions/ensure_env_vars.rb
fastlane-2.151.0 fastlane/lib/fastlane/actions/ensure_env_vars.rb
fastlane-2.150.3 fastlane/lib/fastlane/actions/ensure_env_vars.rb
fastlane-2.150.2 fastlane/lib/fastlane/actions/ensure_env_vars.rb
fastlane-2.150.1 fastlane/lib/fastlane/actions/ensure_env_vars.rb
fastlane-2.150.0 fastlane/lib/fastlane/actions/ensure_env_vars.rb
fastlane-2.150.0.rc7 fastlane/lib/fastlane/actions/ensure_env_vars.rb
fastlane-2.150.0.rc6 fastlane/lib/fastlane/actions/ensure_env_vars.rb
fastlane-2.150.0.rc5 fastlane/lib/fastlane/actions/ensure_env_vars.rb
fastlane-2.150.0.rc4 fastlane/lib/fastlane/actions/ensure_env_vars.rb
fastlane-2.150.0.rc3 fastlane/lib/fastlane/actions/ensure_env_vars.rb
fastlane-2.150.0.rc2 fastlane/lib/fastlane/actions/ensure_env_vars.rb
fastlane-2.150.0.rc1 fastlane/lib/fastlane/actions/ensure_env_vars.rb
fastlane-2.149.1 fastlane/lib/fastlane/actions/ensure_env_vars.rb
fastlane-2.149.0 fastlane/lib/fastlane/actions/ensure_env_vars.rb
fastlane-2.148.1 fastlane/lib/fastlane/actions/ensure_env_vars.rb
fastlane-2.148.0 fastlane/lib/fastlane/actions/ensure_env_vars.rb
fastlane-2.147.0 fastlane/lib/fastlane/actions/ensure_env_vars.rb
fastlane-2.146.1 fastlane/lib/fastlane/actions/ensure_env_vars.rb
fastlane-2.146.0 fastlane/lib/fastlane/actions/ensure_env_vars.rb