2012-08-20 19:52:29 +02:00
|
|
|
# Require core library
|
|
|
|
require "middleman-core"
|
|
|
|
|
|
|
|
# Extension namespace
|
2012-08-20 21:59:32 +02:00
|
|
|
module Middleman
|
|
|
|
module Deploy
|
2012-08-22 23:15:37 +02:00
|
|
|
|
2013-06-11 06:42:12 +02:00
|
|
|
class Options < Struct.new(:whatisthis, :method, :host, :port, :user, :password, :path, :clean, :remote, :branch, :build_before); end
|
2012-08-20 23:24:17 +02:00
|
|
|
|
2012-08-20 21:59:32 +02:00
|
|
|
class << self
|
2012-08-22 23:15:37 +02:00
|
|
|
|
2012-08-22 20:45:33 +02:00
|
|
|
def options
|
|
|
|
@@options
|
|
|
|
end
|
2012-08-22 23:15:37 +02:00
|
|
|
|
2012-08-20 23:24:17 +02:00
|
|
|
def registered(app, options_hash={}, &block)
|
|
|
|
options = Options.new(options_hash)
|
|
|
|
yield options if block_given?
|
|
|
|
|
|
|
|
options.port ||= 22
|
2012-08-22 23:09:26 +02:00
|
|
|
options.clean ||= false
|
2012-10-05 05:44:02 +02:00
|
|
|
options.remote ||= "origin"
|
2012-09-27 00:46:21 +02:00
|
|
|
options.branch ||= "gh-pages"
|
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
|
|
|
|
2012-08-22 20:45:33 +02:00
|
|
|
@@options = options
|
|
|
|
|
|
|
|
app.send :include, Helpers
|
2012-08-20 19:52:29 +02:00
|
|
|
end
|
2012-08-22 23:15:37 +02:00
|
|
|
|
2012-08-20 21:59:32 +02:00
|
|
|
alias :included :registered
|
2012-08-22 23:15:37 +02:00
|
|
|
|
2012-08-20 19:52:29 +02:00
|
|
|
end
|
|
|
|
|
2012-08-22 20:45:33 +02:00
|
|
|
module Helpers
|
2012-08-22 21:37:37 +02:00
|
|
|
def options
|
|
|
|
::Middleman::Deploy.options
|
2012-08-22 20:45:33 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-08-20 21:59:32 +02:00
|
|
|
end
|
2012-08-20 19:52:29 +02:00
|
|
|
end
|