mirror of
https://github.com/jekyll/jekyll.git
synced 2026-04-06 03:01:43 -04:00
Not all migrators can actually be calld from the comand line. Some require options which are not passed in and have to be called by other means.
73 lines
2.3 KiB
Ruby
Executable File
73 lines
2.3 KiB
Ruby
Executable File
#!/usr/bin/env ruby
|
|
|
|
$:.unshift File.join(File.dirname(__FILE__), *%w{ .. lib })
|
|
|
|
require 'commander/import'
|
|
require 'jekyll'
|
|
|
|
# Details about Jekyll
|
|
program :name, 'jekyll'
|
|
program :version, Jekyll::VERSION
|
|
program :description, 'Jekyll is a blog-aware, static site generator in Ruby'
|
|
|
|
default_command :help
|
|
|
|
# Global options available to every command
|
|
global_option '-s', '--source [DIR]', 'Source directory (defaults to ./)'
|
|
global_option '-d', '--destination [DIR]', 'Destination directory (defaults to ./_site)'
|
|
global_option '--safe', 'Safe mode (defaults to false)'
|
|
global_option '--plugins', 'Plugins directory (defaults to ./_plugins)'
|
|
global_option '--layouts', 'Layouts directory (defaults to ./_layouts)'
|
|
|
|
command :build do |c|
|
|
c.syntax = 'jekyll build [options]'
|
|
c.description = 'Build your site with the option of auto-renegeration'
|
|
|
|
c.option '-w', '--watch', 'Watch for changes and rebuild'
|
|
c.option '--lsi', 'Use LSI for improved related posts'
|
|
|
|
c.action do |args, options|
|
|
options.defaults :serving => false
|
|
options = Jekyll.configuration(options.__hash__)
|
|
Jekyll::BuildCommand.process(options)
|
|
end
|
|
end
|
|
|
|
command :serve do |c|
|
|
c.syntax = 'jekyll serve [options]'
|
|
c.description = 'Serve your site locally with the option of auto-regeneration'
|
|
|
|
c.option '-w', '--watch', 'Watch for changes and rebuild'
|
|
c.option '--lsi', 'Use LSI for improved related posts'
|
|
|
|
c.option '-p', '--port [PORT]', 'Port to listen on'
|
|
c.option '-h', '--host [HOST]', 'Host to bind to'
|
|
c.option '-b', '--baseurl [URL]', 'Base URL'
|
|
|
|
c.action do |args, options|
|
|
options.default :port => '4000',
|
|
:host => '0.0.0.0',
|
|
:baseurl => '/',
|
|
:serving => true
|
|
|
|
options = Jekyll.configuration(options.__hash__)
|
|
Jekyll::BuildCommand.process(options)
|
|
Jekyll::ServeCommand.process(options)
|
|
end
|
|
end
|
|
|
|
command :migrate do |c|
|
|
c.syntax = 'jekyll migrate <platform> [options]'
|
|
c.description = 'Migrate your own blog to Jekyll'
|
|
|
|
c.option '--file', 'File to migrate from'
|
|
c.option '--dbname', 'Database name to migrate from'
|
|
c.option '--user', 'Username to use when migrating'
|
|
c.option '--pass', 'Password to use when migrating'
|
|
c.option '--host', 'Host address to use when migrating'
|
|
|
|
c.action do |args, options|
|
|
Jekyll::MigrateCommand.process(args.first, options)
|
|
end
|
|
end
|