Permalink
Browse files

[Extensions] When installing a file, the :like option can now be set …

…to have it installed into the same location as what it is like.
  • Loading branch information...
chriseppstein committed Jul 4, 2009
1 parent 6555ab3 commit 21cfce33db81e185ce5517818844a9849b5a836e
Showing with 14 additions and 3 deletions.
  1. +14 −3 lib/compass/installers/base.rb
@@ -31,7 +31,7 @@ def manifest_file
# Initializes the project to work with compass
def init
dirs = manifest.map do |entry|
File.dirname(send("install_location_for_#{entry.type}", entry.to))
File.dirname(send("install_location_for_#{entry.type}", entry.to, entry.options))
end
if manifest.has_stylesheet?
@@ -90,16 +90,27 @@ def pattern_name_as_dir
def self.installer(type, &locator)
locator ||= lambda{|to| to}
loc_method = "install_location_for_#{type}".to_sym
define_method loc_method, locator
define_method("simple_#{loc_method}", locator)
define_method(loc_method) do |to, options|
if options[:like] && options[:like] != type
send("install_location_for_#{options[:like]}", to, options)
else
send("simple_#{loc_method}", to)
end
end
define_method "install_#{type}" do |from, to, options|
copy templatize(from), targetize(send(loc_method, to))
copy templatize(from), targetize(send(loc_method, to, options))
end
end
installer :stylesheet do |to|
"#{sass_dir}/#{pattern_name_as_dir}#{to}"
end
installer :css do |to|
"#{css_dir}/#{to}"
end
installer :image do |to|
"#{images_dir}/#{to}"
end

0 comments on commit 21cfce3

Please sign in to comment.