Skip to content

Commit

Permalink
Converted jekyll_ext into a gem (now at version 0.1.0 due to alterati…
Browse files Browse the repository at this point in the history
…ons to how extensions are loaded)

Close gh-1
  • Loading branch information
rfelix committed Jun 21, 2010
1 parent 19b2834 commit 72af809
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 21 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
dist/*
16 changes: 4 additions & 12 deletions README.textile
Expand Up @@ -7,18 +7,10 @@ More information can be found here: "Jekyll Extensions -= Pain":http://rfelix.co

h2. Installation

(This was extracted from the blog post "Jekyll Extensions -= Pain":http://rfelix.com/2010/01/19/jekyll-extensions-minus-equal-pain/)
<code>gem install jekyll_ext</code>

# Grab the "jekyll_ext":http://github.com/rfelix/jekyll_ext code from GitHub:
<code>git clone git://github.com/rfelix/jekyll_ext.git</code>
# Locate the _lib_ directory in the Jekyll gem installation.
<code>which jekyll</code> should give you the path to the executable.
In my case, it displayed <code>/Users/rfelix/.gem/ruby/1.8/bin/jekyll</code>, therefore the _lib_ directory is located at <code>/Users/rfelix/.gem/ruby/1.8/gems/jekyll-0.5.7/lib/</code>
# Open up the _jekyll_ file in the _jekyll_ext_ directory and edit the constants <code>JEKYLL_LIB</code> and <code>JEKYLL_EXT</code> to contain the paths to the Jekyll gem _lib_ dir and the _jekyll_ext_ dir, respectively.
# Now you have two options:
** *symlink the _jekyll_ script* to a path in your PATH environment, but make sure that the path is consulted before the Ruby gems path. You can confirm the right _jekyll_ is being used by issuing <code>jekyll --version</code> which should give you: <code>Jekyll (extended) 0.5.7</code>
** Or, *replace the _jekyll_ file in the Ruby gems directory* (that you obtained from step 2) with a symlink to the file in <code>jekyll_ext/jekyll</code>.
Now you just need to create the directory <em>_extensions</em> in your blog where all your extensions will live. Any <em>.rb</em> file in that directory or subdirectory will automatically be loaded by <em>jekyll_ext</em>.

Now you just need to create the directory <em>_extensions/</em> in your blog and create the file <em>_extensions/jekyll_ext.rb</em> which should load all the extensions that your blog uses.
IMPORTANT: Instead of using the <code>jekyll</code> command, you should now use <code>ejekyll</code> instead (which is just a jekyll wrapper that loads your extensions).

You can use my own extensions to help you get started: "my_jekyll_extensions":http://github.com/rfelix/my_jekyll_extensions
To get you started, take a look at my own <em>_extensions</em> directory: "my_jekyll_extensions":http://github.com/rfelix/my_jekyll_extensions
5 changes: 5 additions & 0 deletions Rakefile
@@ -0,0 +1,5 @@
require "rake"
require "rake/clean"
require "mg"

MG.new("jekyll_ext.gemspec")
1 change: 1 addition & 0 deletions VERSION
@@ -0,0 +1 @@
0.1.0
4 changes: 2 additions & 2 deletions jekyll → bin/ejekyll
Expand Up @@ -5,15 +5,15 @@
require 'rubygems'
require 'jekyll'

require File.join(File.dirname(__FILE__), 'aop', 'aop.rb')
require File.join(File.dirname(__FILE__), '..', 'lib', 'aop.rb')

module Jekyll

class << self
alias_method :configuration_without_extensions, :configuration
def configuration_with_extensions(options)
options = configuration_without_extensions(options)
Dir["_extensions/*.rb"].each do |f|
Dir["_extensions/*.rb", "_extensions/*/*.rb"].each do |f|
puts "Loading Extension: #{File.basename(f)}"
load f
end
Expand Down
7 changes: 0 additions & 7 deletions extensions.rb

This file was deleted.

18 changes: 18 additions & 0 deletions jekyll_ext.gemspec
@@ -0,0 +1,18 @@
# -*- encoding: utf-8 -*-

Gem::Specification.new do |spec|
spec.name = 'jekyll_ext'
spec.summary = "Create Jekyll extensions that are local to your blog and that can be shared with others"
spec.version = File.read(File.dirname(__FILE__) + '/VERSION').strip
spec.authors = ['Raoul Felix']
spec.email = 'gems@rfelix.com'
spec.description = <<-END
jekyll_ext allows you to extend the Jekyll static blog generator without forking
and modifying it's codebase. With this code, not only do your extensions live in
your blog directory, but they can also be shared and reutilized.
END
spec.executables = ['ejekyll']
spec.add_development_dependency('mg')
spec.files = Dir['lib/*', 'vendor/*', 'bin/*'] + ['Rakefile', 'README.textile']
spec.homepage = 'http://rfelix.com/2010/01/19/jekyll-extensions-minus-equal-pain/'
end
File renamed without changes.

0 comments on commit 72af809

Please sign in to comment.