Sha256: 84e60a9d018463f5465f7f617c9dc3e0614df6c6f7f57d8c177b2e2a9d271ca6

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

# Require core library
require "middleman-core"

# Extension namespace
module Middleman
  module Deploy

    class Options < Struct.new(:method, :host, :port, :user, :path, :clean); end

    class << self

      def options
        @@options
      end

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

        options.method ||= :rsync
        options.port ||= 22
        options.clean ||= false

        @@options = options

        app.send :include, Helpers

        app.after_configuration do
          if (options.method == :rsync)
            if (!options.host || !options.user || !options.path)
              raise <<EOF


ERROR: middleman-deploy is not setup correctly. host, user, and path
*must* be set in config.rb. For example:

activate :deploy do |deploy|
  deploy.user = "tvaughan"
  deploy.host = "www.example.com"
  deploy.path = "/srv/www/site"
end

EOF
            end
          end
        end
      end

      alias :included :registered

    end

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

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
middleman-deploy-0.0.4 lib/middleman-deploy/extension.rb