lib/gogetit/config.rb in gogetit-0.12.3 vs lib/gogetit/config.rb in gogetit-0.12.4
- old
+ new
@@ -12,53 +12,53 @@
end
# TODO: It might be needed to disable one of logging devices according to satiation.
STDOUT.sync = true
log_to_stdout = Logger.new(STDOUT)
+ # Instantiate main objects
@logger = Gogetit::MultiLogger.new(:loggers => log_to_stdout)
- logger.debug('Instantiate main objects..')
@config = {}
- logger.debug('Defining home directory..')
+ # Define home directory
user_gogetit_home = Dir.home + '/.gogetit'
config[:user_gogetit_home] = user_gogetit_home
if not File.directory?(user_gogetit_home)
- logger.debug('Creating home directory..')
+ logger.info('Creating home directory..')
FileUtils.mkdir(user_gogetit_home)
end
# TODO: It can be used to provide different behavior according to consumer.
- logger.debug('Defining default consumer..')
+ # Define default consumer
config[:consumer] = 'gogetit_cli'
- logger.debug('Defining log directory..')
+ # Define log directory
log_dir = user_gogetit_home + '/log'
config[:log_dir] = log_dir
if not File.directory?(log_dir)
- logger.debug('Creating log directory..')
+ logger.info('Creating log directory..')
FileUtils.mkdir(log_dir)
end
- logger.debug('Define file log devices..')
+ # Define file log devices
log_file = File.open(log_dir + '/debug.log', 'a')
log_file.sync = true
log_to_file = Logger.new(log_file)
logger.add_logger(log_to_file)
- logger.debug('Defining logger..')
+ # Define logger
# logger.datetime_format = "%Y-%m-%d %H:%M:%S"
logger.progname = 'GoGetIt'
lib_dir = Gem::Specification.find_by_name('gogetit').gem_dir + '/lib'
config[:lib_dir] = lib_dir
- logger.debug('Loading GoGetIt default configuration..')
+ # Load GoGetIt default configuration
conf_file = user_gogetit_home + '/gogetit.yml'
if not File.exists?(conf_file)
src = File.new(lib_dir + '/sample_conf/gogetit.yml')
dst = Dir.new(user_gogetit_home)
- logger.debug('Copying GoGetIt default configuration..')
+ logger.info('Copying GoGetIt default configuration..')
FileUtils.cp(src, dst)
abort('Please define default configuration for GoGetIt at ~/.gogetit/gogetit.yml.')
end
config.merge!(Hashie.symbolize_keys YAML.load_file(conf_file))
end