Sha256: 4a29e756e5d9cd063bdb5207cee3bb6042551fd09601a333a83e09e89f72944a

Contents?: true

Size: 893 Bytes

Versions: 19

Compression:

Stored size: 893 Bytes

Contents

module S3Website
  module Cloudfront
    class Invalidator
      def self.invalidate(config, changed_files)
        aws_key = config['s3_id']
        aws_secret = config['s3_secret']
        cloudfront_distribution_id = config['cloudfront_distribution_id']
        s3_object_keys = apply_config config, changed_files
        s3_object_keys << ""
        report = SimpleCloudfrontInvalidator::CloudfrontClient.new(
          aws_key, aws_secret, cloudfront_distribution_id
        ).invalidate(s3_object_keys)
        puts report[:text_report]
        report[:invalidated_items_count]
      end

      private

      def self.apply_config(config, changed_files)
        if config['cloudfront_invalidate_root']
          changed_files.map { |changed_file|
            changed_file.sub /\/index.html$/, '/'
          }
        else
          changed_files
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
s3_website-1.6.11 lib/cloudfront/invalidator.rb
s3_website-1.6.10 lib/cloudfront/invalidator.rb
s3_website-1.6.9 lib/cloudfront/invalidator.rb
s3_website-1.6.8 lib/cloudfront/invalidator.rb
s3_website-1.6.7 lib/cloudfront/invalidator.rb
s3_website-1.6.6 lib/cloudfront/invalidator.rb
s3_website-1.6.5 lib/cloudfront/invalidator.rb
s3_website-1.6.4 lib/cloudfront/invalidator.rb
s3_website-1.6.3 lib/cloudfront/invalidator.rb
s3_website-1.6.2 lib/cloudfront/invalidator.rb
s3_website-1.6.1 lib/cloudfront/invalidator.rb
s3_website-1.6.0 lib/cloudfront/invalidator.rb
s3_website-1.5.0 lib/cloudfront/invalidator.rb
s3_website-1.4.5 lib/cloudfront/invalidator.rb
s3_website-1.4.4 lib/cloudfront/invalidator.rb
s3_website-1.4.3 lib/cloudfront/invalidator.rb
s3_website-1.4.2 lib/cloudfront/invalidator.rb
s3_website-1.4.1 lib/cloudfront/invalidator.rb
s3_website-1.4.0 lib/cloudfront/invalidator.rb