lib/compass/app_integration.rb in compass-0.8.17 vs lib/compass/app_integration.rb in compass-0.10.0.pre1

- old
+ new

@@ -1,5 +1,24 @@ -# If we're running inside Rails -require File.join(File.dirname(__FILE__), 'app_integration', 'rails') if defined?(ActionController::Base) +%w(stand_alone rails merb).each do |lib| + require "compass/app_integration/#{lib}" +end -# If we're running inside Merb -require File.join(File.dirname(__FILE__), 'app_integration', 'merb') if defined?(Merb::Plugins) +module Compass + module AppIntegration + module Helpers + def lookup(project_type) + eval "Compass::AppIntegration::#{camelize(project_type)}" + rescue NameError + raise Compass::Error, "No application integration exists for #{project_type}" + end + + protected + + # Stolen from ActiveSupport + def camelize(s) + s.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase } + end + + end + extend Helpers + end +end