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 ConfigurationDefaults
def default_project_type
:rails
end
def default_images_dir
File.join("public", "images")
end

View File

@ -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
end

View File

@ -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

View File

@ -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
end

View File

@ -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