Permalink
Browse files

Display warning when config file not found for rails applications.

  • Loading branch information...
kawamanza committed Mar 16, 2012
1 parent 991530f commit a5863351ec5f8819e25e2e5fb960983656256198
Showing with 13 additions and 2 deletions.
  1. +7 −1 lib/purgeable/railtie.rb
  2. +6 −1 rails/init.rb
View
@@ -2,7 +2,13 @@
module Purgeable
class Railtie < ::Rails::Railtie
initializer "setup http cache" do
- require File.expand_path("../../../rails/init.rb", __FILE__)
+ config_file = ::Rails.root.join("config/purgeable.yml")
+ if File.exists? config_file
+ Purgeable.load_settings config_file, ::Rails.env
+ else
+ puts "Purgeable config not found. Create a config file at: config/purgeable.yml"
+ puts "to generate one run: rails generate purgeable:install"
+ end
end
end
end
View
@@ -1,4 +1,9 @@
# encoding: UTF-8
config_file = ::Rails.root.join("config/purgeable.yml")
-Purgeable.load_settings config_file, ::Rails.env if File.exists? config_file
+if File.exists? config_file
+ Purgeable.load_settings config_file, ::Rails.env
+else
+ puts "Purgeable config not found. Create a config file at: config/purgeable.yml"
+ puts "to generate one run: script/generate purgeable_install"
+end

0 comments on commit a586335

Please sign in to comment.