Sha256: 7d85aa2dd514a51cdedbe595ee266e2f7f769c7370e24920f7c101cbea1e5eed

Contents?: true

Size: 1.25 KB

Versions: 4

Compression:

Stored size: 1.25 KB

Contents

# These are files which need to be in added to the root of the site directory
# Use root assets for files like robots.text or favicon.ico

module Octopress
  module Ink
    module Assets
      class PageAsset < Asset
        attr_reader :filename

        def initialize(plugin, base, file)
          @root = plugin.assets_path
          @plugin = plugin
          @base = base
          @filename = file
          @dir  = File.dirname(file)
          @file = File.basename(file)
          @exists = {}
          file_check
        end

        # Add page to Jekyll pages if no other page has a conflicting destination
        #
        def add
          if page.url && !Ink.config['docs_mode']
            Ink.site.pages << page unless Helpers::Path.find_page(page)
          end
        end

        private

        def page_dir
          dir == '.' ? '' : dir
        end

        def plugin_path
          File.join(plugin_dir, dir, file)
        end

        def url_info
          "/#{page.url.sub(/^\//,'')}"
        end

        def user_dir
          File.join Ink.site.source, Plugins.custom_dir, plugin.slug, base
        end

        def page
          @page ||= Page.new(Ink.site, source_dir, page_dir, file, plugin.config)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
octopress-ink-1.0.0.rc.3 lib/octopress-ink/assets/page.rb
octopress-ink-1.0.0.rc.2 lib/octopress-ink/assets/page.rb
octopress-ink-1.0.0.rc.1 lib/octopress-ink/assets/page.rb
octopress-ink-1.0.0.alpha.45 lib/octopress-ink/assets/page.rb