Skip to content

Commit

Permalink
[Extensions] When installing a file, the :like option can now be set …
Browse files Browse the repository at this point in the history
…to have it installed into the same location as what it is like.
  • Loading branch information
chriseppstein committed Jul 6, 2009
1 parent 6555ab3 commit 21cfce3
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions lib/compass/installers/base.rb
Expand Up @@ -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?
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 21cfce3

Please sign in to comment.