Class: Awestruct::Deploy::GitHubPagesDeploy
- Defined in:
- lib/awestruct/deploy/github_pages_deploy.rb
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
-
#initialize(site_config, deploy_config) ⇒ GitHubPagesDeploy
constructor
A new instance of GitHubPagesDeploy.
- #publish_site ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(site_config, deploy_config) ⇒ GitHubPagesDeploy
Returns a new instance of GitHubPagesDeploy.
6 7 8 9 10 |
# File 'lib/awestruct/deploy/github_pages_deploy.rb', line 6 def initialize( site_config, deploy_config ) @site_path = site_config.output_dir @branch = deploy_config[ 'branch' ] || 'gh-pages' @repo = deploy_config[ 'repository' ] || 'origin' end |
Instance Method Details
#publish_site ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/awestruct/deploy/github_pages_deploy.rb', line 12 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 |