Fix some issues regarding how the project type configuration gets applied.

This commit is contained in:
Chris Eppstein 2009-11-18 23:43:33 -08:00
parent 00958c1b24
commit 0da214a987
5 changed files with 24 additions and 9 deletions

View File

@ -3,6 +3,10 @@ module Compass
module Rails module Rails
module ConfigurationDefaults module ConfigurationDefaults
def default_project_type
:rails
end
def default_images_dir def default_images_dir
File.join("public", "images") File.join("public", "images")
end end

View File

@ -2,6 +2,10 @@ module Compass
module AppIntegration module AppIntegration
module StandAlone module StandAlone
module ConfigurationDefaults module ConfigurationDefaults
def default_project_type
:stand_alone
end
def sass_dir_without_default def sass_dir_without_default
"src" "src"
end end
@ -21,4 +25,4 @@ module Compass
end end
end end
end end

View File

@ -6,13 +6,16 @@ module Compass
include Compass::Installers include Compass::Installers
def configure! def configure!
Compass.add_configuration(options[:project_type] || :stand_alone) if respond_to?(:is_project_creation?) && is_project_creation?
Compass.add_project_configuration unless 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(options, 'command_line')
Compass.add_configuration(installer.completed_configuration, 'installer')
if File.exists?(Compass.configuration.extensions_path) if File.exists?(Compass.configuration.extensions_path)
Compass::Frameworks.discover(Compass.configuration.extensions_path) Compass::Frameworks.discover(Compass.configuration.extensions_path)
end end
Compass.add_configuration(installer.completed_configuration, 'installer')
end end
def app def app

View File

@ -11,7 +11,7 @@ module Compass
def initialize(working_path, options = {}) def initialize(working_path, options = {})
super(working_path, options) super(working_path, options)
self.project_name = determine_project_name(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! configure!
end end
@ -89,4 +89,4 @@ module Compass
end end
end end
end end

View File

@ -66,21 +66,25 @@ module Compass
end end
# Read the configuration file for this project # Read the configuration file for this project
def add_project_configuration(configuration_file_path = nil) def add_project_configuration(*args)
configuration_file_path ||= detect_configuration_file 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 if configuration_file_path
data = configuration_for(configuration_file_path) data = configuration_for(configuration_file_path)
if data.raw_project_type if data.raw_project_type
add_configuration(data.raw_project_type.to_sym) add_configuration(data.raw_project_type.to_sym)
elsif options[:project_type]
add_configuration(options[:project_type])
else else
add_configuration(:stand_alone) add_configuration(:stand_alone)
end end
add_configuration(data) add_configuration(data)
else else
add_configuration(configuration.project_type || :stand_alone) add_configuration(options[:project_type] || configuration.project_type || :stand_alone)
end end
end end