2012-08-20 19:52:29 +02:00
|
|
|
# Require core library
|
2014-05-29 11:57:30 +02:00
|
|
|
require 'middleman-core'
|
2012-08-20 19:52:29 +02:00
|
|
|
|
|
|
|
# Extension namespace
|
2012-08-20 21:59:32 +02:00
|
|
|
module Middleman
|
|
|
|
module Deploy
|
2012-08-20 23:24:17 +02:00
|
|
|
|
2015-02-22 22:52:52 +01:00
|
|
|
cattr_accessor :options
|
|
|
|
|
|
|
|
class Extension < Extension
|
|
|
|
|
|
|
|
option :deploy_method, nil
|
|
|
|
option :host, nil
|
|
|
|
option :port, nil
|
|
|
|
option :user, nil
|
|
|
|
option :password, nil
|
|
|
|
option :path, nil
|
|
|
|
option :clean, nil
|
|
|
|
option :remote, nil
|
|
|
|
option :branch, nil
|
|
|
|
option :strategy, nil
|
|
|
|
option :build_before, nil
|
|
|
|
option :flags, nil
|
|
|
|
option :commit_message, nil
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def initialize(app, options_hash = {}, &block)
|
|
|
|
super
|
2012-08-22 23:15:37 +02:00
|
|
|
|
2012-08-20 23:24:17 +02:00
|
|
|
yield options if block_given?
|
|
|
|
|
2013-08-09 01:44:03 +02:00
|
|
|
# Default options for the rsync method.
|
2012-08-20 23:24:17 +02:00
|
|
|
options.port ||= 22
|
2012-08-22 23:09:26 +02:00
|
|
|
options.clean ||= false
|
2013-08-09 01:44:03 +02:00
|
|
|
|
|
|
|
# Default options for the git method.
|
2014-05-29 11:57:30 +02:00
|
|
|
options.remote ||= 'origin'
|
|
|
|
options.branch ||= 'gh-pages'
|
|
|
|
options.strategy ||= :force_push
|
2014-05-24 20:35:14 +02:00
|
|
|
options.commit_message ||= nil
|
2012-08-20 21:59:32 +02:00
|
|
|
|
2013-06-11 06:42:12 +02:00
|
|
|
options.build_before ||= false
|
2012-10-31 21:49:30 +01:00
|
|
|
|
2015-02-22 22:52:52 +01:00
|
|
|
end
|
2012-08-22 20:45:33 +02:00
|
|
|
|
2015-02-22 22:52:52 +01:00
|
|
|
def after_configuration
|
|
|
|
::Middleman::Deploy.options = options
|
2012-08-20 19:52:29 +02:00
|
|
|
end
|
2012-08-22 23:15:37 +02:00
|
|
|
|
2012-08-20 19:52:29 +02:00
|
|
|
end
|
|
|
|
|
2012-08-20 21:59:32 +02:00
|
|
|
end
|
2012-08-20 19:52:29 +02:00
|
|
|
end
|