diff --git a/lib/compass/app_integration/rails/installer.rb b/lib/compass/app_integration/rails/installer.rb index 68e6a021..2c6682a1 100644 --- a/lib/compass/app_integration/rails/installer.rb +++ b/lib/compass/app_integration/rails/installer.rb @@ -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 diff --git a/lib/compass/commands/create_project.rb b/lib/compass/commands/create_project.rb index c714b023..ebebd507 100644 --- a/lib/compass/commands/create_project.rb +++ b/lib/compass/commands/create_project.rb @@ -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 diff --git a/lib/compass/commands/stamp_pattern.rb b/lib/compass/commands/stamp_pattern.rb index 0af1acf3..fb45bf34 100644 --- a/lib/compass/commands/stamp_pattern.rb +++ b/lib/compass/commands/stamp_pattern.rb @@ -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? diff --git a/lib/compass/installers/base.rb b/lib/compass/installers/base.rb index e5c7a345..079f36b4 100644 --- a/lib/compass/installers/base.rb +++ b/lib/compass/installers/base.rb @@ -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.