[Rails] Provide a wrapper method for Rails.root/RAILS_ROOT that avoids deprecation warnings and handles the case where rails is not loaded at all.
This commit is contained in:
parent
981bbd2b18
commit
6ab85ecd83
@ -26,6 +26,14 @@ module Compass
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def root
|
||||||
|
if defined?(::Rails)
|
||||||
|
::Rails.root
|
||||||
|
elsif defined?(RAILS_ROOT)
|
||||||
|
RAILS_ROOT
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -94,7 +94,7 @@ NEXTSTEPS
|
|||||||
"# This configuration file works with both the Compass command line tool and within Rails.\n" +
|
"# This configuration file works with both the Compass command line tool and within Rails.\n" +
|
||||||
Compass.configuration.serialize do |prop, value|
|
Compass.configuration.serialize do |prop, value|
|
||||||
if prop == :project_path
|
if prop == :project_path
|
||||||
"project_path = RAILS_ROOT if defined?(RAILS_ROOT)\n"
|
"project_path = Compass::AppIntegration::Rails.root\n"
|
||||||
elsif prop == :environment
|
elsif prop == :environment
|
||||||
"environment = Compass::AppIntegration::Rails.env\n"
|
"environment = Compass::AppIntegration::Rails.env\n"
|
||||||
elsif prop == :output_style
|
elsif prop == :output_style
|
||||||
|
Loading…
Reference in New Issue
Block a user