compass/lib/compass/configuration.rb
Chris Eppstein f59ca512ce Refactor of the internal datastructures used to access project
configuration. Configuration is now a singly linked list of configuration objects
that inherit values and defaults from the next configuration instance.
All instances hold a reference to the top of the configuration chain.

There is now a consistent API for reading configuration property values:

                <attr>: Reads the fully-resolved attribute after taking
                        configuration inheritance and defaults into account.
            raw_<attr>: reads attribute from a configuration object without
                        inheritance or defaults.
   default_for(<attr>): reads the default value for an attribute
    default_for_<attr>: specifies the default value for an attribute.
<attr>_without_default: reads the inherited attribute without applying defaults.
    comment_for_<attr>: Specifies a comment that will be emitted above the
                        property when serializing the configuration to a file.

Additionally, method_missing and respond_to both work down the
configuration chain, so any method that is added to a configuration
instance, can be accessed from the top level.

The distinction between default and explicitly set values allows compass
to more correctly manage the serialization of attributes when creating
configuration files for projects.

The compass configuration can still be accessed via
Compass.configuration, however, the configuration object is no longer a
singleton. This means that you can build several configuration chains
to track several projects at once. This should ease the use of compass
in other frameworks and plugins that want to use compass internally.
2009-08-29 13:20:32 -07:00

37 lines
794 B
Ruby

module Compass
module Configuration
ATTRIBUTES = [
:project_type,
:project_path,
:css_dir,
:sass_dir,
:images_dir,
:javascripts_dir,
:css_path,
:sass_path,
:images_path,
:javascripts_path,
:http_path,
:http_images_dir,
:http_stylesheets_dir,
:http_javascripts_dir,
:http_images_path,
:http_stylesheets_path,
:http_javascripts_path,
:output_style,
:environment,
:relative_assets,
:additional_import_paths,
:sass_options,
:asset_host,
:asset_cache_buster
]
end
end
['adapters', 'comments', 'defaults', 'helpers', 'inheritance', 'serialization', 'data'].each do |lib|
require File.join(File.dirname(__FILE__), 'configuration', lib)
end