Sha256: 49547c3be8554278f6eec0bc0b129fb710599109f51bf9d27db4e9991a3a9991

Contents?: true

Size: 872 Bytes

Versions: 1

Compression:

Stored size: 872 Bytes

Contents

require 'jekyll'
require 'tmpdir'
require 'fileutils'
require 'colorized_string'

namespace :wax do
  desc 'build site with gh-baseurl and publish to gh-pages branch'
  task :ghbranch => :config do
    FileUtils.rm_rf('_site')

    baseurl = $config['gh-baseurl']

    Jekyll::Site.new(Jekyll.configuration({
      "source"      => ".",
      "destination" => "_site",
      "config" => "_config.yml",
      "baseurl" => baseurl,
      "incremental" => true,
      "verbose" => true
    })).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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wax_tasks-0.0.1 lib/tasks/ghbranch.rake