compass/lib/compass/commands/installer_command.rb

39 lines
1.2 KiB
Ruby
Raw Normal View History

require 'compass/installers'
module Compass
module Commands
module InstallerCommand
include Compass::Installers
def configure!
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-25 21:18:58 +00:00
Compass.add_configuration(installer.default_configuration)
Compass.add_project_configuration
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-25 21:18:58 +00:00
Compass.add_configuration(options)
Compass.add_configuration(installer.completed_configuration)
if File.exists?(Compass.configuration.extensions_path)
Compass::Frameworks.discover(Compass.configuration.extensions_path)
end
end
def installer
installer_class = if options[:bare]
"Compass::Installers::BareInstaller"
else
project_type = options[:project_type] || Compass.configuration.project_type
"Compass::AppIntegration::#{camelize(project_type)}::Installer"
end
@installer = eval("#{installer_class}.new *installer_args")
end
# Stolen from ActiveSupport
def camelize(s)
s.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
end
def installer_args
[template_directory(options[:pattern] || "project"), project_directory, options]
end
end
end
end