Sha256: d6f78da3201946f84105b9ca6bdcb6c71ea2160e1b19a719aee3e3894ecec1f3

Contents?: true

Size: 1.4 KB

Versions: 3

Compression:

Stored size: 1.4 KB

Contents

module Octopress
  module Ink
    if defined?(Jekyll::Hooks)

      Jekyll::Hooks.register :site, :after_reset do |site|
        Ink.watch_assets(site)
        if Plugins.registered
          Plugins.reset
        end
      end

      Jekyll::Hooks.register :site, :post_read do |site|
        Octopress.site = site
        Ink::Plugins.register
        Ink::Plugins.add_files
      end

      Jekyll::Hooks.register :site, :pre_render do |site, payload|
        Ink.payload.each do |key, val|
          payload[key] = val
        end
      end

      Jekyll::Hooks.register :site, :post_write do |site|
        Octopress::Ink::Plugins.static_files.each do |f| 
          f.write(site.dest)
        end

        Octopress::Ink::Cache.write
        Octopress::Ink::Cache.clean
      end
    else
      class SiteHook < Hooks::Site
        def reset(site)
          Ink.watch_assets(site)
          if Plugins.registered
            Plugins.reset
          end
        end

        def post_read(site)
          Octopress.site = site
          Ink::Plugins.register
          Ink::Plugins.add_files
        end

        def merge_payload(payload, site)
          Ink.payload
        end

        def post_write(site)
          Octopress::Ink::Plugins.static_files.each do |f| 
            f.write(site.dest)
          end

          Octopress::Ink::Cache.write
          Octopress::Ink::Cache.clean
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
octopress-ink-1.2.1 lib/octopress-ink/jekyll/hooks.rb
octopress-ink-1.2.0 lib/octopress-ink/jekyll/hooks.rb
octopress-ink-1.1.4 lib/octopress-ink/jekyll/hooks.rb