From f9c5644dcc689c905e4fae0f20350a5a36f0d930 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sat, 24 Oct 2009 15:21:08 -0700 Subject: [PATCH] Ability to create a bare project by passing the --bare option to the create command. --- features/command_line.feature | 8 +-- .../step_definitions/command_line_steps.rb | 10 ++-- .../app_integration/stand_alone/installer.rb | 33 ++++++++---- lib/compass/installers/bare_installer.rb | 53 ++++++++++++++++++- lib/compass/installers/base.rb | 2 +- 5 files changed, 84 insertions(+), 22 deletions(-) diff --git a/features/command_line.feature b/features/command_line.feature index 9a978c27..8e9736cb 100644 --- a/features/command_line.feature +++ b/features/command_line.feature @@ -63,11 +63,11 @@ Feature: Command Line When I run: compass create bare_project --bare Then a directory bare_project/ is created And a configuration file bare_project/config.rb is created - And a directory custom_project/src/ is created - And a directory custom_project/stylesheets/ is not created + And a directory bare_project/src/ is created + And a directory bare_project/stylesheets/ is not created And I am congratulated - And I am told where to place stylesheets - And how to compile them + And I am told that I can place stylesheets in the src subdirectory + And I am told how to compile my sass stylesheets Scenario: Creating a bare project with a framework When I run: compass create bare_project --using blueprint --bare diff --git a/features/step_definitions/command_line_steps.rb b/features/step_definitions/command_line_steps.rb index 765be60e..143c39f9 100644 --- a/features/step_definitions/command_line_steps.rb +++ b/features/step_definitions/command_line_steps.rb @@ -62,14 +62,14 @@ end Then /^I am congratulated$/ do - pending + @last_result.should =~ /Congratulations!/ end -Then /^I am told where to place stylesheets$/ do - pending +Then /^I am told that I can place stylesheets in the ([^\s]+) subdirectory$/ do |subdir| + @last_result.should =~ /You may now add sass stylesheets to the #{subdir} subdirectory of your project./ end -Then /^how to compile them$/ do - pending +Then /^I am told how to compile my sass stylesheets$/ do + @last_result.should =~ /You must compile your sass stylesheets into CSS when they change.\nThis can be done in one of the following ways:/ end diff --git a/lib/compass/app_integration/stand_alone/installer.rb b/lib/compass/app_integration/stand_alone/installer.rb index cebcb51c..5c6177de 100644 --- a/lib/compass/app_integration/stand_alone/installer.rb +++ b/lib/compass/app_integration/stand_alone/installer.rb @@ -47,16 +47,29 @@ module Compass if options[:create] puts <<-NEXTSTEPS - Congratulations! Your compass project has been created. - You must recompile your sass stylesheets when they change. - This can be done in one of the following ways: - 1. From within your project directory run: - compass - 2. From any directory run: - compass -u path/to/project - 3. To monitor your project for changes and automatically recompile: - compass --watch [path/to/project] - NEXTSTEPS +********************************************************************* +Congratulations! Your compass project has been created. + +You may now add and edit sass stylesheets in the #{Compass.configuration.sass_dir} subdirectory of your project. + +Sass files beginning with an underscore are called partials and won't be +compiled to CSS, but they can be imported into other sass stylesheets. + +You can configure your project by editing the config.rb configuration file. + +You must compile your sass stylesheets into CSS when they change. +This can be done in one of the following ways: + 1. To compile on demand: + compass compile [path/to/project] + 2. To monitor your project for changes and automatically recompile: + compass watch [path/to/project] + +More Resources: + * Wiki: http://wiki.github.com/chriseppstein/compass + * Sass: http://sass-lang.com + * Community: http://groups.google.com/group/compass-users/ + +NEXTSTEPS end if manifest.has_stylesheet? puts "\nTo import your new stylesheets add the following lines of HTML (or equivalent) to your webpage:" diff --git a/lib/compass/installers/bare_installer.rb b/lib/compass/installers/bare_installer.rb index 6c04eff1..049f7206 100644 --- a/lib/compass/installers/bare_installer.rb +++ b/lib/compass/installers/bare_installer.rb @@ -2,12 +2,61 @@ module Compass module Installers class BareInstaller < Base - def prepare + def default_configuration + Compass::Configuration::Data.new.extend(Compass::AppIntegration::StandAlone::ConfigurationDefaults) + end + def completed_configuration + nil end + + def init + directory targetize("") + directory targetize(Compass.configuration.sass_dir) + end + + def prepare + end + def install - # directory + config_file ||= targetize('config.rb') + write_file config_file, config_contents end + + def config_contents + project_path, Compass.configuration.project_path = Compass.configuration.project_path, nil + Compass.configuration.serialize + ensure + Compass.configuration.project_path = project_path + end + + def finalize(options = {}) + puts <<-NEXTSTEPS + +********************************************************************* +Congratulations! Your compass project has been created. + +You may now add sass stylesheets to the #{Compass.configuration.sass_dir} subdirectory of your project. + +Sass files beginning with an underscore are called partials and won't be +compiled to CSS, but they can be imported into other sass stylesheets. + +You can configure your project by editing the config.rb configuration file. + +You must compile your sass stylesheets into CSS when they change. +This can be done in one of the following ways: + 1. To compile on demand: + compass compile [path/to/project] + 2. To monitor your project for changes and automatically recompile: + compass watch [path/to/project] + +More Resources: + * Wiki: http://wiki.github.com/chriseppstein/compass + * Sass: http://sass-lang.com + * Community: http://groups.google.com/group/compass-users/ +NEXTSTEPS + end + end end end diff --git a/lib/compass/installers/base.rb b/lib/compass/installers/base.rb index fd72b3f1..9fd27f2c 100644 --- a/lib/compass/installers/base.rb +++ b/lib/compass/installers/base.rb @@ -46,7 +46,7 @@ module Compass # The default finalize method -- it is a no-op. # This could print out a message or something. - def finalize + def finalize(options = {}) end def compilation_required?