Detect the version of rails and print out instructions accordingly.

This commit is contained in:
Chris Eppstein 2010-08-28 21:54:40 -07:00
parent 04eb17968e
commit f44e1ea492

View File

@ -27,24 +27,30 @@ module Compass
write_file targetize('config/initializers/compass.rb'), initializer_contents
end
def rails3?
File.exists?(targetize('config/application.rb'))
end
def prepare
write_configuration_files
end
def gem_config_instructions
if rails3?
%Q{Add the following to your Gemfile:\n\n gem "compass", ">= #{Compass::VERSION}"}
else
%Q{Add the following to your evironment.rb:\n\n config.gem "compass", :version => ">= #{Compass::VERSION}"}
end
end
def finalize(options = {})
if options[:create]
puts <<-NEXTSTEPS
Congratulations! Your rails project has been configured to use Compass.
Just one more thing left to do: Register the compass gem.
Just one more thing left to do if you haven't yet: Register the compass gem.
In Rails 2.2 & 2.3, add the following to your evironment.rb:
config.gem "compass", :version => ">= #{Compass::VERSION}"
In Rails 3, add the following to your Gemfile:
gem "compass", ">= #{Compass::VERSION}"
#{gem_config_instructions}
Then, make sure you restart your server.