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 end
def configuration def configuration
Compass::Configuration::Data.new. Compass::Configuration::Data.new('rails').
extend(ConfigurationDefaults) extend(ConfigurationDefaults)
end end

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -41,6 +41,14 @@ module Compass
def perform def perform
if options[:debug] 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| Compass.configuration.debug.each do |prop, values|
if options[:debug].is_a?(Symbol) if options[:debug].is_a?(Symbol)
next unless prop == options[:debug] next unless prop == options[:debug]

View File

@ -18,6 +18,7 @@ module Compass
class Data class Data
attr_accessor :required_libraries attr_accessor :required_libraries
attr_reader :name
include Compass::Configuration::Inheritance include Compass::Configuration::Inheritance
include Compass::Configuration::Serialization include Compass::Configuration::Serialization
@ -25,7 +26,9 @@ module Compass
inherited_accessor *ATTRIBUTES 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 = [] self.required_libraries = []
set_all(attr_hash) if attr_hash set_all(attr_hash) if attr_hash
self.top_level = self self.top_level = self
@ -100,4 +103,4 @@ module Compass
end end
end end
end end

View File

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

View File

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

View File

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