If assets haven't been precompiled, fail to start server in production mode with a message

This commit is contained in:
Neil Lalonde 2013-03-25 13:33:13 -04:00
parent c372e36cb6
commit ba315c6610
1 changed files with 23 additions and 7 deletions

View File

@ -1,15 +1,31 @@
# Check that the app is configured correctly. Raise some helpful errors if something is wrong.
if Rails.env.production? && ['localhost', 'production.localhost'].include?(Discourse.current_hostname)
puts <<END
if defined?(Rails::Server) and Rails.env.production? # Only run these checks when starting up a production server
Discourse.current_hostname = '#{Discourse.current_hostname}'
if ['localhost', 'production.localhost'].include?(Discourse.current_hostname)
puts <<END
Please update the host_names property in config/database.yml
so that it uses the hostname of your site. Otherwise you will
experience problems, like links in emails using #{Discourse.current_hostname}.
Discourse.current_hostname = '#{Discourse.current_hostname}'
Please update the host_names property in config/database.yml
so that it uses the hostname of your site. Otherwise you will
experience problems, like links in emails using #{Discourse.current_hostname}.
END
raise "Invalid host_names in database.yml"
raise "Invalid host_names in database.yml"
end
if !Dir.glob(File.join(Rails.root,'public','assets','application*.js')).present?
puts <<END
Assets have not been precompiled. Please run the following command
before starting the rails server in production mode:
rake assets:precompile
END
raise "Assets have not been precompiled"
end
end