Permalink
Browse files

[Configuration] A more logical and consistent approach to http path l…

…ocations.
  • Loading branch information...
chriseppstein committed Jul 4, 2009
1 parent 956c437 commit 6555ab3952ae37d736d54f43ee7053c2a88f4a69
Showing with 18 additions and 4 deletions.
  1. +12 −4 lib/compass/configuration.rb
  2. +6 −0 test/configuration_test.rb
@@ -7,6 +7,7 @@ class Configuration
ATTRIBUTES = [
:project_type,
:project_path,
:http_path,
:css_dir,
:sass_dir,
:images_dir,
@@ -15,6 +16,8 @@ class Configuration
:environment,
:relative_assets,
:http_images_path,
:http_stylesheets_path,
:http_javascripts_path,
:additional_import_paths,
:sass_options
]
@@ -93,12 +96,12 @@ def default_images_dir
"images"
end
def default_http_images_path
"/#{images_dir}"
def default_http_path
"/"
end
def comment_for_http_images_path
"# To enable relative image paths using the images_url() function:\n# http_images_path = :relative\n"
def comment_for_http_path
"# Set this to the root of your project when deployed:\n"
end
def relative_assets?
@@ -140,6 +143,11 @@ def css_path
end
end
def mk_http_path(path)
hp = http_path[0..-2] if http_path[-1..-1] == "/"
"#{hp}/#{path}"
end
def add_import_path(*paths)
# The @added_import_paths variable works around an issue where
# the additional_import_paths gets overwritten during parse
@@ -13,6 +13,8 @@ def test_parse_and_serialize
# Require any additional compass plugins here.
project_type = :stand_alone
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "css"
sass_dir = "sass"
images_dir = "img"
@@ -64,6 +66,7 @@ def test_serialization_fails_with_asset_cache_buster_set
def test_additional_import_paths
contents = <<-CONFIG
http_path = "/"
project_path = "/home/chris/my_compass_project"
css_dir = "css"
additional_import_paths = ["../foo"]
@@ -80,11 +83,14 @@ def test_additional_import_paths
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
assert_equal "/", Compass.configuration.http_path
assert_equal expected_serialization, Compass.configuration.serialize
end

0 comments on commit 6555ab3

Please sign in to comment.