diff --git a/bin/jekyll2 b/bin/jekyll2 index eba186dd..34d040aa 100755 --- a/bin/jekyll2 +++ b/bin/jekyll2 @@ -28,7 +28,7 @@ command :build do |c| c.description = 'Build your site with the option of auto-renegeration' c.option '-w', '--watch', 'Watch for changes and rebuild' c.action do |args, options| - Jekyll::BuildCommand.process(options) + Jekyll::BuildCommand.process(options.__hash__) end end @@ -55,7 +55,7 @@ command :serve do |c| :baseurl => '/', :serving => true - Jekyll::BuildCommand.process(options) - Jekyll::ServeCommand.process(options) + Jekyll::BuildCommand.process(options.__hash__) + Jekyll::ServeCommand.process(options.__hash__) end end diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 058fd762..98f99402 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -123,6 +123,9 @@ module Jekyll # # Returns the final configuration Hash. def self.configuration(override) + # Convert any symbol keys to strings and remove the old key/values + override.keys.each { |k| override[k.to_s] = override.delete(k) } + # _config.yml may override default source location, but until # then, we need to know where to look for _config.yml source = override['source'] || Jekyll::DEFAULTS['source'] diff --git a/lib/jekyll/commands/build.rb b/lib/jekyll/commands/build.rb index d5a0e570..6c8a1254 100644 --- a/lib/jekyll/commands/build.rb +++ b/lib/jekyll/commands/build.rb @@ -2,21 +2,16 @@ module Jekyll class BuildCommand < Command def self.process(options) - opts = {} - options.__hash__.map do |k,v| - opts[k.to_s] = v - end + options = Jekyll.configuration(options) + site = Jekyll::Site.new(options) - opts = Jekyll.configuration(opts) - site = Jekyll::Site.new(opts) + source = options['source'] + destination = options['destination'] - source = opts['source'] - destination = opts['destination'] - - if opts['watch'] - self.watch(site, opts) + if options['watch'] + self.watch(site, options) else - self.build(site, opts) + self.build(site, options) end end diff --git a/lib/jekyll/commands/serve.rb b/lib/jekyll/commands/serve.rb index 665a26cf..df717bea 100644 --- a/lib/jekyll/commands/serve.rb +++ b/lib/jekyll/commands/serve.rb @@ -5,7 +5,7 @@ module Jekyll require 'webrick' include WEBrick - destination = options.destination + destination = options['destination'] FileUtils.mkdir_p(destination) @@ -13,12 +13,12 @@ module Jekyll mime_types.store 'js', 'application/javascript' s = HTTPServer.new( - :Port => options.port, - :BindAddress => options.host, + :Port => options['port'], + :BindAddress => options['host'], :MimeTypes => mime_types ) - s.mount(options.baseurl, HTTPServlet::FileHandler, destination) + s.mount(options['baseurl'], HTTPServlet::FileHandler, destination) t = Thread.new { s.start } trap("INT") { s.shutdown } t.join()