2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/config.rb', line 2
def self.load
config_filename = "email2sms.yml"
default_config = YAML.load_file(File.dirname(__FILE__) + "/../config/" + config_filename)
default_config_file_path = File.dirname(__FILE__) + "/../config/email2sms.yml"
config_dir = ENV["HOME"] + "/.email2sms"
config_file_path = config_dir + "/" + config_filename
exists_or_create_dir(config_dir)
unless File.exists?(config_file_path) then
puts "\n\n-------------------------------------\n"
puts "Didn't find a configuration file in #{config_file_path}. First start?"
puts "I am going to create a configuration file template for you under #{config_file_path}."
puts "Please adapt it to your needs and start the daemon again."
puts "-------------------------------------\n\n"
config_file = File.new(config_file_path, "w+")
config_file.puts File.open(default_config_file_path).read
end
config = YAML.load_file(config_file_path)
config
end
|