Sha256: aa54be3eb610d12f24787aff8be79a399fb82059cd78c175f26be4f42e6b6b72

Contents?: true

Size: 1021 Bytes

Versions: 2

Compression:

Stored size: 1021 Bytes

Contents

require 'middleman-core'
require 'middleman-cloudfront/commands/invalidate'

module Middleman
  module CloudFront
    class Extension < Middleman::Extension
      # @param [Symbol] key The name of the option
      # @param [Object] default The default value for the option
      # @param [String] description A human-readable description of what the option does
      option :access_key_id, nil, 'Access key id'
      option :secret_access_key, nil, 'Secret access key'
      option :distribution_id, nil, 'Distribution id'
      option :filter, /.*/, 'Filter files to be invalidated'
      option :after_build, false, 'Invalidate after build'

      def initialize(app, options_hash={}, &block)
        super
      end

      def after_build
        Middleman::Cli::CloudFront::Invalidate.new.invalidate(options) if options.after_build
      end

      helpers do
        def invalidate(files = nil)
          Middleman::Cli::CloudFront::Invalidate.new.invalidate(options, files)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
middleman-cloudfront-0.4.0 lib/middleman-cloudfront/extension.rb
middleman-cloudfront-0.3.0 lib/middleman-cloudfront/extension.rb