diff --git a/bin/jekyll b/bin/jekyll index 0855ff03..d135b952 100755 --- a/bin/jekyll +++ b/bin/jekyll @@ -17,6 +17,19 @@ global_option '--safe', 'Safe mode (defaults to false)' global_option '--plugins', 'Plugins directory (defaults to ./_plugins)' global_option '--layouts', 'Layouts directory (defaults to ./_layouts)' +# Option names don't always directly match the configuration value we'd like. +# This method will rename options to match what Jekyll configuration expects. +# +# options - The Hash of options from Commander. +# +# Returns the normalized Hash. +def normalize_options(options) + if drafts_state = options.delete(:drafts) + options[:show_drafts] = drafts_state + end + options +end + command :build do |c| c.syntax = 'jekyll build [options]' c.description = 'Build your site' @@ -29,7 +42,8 @@ command :build do |c| c.action do |args, options| options.defaults :serving => false - options = Jekyll.configuration(options.__hash__) + options = normalize_options(options.__hash__) + options = Jekyll.configuration(options) Jekyll::Commands::Build.process(options) end end @@ -54,7 +68,8 @@ command :serve do |c| :baseurl => '/', :serving => true - options = Jekyll.configuration(options.__hash__) + options = normalize_options(options.__hash__) + options = Jekyll.configuration(options) Jekyll::Commands::Build.process(options) Jekyll::Commands::Serve.process(options) end diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index ad85d42f..18488431 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -25,7 +25,7 @@ module Jekyll self.exclude = config['exclude'] || [] self.include = config['include'] || [] self.future = config['future'] - self.show_drafts = config['drafts'] || nil + self.show_drafts = config['show_drafts'] || nil self.limit_posts = config['limit_posts'] || nil self.keep_files = config['keep_files'] || []