class Middleman::GhPages::Deploy

Public Class Methods

new(options = {}) click to toggle source
# File lib/middleman/gh_pages/deploy.rb, line 8
def initialize(options = {})
  @build_dir = options.fetch(:build_dir)
  @remote = options.fetch(:remote)
  @branch = options.fetch(:branch)
  @environment = options.fetch(:environment)
end

Public Instance Methods

call() click to toggle source
# File lib/middleman/gh_pages/deploy.rb, line 15
def call
  bundle.exec 'middleman', 'build', '-e', @environment

  Dir.chdir(@build_dir) do
    rm_rf '.git'

    git.init
    git.remote 'add', 'origin', @remote
    git.add '.'
    git.commit '-m', "Deploy on #{Time.now}"
    git.checkout '-B', @branch
    git.push '-f', 'origin', @branch
  end
end

Private Instance Methods

bundle() click to toggle source
# File lib/middleman/gh_pages/deploy.rb, line 32
def bundle
  @bundle ||= Command.bundle
end
git() click to toggle source
# File lib/middleman/gh_pages/deploy.rb, line 36
def git
  @git ||= Command.git
end