Sha256: c6149cd5b64f43495889fb98826d90efa61694656bca1c8a5f6b5f4a7b8a5dfc

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

# Require core library
require "middleman-core"

# Extension namespace
module Middleman
  module Deploy

    class Options < Struct.new(: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.port ||= 22
        options.clean ||= false

        @@options = options

        app.send :include, Helpers

        app.after_configuration do
          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

      alias :included :registered

    end

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

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
middleman-deploy-0.0.3 lib/middleman-deploy/extension.rb
middleman-deploy-0.0.2 lib/middleman-deploy/extension.rb
middleman-deploy-0.0.1 lib/middleman-deploy/extension.rb