2009-09-03 02:47:01 +00:00
|
|
|
require 'compass/installers'
|
2009-04-07 06:58:53 +00:00
|
|
|
|
|
|
|
module Compass
|
|
|
|
module Commands
|
|
|
|
module InstallerCommand
|
|
|
|
include Compass::Installers
|
|
|
|
|
|
|
|
def configure!
|
2009-08-25 21:18:58 +00:00
|
|
|
Compass.add_configuration(installer.default_configuration)
|
2009-09-02 17:47:21 +00:00
|
|
|
Compass.add_project_configuration
|
2009-08-25 21:18:58 +00:00
|
|
|
Compass.add_configuration(options)
|
|
|
|
Compass.add_configuration(installer.completed_configuration)
|
2009-07-27 05:47:59 +00:00
|
|
|
if File.exists?(Compass.configuration.extensions_path)
|
|
|
|
Compass::Frameworks.discover(Compass.configuration.extensions_path)
|
|
|
|
end
|
2009-04-07 06:58:53 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def installer
|
2009-10-22 16:46:46 +00:00
|
|
|
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
|
2009-09-02 00:22:26 +00:00
|
|
|
@installer = eval("#{installer_class}.new *installer_args")
|
|
|
|
end
|
|
|
|
|
|
|
|
# Stolen from ActiveSupport
|
|
|
|
def camelize(s)
|
|
|
|
s.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
|
2009-04-07 06:58:53 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def installer_args
|
2009-10-04 07:33:36 +00:00
|
|
|
[template_directory(options[:pattern] || "project"), project_directory, options]
|
2009-04-07 06:58:53 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2009-10-04 07:33:36 +00:00
|
|
|
end
|