[Rails] Make it possible to only install the configuration files into a rails project.
This commit is contained in:
parent
5864f2aeab
commit
a2a0d58508
@ -19,19 +19,16 @@ module Compass
|
||||
|
||||
def write_configuration_files(config_file = nil)
|
||||
config_file ||= targetize('config/compass.rb')
|
||||
directory File.dirname(config_file)
|
||||
write_file config_file, config_contents
|
||||
unless File.exists?(config_file)
|
||||
directory File.dirname(config_file)
|
||||
write_file config_file, config_contents
|
||||
end
|
||||
directory File.dirname(targetize('config/initializers/compass.rb'))
|
||||
write_file targetize('config/initializers/compass.rb'), initializer_contents
|
||||
end
|
||||
|
||||
def config_files_exist?
|
||||
File.exists?(targetize('config/compass.rb')) &&
|
||||
File.exists?(targetize('config/initializers/compass.rb'))
|
||||
end
|
||||
|
||||
def prepare
|
||||
write_configuration_files unless config_files_exist?
|
||||
write_configuration_files
|
||||
end
|
||||
|
||||
def finalize(options = {})
|
||||
@ -55,10 +52,12 @@ Sass will automatically compile your stylesheets during the next
|
||||
page request and keep them up to date when they change.
|
||||
NEXTSTEPS
|
||||
end
|
||||
if manifest.has_stylesheet?
|
||||
puts "\nNext add these lines to the head of your layouts:\n\n"
|
||||
puts stylesheet_links
|
||||
puts "\n(You are using haml, aren't you?)"
|
||||
unless options[:prepare]
|
||||
if manifest.has_stylesheet?
|
||||
puts "\nNext add these lines to the head of your layouts:\n\n"
|
||||
puts stylesheet_links
|
||||
puts "\n(You are using haml, aren't you?)"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -43,7 +43,12 @@ module Compass
|
||||
self.options[:preferred_syntax] = syntax
|
||||
end
|
||||
|
||||
opts.on("--prepare", "Prepare the project by only creating configuration files.") do
|
||||
self.options[:prepare] = true
|
||||
end
|
||||
|
||||
super
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -74,7 +74,7 @@ Options:
|
||||
installer.init
|
||||
installer.run(:skip_finalization => true)
|
||||
UpdateProject.new(working_path, options).perform if installer.compilation_required?
|
||||
installer.finalize(:create => is_project_creation?)
|
||||
installer.finalize(options.merge(:create => is_project_creation?))
|
||||
end
|
||||
|
||||
def is_project_creation?
|
||||
|
@ -28,10 +28,10 @@ module Compass
|
||||
# Runs the installer.
|
||||
# Every installer must conform to the installation strategy of prepare, install, and then finalize.
|
||||
# A default implementation is provided for each step.
|
||||
def run(options = {})
|
||||
def run(run_options = {})
|
||||
prepare
|
||||
install
|
||||
finalize(options) unless options[:skip_finalization]
|
||||
install unless options[:prepare]
|
||||
finalize(options.merge(run_options)) unless options[:prepare] || run_options[:skip_finalization]
|
||||
end
|
||||
|
||||
# The default prepare method -- it is a no-op.
|
||||
|
Loading…
Reference in New Issue
Block a user