lib/tasks/db.rake in wcc-base-0.1.2 vs lib/tasks/db.rake in wcc-base-0.1.3
- old
+ new
@@ -1,10 +1,10 @@
module WCC
module RakeHelpers
def self.db_config
- @config ||= YAML.load_file("config/database.yml")[ENV['RAILS_ENV'] || 'development'] || {}
+ @config ||= db_config_file_data[ENV['RAILS_ENV'] || 'development'] || {}
end
def self.db_cmd_with_password(cmd, pw)
`#{db_cmd_with_password_string(cmd, pw)}`
end
@@ -17,9 +17,15 @@
db_config["adapter"] == "postgresql"
end
def self.mysql?
db_config["adapter"] == "mysql"
+ end
+
+ def self.db_config_file_data
+ YAML.load_file("config/database.yml")
+ rescue SystemCallError
+ {}
end
end
end