diff --git a/lib/compass/app_integration/rails/configuration_defaults.rb b/lib/compass/app_integration/rails/configuration_defaults.rb index be44f13d..21fade64 100644 --- a/lib/compass/app_integration/rails/configuration_defaults.rb +++ b/lib/compass/app_integration/rails/configuration_defaults.rb @@ -3,6 +3,10 @@ module Compass module Rails module ConfigurationDefaults + def default_project_type + :rails + end + def default_images_dir File.join("public", "images") end diff --git a/lib/compass/app_integration/stand_alone/configuration_defaults.rb b/lib/compass/app_integration/stand_alone/configuration_defaults.rb index a9ed92dc..5eb364fa 100644 --- a/lib/compass/app_integration/stand_alone/configuration_defaults.rb +++ b/lib/compass/app_integration/stand_alone/configuration_defaults.rb @@ -2,6 +2,10 @@ module Compass module AppIntegration module StandAlone module ConfigurationDefaults + def default_project_type + :stand_alone + end + def sass_dir_without_default "src" end @@ -21,4 +25,4 @@ module Compass end end -end \ No newline at end of file +end diff --git a/lib/compass/commands/installer_command.rb b/lib/compass/commands/installer_command.rb index 138296f8..b7245ec2 100644 --- a/lib/compass/commands/installer_command.rb +++ b/lib/compass/commands/installer_command.rb @@ -6,13 +6,16 @@ module Compass include Compass::Installers def configure! - Compass.add_configuration(options[:project_type] || :stand_alone) - Compass.add_project_configuration unless respond_to?(:is_project_creation?) && is_project_creation? + if respond_to?(:is_project_creation?) && is_project_creation? + Compass.add_configuration(options.delete(:project_type) || :stand_alone) + else + Compass.add_project_configuration(:project_type => options.delete(:project_type)) + end Compass.add_configuration(options, 'command_line') - Compass.add_configuration(installer.completed_configuration, 'installer') if File.exists?(Compass.configuration.extensions_path) Compass::Frameworks.discover(Compass.configuration.extensions_path) end + Compass.add_configuration(installer.completed_configuration, 'installer') end def app diff --git a/lib/compass/commands/project_base.rb b/lib/compass/commands/project_base.rb index 3567682e..5d5c3312 100644 --- a/lib/compass/commands/project_base.rb +++ b/lib/compass/commands/project_base.rb @@ -11,7 +11,7 @@ module Compass def initialize(working_path, options = {}) super(working_path, options) self.project_name = determine_project_name(working_path, options) - Compass.configuration.project_path = determine_project_directory(working_path, options) + Compass.add_configuration({:project_path => determine_project_directory(working_path, options)}, "implied") configure! end @@ -89,4 +89,4 @@ module Compass end end -end \ No newline at end of file +end diff --git a/lib/compass/configuration/helpers.rb b/lib/compass/configuration/helpers.rb index b2e0e396..d1d983bb 100644 --- a/lib/compass/configuration/helpers.rb +++ b/lib/compass/configuration/helpers.rb @@ -66,21 +66,25 @@ module Compass end # Read the configuration file for this project - def add_project_configuration(configuration_file_path = nil) - configuration_file_path ||= detect_configuration_file + def add_project_configuration(*args) + options = args.last.is_a?(Hash) ? args.pop : {} + configuration_file_path = args.shift || detect_configuration_file + raise ArgumentError, "Too many arguments" if args.any? if configuration_file_path data = configuration_for(configuration_file_path) if data.raw_project_type add_configuration(data.raw_project_type.to_sym) + elsif options[:project_type] + add_configuration(options[:project_type]) else add_configuration(:stand_alone) end add_configuration(data) else - add_configuration(configuration.project_type || :stand_alone) + add_configuration(options[:project_type] || configuration.project_type || :stand_alone) end end