class Pieces::Publisher::Github

Public Instance Methods

publish() click to toggle source
# File lib/pieces/publisher.rb, line 36
def publish
  FileUtils.rm_rf("#{config.path}/build/")
  FileUtils.mkdir("#{config.path}/build/")
  clone_into_build_dir
  builder.build
  commit_and_push_changes
end

Protected Instance Methods

asset_prefix() click to toggle source
# File lib/pieces/publisher.rb, line 46
def asset_prefix
  _, username, repo = URI(config.publish_endpoint['remote']).path.split('/')
  repo = File.basename(repo, '.git')
  "http://#{username}.github.io/#{repo}/assets"
end

Private Instance Methods

clone_into_build_dir() click to toggle source
# File lib/pieces/publisher.rb, line 58
def clone_into_build_dir
  exec("git clone -o pieces_github_pages #{config.publish_endpoint['remote']} .",
       "git checkout gh-pages")
end
commit_and_push_changes() click to toggle source
# File lib/pieces/publisher.rb, line 63
def commit_and_push_changes
  exec("git add .",
       "git commit -m 'Commit all the things'",
       "git push pieces_github_pages gh-pages")
end
exec(*commands) click to toggle source
# File lib/pieces/publisher.rb, line 54
def exec(*commands)
  system(commands.join(' && '), chdir: "#{config.path}/build/")
end