Sha256: d8e964bda7af0ecfc73dfbb8bd46e916002b1b3e6049204c4ec872ff68b72ffb

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

# Require core library
require 'middleman-core'

# Extension namespace
module Middleman
  module Deploy
    class Options < Struct.new(:method, :host, :port, :user, :password, :path, :clean, :remote, :branch, :strategy, :build_before, :flags, :commit_message); end

    class << self
      def options
        @@options
      end

      def registered(app, options_hash = {}, &block)
        options = Options.new(options_hash)
        yield options if block_given?

        # Default options for the rsync method.
        options.port ||= 22
        options.clean ||= false

        # Default options for the git method.
        options.remote ||= 'origin'
        options.branch ||= 'gh-pages'
        options.strategy ||= :force_push
        options.commit_message  ||= nil

        options.build_before ||= false

        @@options = options

        app.send :include, Helpers
      end

      alias_method :included, :registered
    end

    module Helpers
      def options
        ::Middleman::Deploy.options
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
middleman-deploy-1.0.0 lib/middleman-deploy/extension.rb
middleman-deploy-0.3.0 lib/middleman-deploy/extension.rb