From 21cf6c870fa0ab167c19e11cf0faf0fcd41ec9dc Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Mon, 30 Nov 2009 23:31:17 -0800 Subject: [PATCH] Make sure the required libraries appear in the generated configuration file. --- lib/compass/configuration.rb | 1 + lib/compass/configuration/data.rb | 5 ++--- lib/compass/configuration/serialization.rb | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/compass/configuration.rb b/lib/compass/configuration.rb index 25c300b5..d25c1b68 100644 --- a/lib/compass/configuration.rb +++ b/lib/compass/configuration.rb @@ -29,6 +29,7 @@ module Compass :relative_assets, :additional_import_paths, :sass_options, + # Helper configuration :asset_host, :asset_cache_buster, :line_comments, diff --git a/lib/compass/configuration/data.rb b/lib/compass/configuration/data.rb index 42936045..6b0db638 100644 --- a/lib/compass/configuration/data.rb +++ b/lib/compass/configuration/data.rb @@ -17,7 +17,6 @@ module Compass # required. class Data - attr_accessor :required_libraries attr_reader :name include Compass::Configuration::Inheritance @@ -25,11 +24,11 @@ module Compass include Compass::Configuration::Adapters inherited_accessor *ATTRIBUTES + inherited_accessor :required_libraries #XXX we should make this array add up cumulatively. 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 end @@ -81,7 +80,7 @@ module Compass # Require a compass plugin and capture that it occured so that the configuration serialization works next time. def require(lib) - required_libraries << lib + (self.required_libraries ||= []) << lib super end diff --git a/lib/compass/configuration/serialization.rb b/lib/compass/configuration/serialization.rb index 829e3bb6..82484724 100644 --- a/lib/compass/configuration/serialization.rb +++ b/lib/compass/configuration/serialization.rb @@ -48,11 +48,11 @@ module Compass def serialize contents = "" - required_libraries.each do |lib| + (required_libraries || []).each do |lib| contents << %Q{require '#{lib}'\n} end contents << "# Require any additional compass plugins here.\n" - contents << "\n" if required_libraries.any? + contents << "\n" if (required_libraries || []).any? ATTRIBUTES.each do |prop| value = send("#{prop}_without_default") if value.is_a?(Proc)