Skip to content
This repository
executable file 41 lines (32 sloc) 1.205 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
#!/usr/bin/env ruby
STDOUT.sync = true

$:.unshift File.join(File.dirname(__FILE__), *%w{ .. lib })

require 'jekyll'
require 'mercenary'

%w[jekyll-import].each do |blessed_gem|
  begin
    require blessed_gem
  rescue LoadError
  end
end

Jekyll::Deprecator.process(ARGV)

Mercenary.program(:jekyll) do |p|
  p.version Jekyll::VERSION
  p.description 'Jekyll is a blog-aware, static site generator in Ruby'
  p.syntax 'jekyll <subcommand> [options]'

  p.option 'source', '-s', '--source [DIR]', 'Source directory (defaults to ./)'
  p.option 'destination', '-d', '--destination [DIR]', 'Destination directory (defaults to ./_site)'
  p.option 'safe', '--safe', 'Safe mode (defaults to false)'
  p.option 'plugins', '-p', '--plugins PLUGINS_DIR1[,PLUGINS_DIR2[,...]]', Array, 'Plugins directory (defaults to ./_plugins)'
  p.option 'layouts', '--layouts DIR', String, 'Layouts directory (defaults to ./_layouts)'

  Jekyll::Command.subclasses.each { |c| c.init_with_program(p) }

  p.action do |args, options|
    if args.empty?
      puts p
    else
      unless p.has_command?(args.first)
        Jekyll.logger.abort_with "Invalid command. Use --help for more information"
      end
    end
  end
end
Something went wrong with that request. Please try again.