Sha256: 697c7c760d5a08983196ede9c49612b90ef3bfb754efc72bd75f3db3df334c5f
Contents?: true
Size: 1.19 KB
Versions: 1
Compression:
Stored size: 1.19 KB
Contents
require 'awestruct/deploy/base_deploy' module Awestruct module Deploy class GitHubPagesDeploy < Base def initialize( site_config, deploy_config ) @site_path = site_config.output_dir @branch = deploy_config[ 'branch' ] || 'gh-pages' @repo = deploy_config[ 'repository' ] || 'origin' end def publish_site current_branch = git.current_branch # we may be on a detached branch, # in which case use that commit as the branch if current_branch == '(no branch)' current_branch = git.revparse('HEAD') end git.branch( @branch ).checkout add_and_commit_site @site_path git.push( @repo, @branch ) git.checkout( current_branch ) end private def add_and_commit_site( path ) git.with_working( path ) do git.add(".") begin git.commit("Published #{@branch} to GitHub pages.") rescue ::Git::GitExecuteError => e $stderr.puts "Can't commit. #{e}." end end git.reset_hard end end end end Awestruct::Deployers.instance[ :github_pages ] = Awestruct::Deploy::GitHubPagesDeploy
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
awestruct-0.4.8 | lib/awestruct/deploy/github_pages_deploy.rb |