lib/octopress-ink/assets/page.rb in octopress-ink-1.0.0.alpha.33 vs lib/octopress-ink/assets/page.rb in octopress-ink-1.0.0.alpha.34
- old
+ new
@@ -3,39 +3,49 @@
module Octopress
module Ink
module Assets
class PageAsset < Asset
+ attr_reader :filename
- def initialize(plugin, type, file)
+ def initialize(plugin, base, file)
@root = plugin.assets_path
@plugin = plugin
- @type = type
+ @base = base
+ @filename = file
@dir = File.dirname(file)
@file = File.basename(file)
@exists = {}
file_check
end
def page_dir
- @dir == '.' ? '' : @dir
+ dir == '.' ? '' : dir
end
def plugin_path
- File.join(plugin_dir, @dir, @file)
+ File.join(plugin_dir, dir, file)
end
+ def url_info
+ "path: #{page.url.sub(/^\//,'')}"
+ end
+
+ def user_dir
+ File.join Plugins.site.source, Plugins.custom_dir, plugin.slug, base
+ end
+
def page
- @page ||= Page.new(Plugins.site, plugin_dir, page_dir, @file, @plugin.config)
+ @page ||= Page.new(Plugins.site, source_dir, page_dir, file, plugin.config)
end
# Add page to Jekyll pages if no other page has a conflicting destination
#
- def copy
- return unless page.url
- Plugins.site.pages << page unless Helpers::Path.find_page(page)
+ def add
+ if page.url && !Ink.config['docs_mode']
+ Plugins.site.pages << page unless Helpers::Path.find_page(page)
+ end
end
-
end
end
end
end