Sha256: ec00f4e75818c80aa795378020a24ef599e3729a272f03492d83b0a586d89161

Contents?: true

Size: 1.16 KB

Versions: 11

Compression:

Stored size: 1.16 KB

Contents

# encoding: UTF-8
#
# Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

module GoodData
  module Environment
    class << self
      BRANCH_TO_ENVIRONMENT = {
        develop: 'testing',
        hotfix: 'production'
      }

      def load(env = ENV['GD_ENV'] || 'testing')
        require_relative 'default'
        env = branch_to_environment(env)

        puts "USING ENVIRONMENT: #{env}"
        begin
          require_relative env
        rescue
          puts "Unable to find environment '#{env}'"
          require_relative 'development'
        end

        GoodData::Environment::ProjectHelper.set_const :PROJECT_URL, "/gdc/projects/#{GoodData::Environment::ProjectHelper::PROJECT_ID}"
        ENV['GD_SERVER'] = GoodData::Environment::ConnectionHelper::DEFAULT_SERVER
      end

      # Translates ci-infra branch to environment config name
      # @param branch Name of the branch we are testing against
      def branch_to_environment(branch)
        BRANCH_TO_ENVIRONMENT[branch.to_sym] || branch
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
gooddata-1.1.0-java spec/environment/environment.rb
gooddata-1.1.0 spec/environment/environment.rb
gooddata-1.0.2-java spec/environment/environment.rb
gooddata-1.0.2 spec/environment/environment.rb
gooddata-1.0.1 spec/environment/environment.rb
gooddata-1.0.1-java spec/environment/environment.rb
gooddata-1.0.0-java spec/environment/environment.rb
gooddata-1.0.0 spec/environment/environment.rb
gooddata-0.6.54 spec/environment/environment.rb
gooddata-0.6.53 spec/environment/environment.rb
gooddata-0.6.52 spec/environment/environment.rb