diff --git a/lib/compass/app_integration/rails.rb b/lib/compass/app_integration/rails.rb index 745efca5..668fbd42 100644 --- a/lib/compass/app_integration/rails.rb +++ b/lib/compass/app_integration/rails.rb @@ -16,7 +16,7 @@ module Compass end def configuration - Compass::Configuration::Data.new. + Compass::Configuration::Data.new('rails'). extend(ConfigurationDefaults) end diff --git a/lib/compass/app_integration/rails/installer.rb b/lib/compass/app_integration/rails/installer.rb index ece81ea2..4b06a2a7 100644 --- a/lib/compass/app_integration/rails/installer.rb +++ b/lib/compass/app_integration/rails/installer.rb @@ -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 diff --git a/lib/compass/app_integration/stand_alone.rb b/lib/compass/app_integration/stand_alone.rb index c3a6c9fe..2a00d195 100644 --- a/lib/compass/app_integration/stand_alone.rb +++ b/lib/compass/app_integration/stand_alone.rb @@ -13,7 +13,7 @@ module Compass end def configuration - Compass::Configuration::Data.new. + Compass::Configuration::Data.new('stand_alone'). extend(ConfigurationDefaults) end diff --git a/lib/compass/app_integration/stand_alone/installer.rb b/lib/compass/app_integration/stand_alone/installer.rb index d13d6162..84dc19dc 100644 --- a/lib/compass/app_integration/stand_alone/installer.rb +++ b/lib/compass/app_integration/stand_alone/installer.rb @@ -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 diff --git a/lib/compass/commands/generate_grid_background.rb b/lib/compass/commands/generate_grid_background.rb index 06c2bc58..2bd16d9a 100644 --- a/lib/compass/commands/generate_grid_background.rb +++ b/lib/compass/commands/generate_grid_background.rb @@ -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 diff --git a/lib/compass/commands/installer_command.rb b/lib/compass/commands/installer_command.rb index 62dc87d2..138296f8 100644 --- a/lib/compass/commands/installer_command.rb +++ b/lib/compass/commands/installer_command.rb @@ -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 diff --git a/lib/compass/commands/write_configuration.rb b/lib/compass/commands/write_configuration.rb index c4e847dd..acf60301 100644 --- a/lib/compass/commands/write_configuration.rb +++ b/lib/compass/commands/write_configuration.rb @@ -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] diff --git a/lib/compass/configuration/data.rb b/lib/compass/configuration/data.rb index 755ccfd1..42936045 100644 --- a/lib/compass/configuration/data.rb +++ b/lib/compass/configuration/data.rb @@ -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 \ No newline at end of file +end diff --git a/lib/compass/configuration/helpers.rb b/lib/compass/configuration/helpers.rb index ec454d80..b2e0e396 100644 --- a/lib/compass/configuration/helpers.rb +++ b/lib/compass/configuration/helpers.rb @@ -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) diff --git a/lib/compass/configuration/serialization.rb b/lib/compass/configuration/serialization.rb index 4d8af6c0..829e3bb6 100644 --- a/lib/compass/configuration/serialization.rb +++ b/lib/compass/configuration/serialization.rb @@ -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 diff --git a/lib/compass/installers/bare_installer.rb b/lib/compass/installers/bare_installer.rb index 049f7206..96b017d3 100644 --- a/lib/compass/installers/bare_installer.rb +++ b/lib/compass/installers/bare_installer.rb @@ -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