lib/octopress-ink/assets/asset.rb in octopress-ink-1.0.0.alpha.18 vs lib/octopress-ink/assets/asset.rb in octopress-ink-1.0.0.alpha.19

- old
+ new

@@ -7,10 +7,11 @@ @type = type @plugin = plugin @root = plugin.assets_path @dir = File.join(plugin.namespace, type) @exists = {} + file_check end def file @file end @@ -23,11 +24,11 @@ files << user_path(site) files << plugin_path unless @plugin.type == 'local_plugin' files = files.flatten.reject { |f| !exists? f } unless files.size - raise IOError.new "Could not find #{File.basename(@file)} at #{file}" + raise IOError.new "Could not find #{File.basename(@file)} at #{@file}" end @found_file = Pathname.new files[0] end end @@ -87,9 +88,14 @@ site.static_files.delete(sf) end end end + def file_check + if @plugin.type != 'local_plugin' and !exists? plugin_path + raise "\nPlugin: #{@plugin.name}: Could not find #{File.basename(@file)} at #{plugin_path}".red + end + end def exists?(file) @exists[file] ||= File.exists?(file) @exists[file] end