Class: Bard::DeployStrategy::GithubPages

Inherits:
Bard::DeployStrategy show all
Defined in:
lib/bard/deploy_strategy/github_pages.rb

Instance Attribute Summary

Attributes inherited from Bard::DeployStrategy

#target

Instance Method Summary collapse

Methods inherited from Bard::DeployStrategy

[], inherited, #run, #run!, #system!

Constructor Details

#initialize(target, url = nil, **options) ⇒ GithubPages

Returns a new instance of GithubPages.



9
10
11
12
13
14
15
16
# File 'lib/bard/deploy_strategy/github_pages.rb', line 9

def initialize(target, url = nil, **options)
  super(target)
  @url = url
  @options = options

  # Auto-configure ping URL if provided
  target.ping(url) if url
end

Instance Method Details

#deployObject



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/bard/deploy_strategy/github_pages.rb', line 18

def deploy
  @sha = Git.sha_of(Git.current_branch)
  @build_dir = "tmp/github-build-#{@sha}"
  @branch = "gh-pages"
  @domain = extract_domain

  puts "Starting deployment to GitHub Pages..."

  build_site
  tree_sha = create_tree_from_build
  new_commit = create_commit(tree_sha)
  commit_and_push(new_commit)
end