Name all configuration sources for debugging purposes.

This commit is contained in:
Chris Eppstein 2009-11-17 08:58:12 -08:00
parent a281dc1d5f
commit bd422403bd
11 changed files with 26 additions and 24 deletions

View File

@ -16,7 +16,7 @@ module Compass
end
def configuration
Compass::Configuration::Data.new.
Compass::Configuration::Data.new('rails').
extend(ConfigurationDefaults)
end

View File

@ -10,10 +10,6 @@ module Compass
module Rails
class Installer < Compass::Installers::ManifestInstaller
def default_configuration
Compass::Configuration::Data.new.extend(ConfigurationDefaults)
end
def completed_configuration
config = {}
config[:sass_dir] = prompt_sass_dir unless sass_dir_without_default

View File

@ -13,7 +13,7 @@ module Compass
end
def configuration
Compass::Configuration::Data.new.
Compass::Configuration::Data.new('stand_alone').
extend(ConfigurationDefaults)
end

View File

@ -35,10 +35,6 @@ module Compass
write_configuration_files unless config_files_exist? || !@manifest.generate_config?
end
def default_configuration
Compass::Configuration::Data.new.extend(Compass::AppIntegration::StandAlone::ConfigurationDefaults)
end
def completed_configuration
nil
end

View File

@ -66,7 +66,7 @@ Options:
def initialize(working_path, options)
super
assert_project_directory_exists!
Compass.add_configuration(options)
Compass.add_configuration(options, 'command_line')
end
def perform

View File

@ -8,8 +8,8 @@ module Compass
def configure!
Compass.add_configuration(options[:project_type] || :stand_alone)
Compass.add_project_configuration unless respond_to?(:is_project_creation?) && is_project_creation?
Compass.add_configuration(options)
Compass.add_configuration(installer.completed_configuration)
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

View File

@ -41,6 +41,14 @@ module Compass
def perform
if options[:debug]
puts "Configuration sources:"
c = Compass.configuration
while c
print c.name
c = c.inherited_data
print ", " if c
end
print "\n"
Compass.configuration.debug.each do |prop, values|
if options[:debug].is_a?(Symbol)
next unless prop == options[:debug]

View File

@ -18,6 +18,7 @@ module Compass
class Data
attr_accessor :required_libraries
attr_reader :name
include Compass::Configuration::Inheritance
include Compass::Configuration::Serialization
@ -25,7 +26,9 @@ module Compass
inherited_accessor *ATTRIBUTES
def initialize(attr_hash = nil)
def initialize(name, attr_hash = nil)
raise "I need a name!" unless name
@name = name
self.required_libraries = []
set_all(attr_hash) if attr_hash
self.top_level = self
@ -100,4 +103,4 @@ module Compass
end
end
end
end

View File

@ -11,14 +11,17 @@ module Compass
end
def default_configuration
Data.new.extend(Defaults).extend(Comments)
Data.new('defaults').extend(Defaults).extend(Comments)
end
def add_configuration(config, filename = nil)
return if config.nil?
data = configuration_for(config, filename)
# puts "New configuration: #{data.name}"
# puts caller.join("\n")
data.inherit_from!(configuration)
data.on_top!
@configuration = data
@ -30,7 +33,7 @@ module Compass
elsif config.respond_to?(:read)
Compass::Configuration::Data.new_from_string(config.read, filename)
elsif config.is_a?(Hash)
Compass::Configuration::Data.new(config)
Compass::Configuration::Data.new(filename, config)
elsif config.is_a?(String)
Compass::Configuration::Data.new_from_file(config)
elsif config.is_a?(Symbol)
@ -67,7 +70,7 @@ module Compass
configuration_file_path ||= detect_configuration_file
if configuration_file_path
data = configuration_for(configuration_file_path)
data = configuration_for(configuration_file_path)
if data.raw_project_type
add_configuration(data.raw_project_type.to_sym)

View File

@ -9,13 +9,13 @@ module Compass
module ClassMethods
def new_from_file(config_file)
data = Data.new
data = Data.new(config_file)
data.parse(config_file)
data
end
def new_from_string(contents, filename)
data = Data.new
data = Data.new(filename)
data.parse_string(contents, filename)
data
end

View File

@ -2,10 +2,6 @@ module Compass
module Installers
class BareInstaller < Base
def default_configuration
Compass::Configuration::Data.new.extend(Compass::AppIntegration::StandAlone::ConfigurationDefaults)
end
def completed_configuration
nil
end