Jekyll Sub-commands #726

Closed
wants to merge 12 commits into
from

Projects

None yet

7 participants

Owner
parkr commented Jan 2, 2013

bin/jekyll has grown to the point where it would be easier to maintain in small chunks, rather than as one big script with many different pieces all jammed together.

These changes accomplish three things:

  1. Separate bin/jekyll into bin/jekyll and bin/jekyll-import commands
  2. Added code to bin/jekyll to support sub-commands
  3. Add support for the jekyll init sub-command, which creates a scaffold in a specified directory or Dir.pwd.

This is an alternative plan to @tombell's "The Big Jekyll Command Cleanup" (#690).

I've always preferred working with sub-commands in this way: each sub-command script has only one piece of the responsibility of making Jekyll go, and only deals with one thing.

This will make adding on generators (e.g., jekyll generate post lalala) less painful.

Owner
parkr commented Jan 2, 2013

Extension upon #461.

Why not use "jekyll new" instead of "jekyll init"? I think the "new" keyword is widely used by other generators and probably easier to grasp if you don't come from a programming background. Rails uses "new" for what it's worth.

Owner
parkr replied Jan 2, 2013

I'd consider using jekyll new for sure.

Owner

jekyll new seems much better. 👍

So it creates them! Right? ;)

(This is an old commit, just so you know).

Contributor
tombell commented Jan 3, 2013

What advantages does this have over my proposed changes to the jekyll command?

Owner
parkr commented Jan 3, 2013

I think this is a bit easier to extend, because you just have to write a new file (bin/jekyll-whatever) in order to use whatever new command you want to use.

Owner
parkr commented Jan 4, 2013

It also doesn't require Yet Another Gem Dependency, which I like.

Contributor
tombell commented Jan 4, 2013

I'd prefer 1 gem over unreadable option parsing.

@parkr parkr commented on the diff Jan 10, 2013
bin/jekyll-import
@@ -0,0 +1,80 @@
+#!/usr/bin/env ruby
+$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
+
+require 'optparse'
+require 'jekyll'
+
parkr
parkr Jan 10, 2013 Owner
begin
  require 'jekyll-migrator'
rescue
  puts "Please install the jekyll-migrator gem."
  exit(1)
end
@parkr parkr closed this Jan 11, 2013
@jekyllbot jekyllbot locked and limited conversation to collaborators Feb 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.