Permalink
Browse files

Support for Jekyll 2 & 3

  • Loading branch information...
1 parent b8ab7c5 commit 8ae54dcb297716b8b506e5f6d9a55504316d99ec @imathis imathis committed May 13, 2015
Showing with 53 additions and 16 deletions.
  1. +1 −0 .gitignore
  2. +1 −2 .travis.yml
  3. +5 −0 CHANGELOG.md
  4. +5 −0 lib/octopress-ink/assets/coffeescript.rb
  5. +35 −6 lib/octopress-ink/jekyll/hooks.rb
  6. +6 −8 octopress-ink.gemspec
View
@@ -21,3 +21,4 @@ test/site
.code-highlighter-cache
_site
.ink-cache
+.jekyll-metadata
View
@@ -1,8 +1,7 @@
language: ruby
rvm:
- 2.0.0
- - 1.9.3
-script: bundle exec clash 1-14
+script: clash 1-14
notifications:
slack:
secure: cF+Q0YpLF1q0xIO2aIDG6pSF5pDG6qBMEMpypcExkFolrcmSgvsK+AxeQ9RD0OSIPpET7Kip9SUHR1tu7du4JXxPjvkTQvR/iMHaYbKwAqGdDKoksiqxS6HdIsXQBSUFg4p+YY5HiCJErGZWV+H3NF16GbAipAH1zGBIedZYwJk=
View
@@ -1,5 +1,10 @@
# Changelog
+### 1.1.2 (2015-05-12)
+- Use Jekyll Hooks if you got 'em.
+- Now supporting Jekyll 2 & 3
+- In Jekyll 3 Coffeescript is optional - Added a request to install the gem if a plugin uses it but it is not present.
+
### 1.1.1 (2015-05-11)
- Minor: Gemspec dependency updates.
@@ -13,6 +13,11 @@ def add
end
def content
+ begin
+ require 'jekyll-coffeescript'
+ rescue LoadError
+ raise "Add gem jekyll-coffeescript to Gemfile (or gemspec)."
+ end
::CoffeeScript.compile(super)
end
@@ -1,31 +1,60 @@
module Octopress
module Ink
- class SiteHook < Hooks::Site
+ if defined?(Jekyll::Hooks)
- def reset(site)
+ Jekyll::Hooks.register :site, :after_reset do |site|
Ink.watch_assets(site)
if Plugins.registered
Plugins.reset
end
end
- def post_read(site)
+ Jekyll::Hooks.register :site, :post_read do |site|
Octopress.site = site
Ink::Plugins.register
Ink::Plugins.add_files
end
- def merge_payload(payload, site)
- Ink.payload
+ Jekyll::Hooks.register :site, :pre_render do |site, payload|
+ Ink.payload.each do |key, val|
+ payload[key] = val
+ end
end
- def post_write(site)
+ Jekyll::Hooks.register :site, :post_write do |site|
Octopress::Ink::Plugins.static_files.each do |f|
f.write(site.dest)
end
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.clean
+ end
+ end
end
end
end
View
@@ -18,23 +18,21 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency "jekyll", ">= 2.0"
+
spec.add_runtime_dependency "uglifier", "~> 2.5"
spec.add_runtime_dependency "octopress-hooks", "~> 2.2"
spec.add_runtime_dependency "octopress-include-tag", "~> 1.0"
spec.add_runtime_dependency "octopress-filters", "~> 1.1"
- spec.add_runtime_dependency "octopress-date-format", "~> 3.0"
- spec.add_runtime_dependency "octopress-autoprefixer", "~> 1.0"
+ spec.add_runtime_dependency "octopress-date-format"
+ spec.add_runtime_dependency "octopress-autoprefixer"
spec.add_runtime_dependency "octopress", "~> 3.0"
spec.add_development_dependency "rake"
spec.add_development_dependency "clash"
spec.add_development_dependency "octopress-multilingual"
spec.add_development_dependency "octopress-linkblog"
+ spec.add_development_dependency "jekyll-coffeescript"
- if RUBY_VERSION >= "2"
- spec.add_development_dependency "bundler", "~> 1.7"
- spec.add_development_dependency "octopress-debugger"
- else
- spec.add_development_dependency "bundler", "~> 1.6"
- end
+ spec.add_development_dependency "bundler", "~> 1.7"
+ spec.add_development_dependency "octopress-debugger"
end

0 comments on commit 8ae54dc

Please sign in to comment.