diff --git a/Gemfile b/Gemfile index d75d9699af021626e4bea86d4e37273a1cc6ffaf..4fba74302d2f600fbd56a84d813c9555aa66bfeb 100644 --- a/Gemfile +++ b/Gemfile @@ -3,6 +3,7 @@ gem "rake" gem "net-yail" gem "rspec" gem "activerecord" +gem "activesupport" gem "sqlite3" gem "youtube_it" diff --git a/Gemfile.lock b/Gemfile.lock index f018815b4394de05a60dd3b6c8e198be20c309f8..53dfa53eec0f0c09d153ddea00d7ad531f72439c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -59,6 +59,7 @@ PLATFORMS DEPENDENCIES activerecord + activesupport net-yail rake rspec diff --git a/Rakefile b/Rakefile index 18969aba14795ef6941e9680ae8b5631bfdc9750..4760415e4c6eb4e46f51c44f6664cee2ec0fee88 100644 --- a/Rakefile +++ b/Rakefile @@ -13,5 +13,5 @@ end task :environment do config = Options.new.read_file ActiveRecord::Base.establish_connection(config[:database]) - ActiveRecord::Base.logger = Logger.new(File.open('log/database.log', 'a')) + ActiveRecord::Base.logger = Logger.new(File.open(config[:database][:log], 'a')) end diff --git a/lib/options.rb b/lib/options.rb index b942763dd9ef25379a2ed6197186cd081645d7cf..69367af8f72522c88ecef6751831f086692c0a98 100644 --- a/lib/options.rb +++ b/lib/options.rb @@ -1,5 +1,6 @@ require 'optparse' require 'yaml' +require 'active_support' # Allow us to get options, set by user or default ones. class Options @@ -43,7 +44,7 @@ class Options # Read the options from the configuration file. def read_file if File.exists?(@file) - YAML.load_file(@file).each do |k, v| + YAML.load_file(@file).with_indifferent_access.each do |k, v| @options[k.to_sym] = v unless @options.has_key?(k) end end diff --git a/run.rb b/run.rb index c98fbab72afe068f9622aeda3a7733bccc1291ef..b35787bb765296e7dc503c26ea876af9e76f8823 100755 --- a/run.rb +++ b/run.rb @@ -11,6 +11,7 @@ require_relative 'lib/options' options = Options.new.read_all ActiveRecord::Base.establish_connection(options[:database]) +ActiveRecord::Base.logger = Logger.new(File.open(options[:database][:log], 'a')) bot = PlayBot.new(options) bot.irc_loop