Add a to method to Manifest::Entry to centralize the logic.

This commit is contained in:
Chris Eppstein 2009-02-02 18:45:25 -08:00
parent d2a3046526
commit 1da3b3ae9b
2 changed files with 10 additions and 10 deletions

View File

@ -58,7 +58,7 @@ module Compass
# The default install method. Calls install_<type> methods in the order specified by the manifest. # The default install method. Calls install_<type> methods in the order specified by the manifest.
def install def install
manifest.each do |entry| manifest.each do |entry|
send("install_#{entry.type}", entry.from, entry.options) send("install_#{entry.type}", entry.from, entry.to, entry.options)
end end
end end
@ -68,23 +68,19 @@ module Compass
end end
def install_stylesheet(from, options) def install_stylesheet(from, to, options)
to = options[:to] || from
copy from, "#{sass_dir}/#{to}" copy from, "#{sass_dir}/#{to}"
end end
def install_image(from, options) def install_image(from, to, options)
to = options[:to] || from
copy from, "#{images_dir}/#{to}" copy from, "#{images_dir}/#{to}"
end end
def install_script(from, options) def install_script(from, to, options)
to = options[:to] || from
copy from, "#{javascripts_dir}/#{to}" copy from, "#{javascripts_dir}/#{to}"
end end
def install_file(from, options) def install_file(from, to, options)
to = options[:to] || from
copy from, to copy from, to
end end

View File

@ -4,7 +4,11 @@ module Compass
class Manifest class Manifest
# A Manifest entry # A Manifest entry
Entry = Struct.new(:type, :from, :options) class Entry < Struct.new(:type, :from, :options)
def to
options[:to] || from
end
end
def initialize(manifest_file = nil) def initialize(manifest_file = nil)
@entries = [] @entries = []