diff --git a/lib/compass/app_integration/rails/action_controller.rb b/lib/compass/app_integration/rails/actionpack2/action_controller.rb similarity index 100% rename from lib/compass/app_integration/rails/action_controller.rb rename to lib/compass/app_integration/rails/actionpack2/action_controller.rb diff --git a/lib/compass/app_integration/rails/sass_plugin.rb b/lib/compass/app_integration/rails/actionpack2/sass_plugin.rb similarity index 100% rename from lib/compass/app_integration/rails/sass_plugin.rb rename to lib/compass/app_integration/rails/actionpack2/sass_plugin.rb diff --git a/lib/compass/app_integration/rails/urls.rb b/lib/compass/app_integration/rails/actionpack2/urls.rb similarity index 100% rename from lib/compass/app_integration/rails/urls.rb rename to lib/compass/app_integration/rails/actionpack2/urls.rb diff --git a/lib/compass/app_integration/rails/runtime.rb b/lib/compass/app_integration/rails/runtime.rb index 82a353d1..d1a5ed5b 100644 --- a/lib/compass/app_integration/rails/runtime.rb +++ b/lib/compass/app_integration/rails/runtime.rb @@ -1,10 +1,14 @@ unless defined?(Compass::RAILS_LOADED) Compass::RAILS_LOADED = true - - %w(action_controller sass_plugin urls).each do |lib| - require "compass/app_integration/rails/#{lib}" + + if ActionPack::VERSION::MAJOR >= 3 + # figure something out so image_path works with rails integration + else + %w(action_controller sass_plugin urls).each do |lib| + require "compass/app_integration/rails/actionpack2/#{lib}" + end end - + # Wierd that this has to be re-included to pick up sub-modules. Ruby bug? class Sass::Script::Functions::EvaluationContext include Sass::Script::Functions diff --git a/lib/compass/configuration/helpers.rb b/lib/compass/configuration/helpers.rb index c272fead..b9884fd0 100644 --- a/lib/compass/configuration/helpers.rb +++ b/lib/compass/configuration/helpers.rb @@ -31,6 +31,7 @@ module Compass if config.is_a?(Compass::Configuration::Data) config elsif config.respond_to?(:read) + filename ||= config.to_s if config.is_a?(Pathname) Compass::Configuration::Data.new_from_string(config.read, filename) elsif config.is_a?(Hash) Compass::Configuration::Data.new(filename, config) diff --git a/lib/compass/configuration/serialization.rb b/lib/compass/configuration/serialization.rb index ed93686b..902e7556 100644 --- a/lib/compass/configuration/serialization.rb +++ b/lib/compass/configuration/serialization.rb @@ -41,6 +41,7 @@ module Compass eval(contents, bind, filename) ATTRIBUTES.each do |prop| value = eval(prop.to_s, bind) rescue nil + value = value.to_s if value.is_a?(Pathname) self.send("#{prop}=", value) unless value.nil? end if @added_import_paths diff --git a/test/configuration_test.rb b/test/configuration_test.rb index d13c528e..1fca5d1a 100644 --- a/test/configuration_test.rb +++ b/test/configuration_test.rb @@ -93,6 +93,36 @@ css_dir = "css" # To enable relative paths to assets via compass helper functions. Uncomment: # relative_assets = true additional_import_paths = ["../foo", "/path/to/my/framework"] +EXPECTED + assert_equal "/", Compass.configuration.http_path + assert_equal expected_serialization.split("\n"), Compass.configuration.serialize.split("\n") + end + + def test_config_with_pathname + contents = StringIO.new(<<-CONFIG) + http_path = "/" + project_path = Pathname.new("/home/chris/my_compass_project") + css_dir = "css" + additional_import_paths = ["../foo"] + add_import_path "/path/to/my/framework" + CONFIG + + Compass.add_configuration(contents, "test_additional_import_paths") + + assert Compass.configuration.to_sass_engine_options[:load_paths].include?("/home/chris/my_compass_project/../foo") + assert Compass.configuration.to_sass_engine_options[:load_paths].include?("/path/to/my/framework"), Compass.configuration.to_sass_engine_options[:load_paths].inspect + assert_equal "/home/chris/my_compass_project/css/framework", Compass.configuration.to_sass_plugin_options[:template_location]["/path/to/my/framework"] + assert_equal "/home/chris/my_compass_project/css/foo", Compass.configuration.to_sass_plugin_options[:template_location]["/home/chris/my_compass_project/../foo"] + + expected_serialization = <