Sha256: 1bba3a2a7bb1a7c751ddfe971e1546c44aa0337776c166f005dfc686ef5b99b9

Contents?: true

Size: 1.89 KB

Versions: 1

Compression:

Stored size: 1.89 KB

Contents

#!/usr/bin/env ruby
STDOUT.sync = true

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))

require "jekyll-plus"
require "mercenary"

Jekyll::PluginManager.require_from_bundler

Jekyll::Deprecator.process(ARGV)

Mercenary.program(:"jekyll+") do |p|
  p.version JekyllPlus::VERSION
  p.description "JekyllPlus is a tool that simplifies the installation and usage" \
                " of a Jekyll Site linked to a gem-based Jekyll Theme."
  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_dir", "-p", "--plugins DIR1[,DIR2[,...]]", Array,
    "Plugins directory (defaults to ./_plugins)"
  p.option "layouts_dir", "--layouts DIR", String,
    "Layouts directory (defaults to ./_layouts)"
  p.option "profile", "--profile", "Generate a Liquid rendering profile"

  Jekyll::External.require_if_present(Jekyll::External.blessed_gems) do |g|
    cmd = g.split("-").last
    p.command(cmd.to_sym) do |c|
      c.syntax cmd
      c.action do
        Jekyll.logger.abort_with "You must install the '#{g}' gem" \
          " to use the 'jekyll #{cmd}' command."
      end
    end
  end

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

  p.action do |args, _|
    if args.empty?
      Jekyll.logger.error "A subcommand is required."
      puts p
      abort
    else
      subcommand = args.first
      unless p.has_command? subcommand
        Jekyll.logger.abort_with "FATAL: 'jekyll+ #{args.first}' could not" \
          " be found. You may need to install the jekyll-#{args.first} gem" \
          " or a related gem to be able to use this subcommand.".bold
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jekyll-plus-0.2.0 exe/jekyll+