Sha256: 6df7749d54d9beee3fe27ec1bcd6d4558a13f4238afe49171acfb0932405cd13

Contents?: true

Size: 1.47 KB

Versions: 11

Compression:

Stored size: 1.47 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 DocPageAsset < 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

        def path
          File.join(plugin_dir, page_dir, file)
        end
        
        # Add doc page to Jekyll pages
        #
        def add
          if Ink.config['docs_mode']
            Ink.site.pages << page
          end
        end

        private

        def page
          return @page if @page
          @page = Page.new(Ink.site, source_dir, page_dir, file, {'path'=>plugin.docs_base_path})
          @page.data['layout'] = 'docs'
          @page.data['plugin'] = { 
            'name' => @plugin.name, 
            'slug' => @plugin.slug,
            'docs_base_path' => plugin.docs_base_path,
          }
          @page.data['dir'] = File.dirname(plugin_path)
          @page
        end

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

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

        def source_dir
          File.join root, base
        end

      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
octopress-ink-1.0.0.rc.11 lib/octopress-ink/assets/doc_page.rb
octopress-ink-1.0.0.rc.10 lib/octopress-ink/assets/doc_page.rb
octopress-ink-1.0.0.rc.9 lib/octopress-ink/assets/doc_page.rb
octopress-ink-1.0.0.rc.8 lib/octopress-ink/assets/doc_page.rb
octopress-ink-1.0.0.rc.7 lib/octopress-ink/assets/doc_page.rb
octopress-ink-1.0.0.rc.6 lib/octopress-ink/assets/doc_page.rb
octopress-ink-1.0.0.rc.5 lib/octopress-ink/assets/doc_page.rb
octopress-ink-1.0.0.rc.3 lib/octopress-ink/assets/doc_page.rb
octopress-ink-1.0.0.rc.2 lib/octopress-ink/assets/doc_page.rb
octopress-ink-1.0.0.rc.1 lib/octopress-ink/assets/doc_page.rb
octopress-ink-1.0.0.alpha.45 lib/octopress-ink/assets/doc_page.rb