module Middleman::DeployWithNotifications

Constants

PACKAGE
VERSION

Public Class Methods

included(app, options_hash={}, &block)
Alias for: registered
options() click to toggle source
# File lib/middleman-deploy-with-notifications/extension.rb, line 12
def options
  @@options
end
registered(app, options_hash={}) { |options| ... } click to toggle source
# File lib/middleman-deploy-with-notifications/extension.rb, line 16
def registered(app, options_hash={}, &block)
  options = Options.new(options_hash)
  yield options if block_given?

  options.port ||= 22
  options.clean ||= false
  options.remote ||= "origin"
  options.branch ||= "gh-pages"

  options.after_build ||= false

  options.revision        = `git rev-parse HEAD`.gsub( /\s*$/, '' ).chomp
  options.revision_short  = `git rev-parse --short HEAD`.gsub( /\s*$/, '' ).chomp
  options.deploy_user     = `git config --get github.user`.chomp
  options.github_user, options.github_project = `git remote -v | grep "/" | head -n1`.gsub( /.*:([\w_-]+)\/([\w_\.-]+).git.*/, '\1/\2' ).split( "/" )
  options.github_project.chomp!

  options.git_branch          = `git rev-parse --abbrev-ref HEAD`.gsub( /\s*/, '' ).chomp
  options.git_comment         = `git log -1 --pretty=%B`.gsub( /\s*$/, '' ).chomp

  app.after_build do |builder|
    ::Middleman::Cli::DeployWithNotifications.new.deploy if options.after_build
  end

  @@options = options

  app.send :include, Helpers
end
Also aliased as: included