Verbose Jekyll::Site for githook


#1

Hello all!

I have a Rake task/githook for publishing my compiled _site dir to a gh-pages branch for publishing complex sites to gh-pages that does exactly what I want:

require 'jekyll'

namespace :wax do
  task :gitpub  => :config do
    @destination = "_site" + @config['baseurl'].to_s

    Jekyll::Site.new(Jekyll.configuration({
      "source"      => ".",
      "destination" => @destination,
      "config" => "_config.yml"
    })).process

    origin = `git config --get remote.origin.url`

    Dir.mktmpdir do |tmp|
      cp_r "_site/.", tmp
      Dir.chdir tmp

      system "git init" # Init the repo.
      system "git add . && git commit -m 'Site updated at #{Time.now.utc}'"
      system "git remote add origin #{origin}"
      system "git push origin master:refs/heads/gh-pages --force"
    end
  end
end

My only question is: how do I make the build verbose? When you build in bash, you can just add the --verbose or -V option. But how can I achieve verbosity with Jekyll::Site.new() ?


#2

just add verbose: true to your config above.

    Jekyll::Site.new(Jekyll.configuration({
      "source"      => ".",
      "destination" => @destination,
      "config"      => "_config.yml",
+     "verbose"     => true
    })).process

#3

Should’ve known it would be so simple. Thank you, @ashmaroli !