From 1da3b3ae9bc0e16ff43cf76388d0cce469f0d5ee Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Mon, 2 Feb 2009 18:45:25 -0800 Subject: [PATCH] Add a to method to Manifest::Entry to centralize the logic. --- lib/compass/installers/base.rb | 14 +++++--------- lib/compass/installers/manifest.rb | 6 +++++- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/compass/installers/base.rb b/lib/compass/installers/base.rb index bf2e328c..245e82f4 100644 --- a/lib/compass/installers/base.rb +++ b/lib/compass/installers/base.rb @@ -58,7 +58,7 @@ module Compass # The default install method. Calls install_ methods in the order specified by the manifest. def install manifest.each do |entry| - send("install_#{entry.type}", entry.from, entry.options) + send("install_#{entry.type}", entry.from, entry.to, entry.options) end end @@ -68,23 +68,19 @@ module Compass end - def install_stylesheet(from, options) - to = options[:to] || from + def install_stylesheet(from, to, options) copy from, "#{sass_dir}/#{to}" end - def install_image(from, options) - to = options[:to] || from + def install_image(from, to, options) copy from, "#{images_dir}/#{to}" end - def install_script(from, options) - to = options[:to] || from + def install_script(from, to, options) copy from, "#{javascripts_dir}/#{to}" end - def install_file(from, options) - to = options[:to] || from + def install_file(from, to, options) copy from, to end diff --git a/lib/compass/installers/manifest.rb b/lib/compass/installers/manifest.rb index 6924730c..39a3a9fe 100644 --- a/lib/compass/installers/manifest.rb +++ b/lib/compass/installers/manifest.rb @@ -4,7 +4,11 @@ module Compass class Manifest # 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) @entries = []