Sha256: 310013a5a186719e957d9a21299cf03a4305e073305b5ddb280242f5d0b63f0c

Contents?: true

Size: 1.2 KB

Versions: 3

Compression:

Stored size: 1.2 KB

Contents

require 'fwtoolkit/configfile'
require 'fileutils'

module FWToolkit
  module Config 
    include FWToolkit::ConfigFile

    def self.config_file
      File.join(ENV['HOME'], '.fwtoolkit', 'config')
    end

    def load!
      unless File.exists? config_file
        FileUtils.copy_file File.join(File.dirname(__FILE__), 'config', 'config.sample'), config_file
        raise "Please configure fwtoolkit by editing the file at path: #{config_file}"
      end

      default_config = {  :organization_name => 'Future Workshops',
                          :ruby_version => '2.5.1',
                          :target_platform => '12.1',
                          :ci_server_url => 'http://ci.office.futureworkshops.com',
                          :artifacts_tmp_dir => '/tmp/fwtoolkit/artifacts' }

      load_config! config_file
    end

    def validate_config
      unless @config.has_key?(:developer_name) 
        raise NameError, "Please configure fwtoolkit by editing the file at path: #{config_file}"
      end
    end

    def conf_item_missing(name)
      raise NoMethodError, "Please provide a valid '#{name}' by editing the conf file at path: #{config_file}"
    end

    extend self
  end
end

FWToolkit::Config.load!

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fwtoolkit-2.2.2 lib/fwtoolkit/config.rb
fwtoolkit-2.2.1 lib/fwtoolkit/config.rb
fwtoolkit-2.2.0 lib/fwtoolkit/config.rb