Module: FWToolkit::Config
Instance Attribute Summary
Attributes included from ConfigFile
#default_config
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from ConfigFile
#config, #configure, #load_config!, #load_config_hash!, #merge_config, #method_missing
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class FWToolkit::ConfigFile
Class Method Details
.config_file ⇒ Object
8
9
10
|
# File 'lib/fwtoolkit/config.rb', line 8
def self.config_file
File.join(ENV['HOME'], '.fwtoolkit', 'config')
end
|
Instance Method Details
#conf_item_missing(name) ⇒ Object
33
34
35
|
# File 'lib/fwtoolkit/config.rb', line 33
def conf_item_missing(name)
raise NoMethodError, "Please provide a valid '#{name}' by editing the conf file at path: #{config_file}"
end
|
#load! ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/fwtoolkit/config.rb', line 12
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
|
#validate_config ⇒ Object
27
28
29
30
31
|
# File 'lib/fwtoolkit/config.rb', line 27
def validate_config
unless @config.has_key?(:developer_name)
raise NameError, "Please configure fwtoolkit by editing the file at path: #{config_file}"
end
end
|