Sha256: 291e3885e7b6cde3756fdf2255b73849b64587a1d6bc3a7173f6e608dbbadd49

Contents?: true

Size: 1.2 KB

Versions: 23

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 => '1.9.3',
                          :target_platform => '6.0',
                          :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

23 entries across 23 versions & 1 rubygems

Version Path
fwtoolkit-2.1.10 lib/fwtoolkit/config.rb
fwtoolkit-2.1.9 lib/fwtoolkit/config.rb
fwtoolkit-2.1.8 lib/fwtoolkit/config.rb
fwtoolkit-2.1.7 lib/fwtoolkit/config.rb
fwtoolkit-2.1.6 lib/fwtoolkit/config.rb
fwtoolkit-2.1.5 lib/fwtoolkit/config.rb
fwtoolkit-2.1.4 lib/fwtoolkit/config.rb
fwtoolkit-2.1.3 lib/fwtoolkit/config.rb
fwtoolkit-2.1.1 lib/fwtoolkit/config.rb
fwtoolkit-2.0.7 lib/fwtoolkit/config.rb
fwtoolkit-2.0.6 lib/fwtoolkit/config.rb
fwtoolkit-2.0.5 lib/fwtoolkit/config.rb
fwtoolkit-2.0.4 lib/fwtoolkit/config.rb
fwtoolkit-2.0.3 lib/fwtoolkit/config.rb
fwtoolkit-2.0.2 lib/fwtoolkit/config.rb
fwtoolkit-2.0.1 lib/fwtoolkit/config.rb
fwtoolkit-2.0.0 lib/fwtoolkit/config.rb
fwtoolkit-1.0.6 lib/fwtoolkit/config.rb
fwtoolkit-1.0.5 lib/fwtoolkit/config.rb
fwtoolkit-1.0.4 lib/fwtoolkit/config.rb