Sha256: 4af71d374bd01d39f0cc76d4f18347ec7746dcfd9af4da2efd1d5f29b2d39bf6
Contents?: true
Size: 1.86 KB
Versions: 1
Compression:
Stored size: 1.86 KB
Contents
require 'fwtoolkit/configfile' require 'fileutils' module FWToolkit module Config include FWToolkit::ConfigFile def self.base_path ENV['CONFIG_PATH'] || ENV['HOME'] end def self.config_file File.join(base_path, '.fwtoolkitconfig') end def self.old_file File.join(base_path, '.fwtoolkit', 'config') end def self.base_file File.join(File.dirname(__FILE__), 'config', '.fwtoolkitconfig.sample') end def self.old_config_path File.dirname(old_file) end def self.config_path File.dirname(config_file) end def load! unless File.exist? config_file puts "Config file not found" unless File.exist? config_path puts "Creating basic path" FileUtils.mkpath config_path end if File.exist? old_file puts "Moving old configuration file to new path" FileUtils.copy_file old_file, config_file FileUtils.remove_file old_file FileUtils.remove_dir old_config_path else FileUtils.copy_file base_file, config_file end end default_config = { :organization_name => 'Future Workshops', :target_platform => '13.1', :ci_server_url => 'https://app.bitrise.io/dashboard', :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}, and inform your name on developer_name" 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fwtoolkit-2.6.4 | lib/fwtoolkit/config.rb |