[Rails Integration] Print a warning if compass is booted more than once. Closes GH-282.

This commit is contained in:
Chris Eppstein 2011-04-02 10:40:32 -07:00
parent c4a315af3c
commit af10edd7a9

View File

@ -11,6 +11,14 @@ module Compass
extend self
def booted!
Compass::AppIntegration::Rails.const_set(:BOOTED, true)
end
def booted?
defined?(Compass::AppIntegration::Rails::BOOTED) && Compass::AppIntegration::Rails::BOOTED
end
def installer(*args)
Installer.new(*args)
end
@ -41,6 +49,11 @@ module Compass
end
def initialize!(config = nil)
if booted?
Compass::Util.compass_warn("Warning: Compass was booted twice. Compass has a Railtie now; please remove your intializer.")
else
booted!
end
config ||= Compass.detect_configuration_file(root)
Compass.add_project_configuration(config, :project_type => :rails)
Compass.discover_extensions!