Merge commit 'merbjedi/master'
* commit 'merbjedi/master': Adding Pathname support to compass configs Adding PathName support for add_project_configuration Separating out Rails2 actionpack integration logic
This commit is contained in:
commit
0c593e2c25
@ -1,10 +1,14 @@
|
|||||||
unless defined?(Compass::RAILS_LOADED)
|
unless defined?(Compass::RAILS_LOADED)
|
||||||
Compass::RAILS_LOADED = true
|
Compass::RAILS_LOADED = true
|
||||||
|
|
||||||
%w(action_controller sass_plugin urls).each do |lib|
|
if ActionPack::VERSION::MAJOR >= 3
|
||||||
require "compass/app_integration/rails/#{lib}"
|
# 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
|
end
|
||||||
|
|
||||||
# Wierd that this has to be re-included to pick up sub-modules. Ruby bug?
|
# Wierd that this has to be re-included to pick up sub-modules. Ruby bug?
|
||||||
class Sass::Script::Functions::EvaluationContext
|
class Sass::Script::Functions::EvaluationContext
|
||||||
include Sass::Script::Functions
|
include Sass::Script::Functions
|
||||||
|
@ -31,6 +31,7 @@ module Compass
|
|||||||
if config.is_a?(Compass::Configuration::Data)
|
if config.is_a?(Compass::Configuration::Data)
|
||||||
config
|
config
|
||||||
elsif config.respond_to?(:read)
|
elsif config.respond_to?(:read)
|
||||||
|
filename ||= config.to_s if config.is_a?(Pathname)
|
||||||
Compass::Configuration::Data.new_from_string(config.read, filename)
|
Compass::Configuration::Data.new_from_string(config.read, filename)
|
||||||
elsif config.is_a?(Hash)
|
elsif config.is_a?(Hash)
|
||||||
Compass::Configuration::Data.new(filename, config)
|
Compass::Configuration::Data.new(filename, config)
|
||||||
|
@ -41,6 +41,7 @@ module Compass
|
|||||||
eval(contents, bind, filename)
|
eval(contents, bind, filename)
|
||||||
ATTRIBUTES.each do |prop|
|
ATTRIBUTES.each do |prop|
|
||||||
value = eval(prop.to_s, bind) rescue nil
|
value = eval(prop.to_s, bind) rescue nil
|
||||||
|
value = value.to_s if value.is_a?(Pathname)
|
||||||
self.send("#{prop}=", value) unless value.nil?
|
self.send("#{prop}=", value) unless value.nil?
|
||||||
end
|
end
|
||||||
if @added_import_paths
|
if @added_import_paths
|
||||||
|
@ -93,6 +93,36 @@ css_dir = "css"
|
|||||||
# To enable relative paths to assets via compass helper functions. Uncomment:
|
# To enable relative paths to assets via compass helper functions. Uncomment:
|
||||||
# relative_assets = true
|
# relative_assets = true
|
||||||
additional_import_paths = ["../foo", "/path/to/my/framework"]
|
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 = <<EXPECTED
|
||||||
|
# Require any additional compass plugins here.
|
||||||
|
project_path = "/home/chris/my_compass_project"
|
||||||
|
# Set this to the root of your project when deployed:
|
||||||
|
http_path = "/"
|
||||||
|
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
|
EXPECTED
|
||||||
assert_equal "/", Compass.configuration.http_path
|
assert_equal "/", Compass.configuration.http_path
|
||||||
assert_equal expected_serialization.split("\n"), Compass.configuration.serialize.split("\n")
|
assert_equal expected_serialization.split("\n"), Compass.configuration.serialize.split("\n")
|
||||||
|
Loading…
Reference in New Issue
Block a user