lib/octopress-ink/assets/asset.rb in octopress-ink-1.0.0.rc.49 vs lib/octopress-ink/assets/asset.rb in octopress-ink-1.0.0.rc.50

- old
+ new

@@ -1,14 +1,13 @@ module Octopress module Ink module Assets class Asset - attr_reader :plugin, :dir, :base, :root, :file, :overridden + attr_reader :plugin, :dir, :base, :root, :file, :replacement attr_accessor :exists FRONT_MATTER = /\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)/m - @overridden = false def initialize(plugin, base, file) @file = file @base = base @plugin = plugin @@ -17,36 +16,46 @@ @exists = {} file_check end def info + " - #{asset_info}" + end + + def asset_info message = filename.ljust(35) - if @overridden - message += "-overridden by #{@overridden}-" + + if replaced? + message += "Replaced by #{@replacement} plugin" elsif disabled? - message += "-disabled-" + message += "Disabled by configuration" elsif path.to_s != plugin_path shortpath = File.join(Plugins.custom_dir.sub(Dir.pwd,''), dir).sub('/','') - message += "from: #{File.join(shortpath,filename).sub('/./', '/')}" + message += "From: #{File.join(shortpath,filename)}" end - " - #{message}" + + message end def filename file end def disabled? - is_disabled(base, filename) || @overridden + @disabled || is_disabled(base, filename) || replaced? end + def replaced? + !@replacement.nil? + end + + def disable + @disabled = true + end + def is_disabled(base, file) config = @plugin.config['disable'] config.include?(base) || config.include?(File.join(base, filename)) - end - - def override(plugin) - @overridden = plugin.name end def path if @found_file @found_file