lib/compass/commands/installer_command.rb in compass-edge-0.9.5.0 vs lib/compass/commands/installer_command.rb in compass-edge-0.10.0.pre
- old
+ new
@@ -4,31 +4,27 @@
module Commands
module InstallerCommand
include Compass::Installers
def configure!
- if respond_to?(:is_project_creation?) && is_project_creation?
- Compass.add_configuration(options.delete(:project_type) || :stand_alone)
- else
- Compass.add_project_configuration(:project_type => options.delete(:project_type))
- end
- Compass.add_configuration(options, 'command_line')
+ Compass.add_configuration(installer.default_configuration)
+ Compass.add_project_configuration
+ 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
- Compass.add_configuration(installer.completed_configuration, 'installer')
end
- def app
- @app ||= Compass::AppIntegration.lookup(Compass.configuration.project_type)
+ def installer
+ project_type = options[:project_type] || Compass.configuration.project_type
+ installer_class = "Compass::AppIntegration::#{camelize(project_type)}::Installer"
+ @installer = eval("#{installer_class}.new *installer_args")
end
- def installer
- @installer ||= if options[:bare]
- Compass::Installers::BareInstaller.new(*installer_args)
- else
- app.installer(*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