middleman-s3_sync 4.7.0 released

I’ve just released version 4.7.0 of middleman-s3_sync, a gem that synchronizes Middleman-built websites to Amazon S3, with optional CloudFront invalidation. This is a feature release with several new capabilities.

New Features

after_s3_sync Callback

You can now run custom code after sync completes—perfect for notifications, webhooks, or post-deployment tasks:

1
2
3
4
5
6
7
activate :s3_sync do |s3_sync|
  s3_sync.after_s3_sync = ->(results) {
    puts "Created: #{results[:created]} files"
    puts "Updated: #{results[:updated]} files"
    puts "Deleted: #{results[:deleted]} files"
  }
end

The callback receives a hash with sync statistics and the list of CloudFront invalidation paths.

scan_build_dir Option

Sync files that exist in your build directory but aren’t tracked by Middleman’s sitemap (e.g., files generated by external tools):

1
2
3
activate :s3_sync do |s3_sync|
  s3_sync.scan_build_dir = true
end

S3 Website routing_rules

Configure S3 website redirect rules directly from your Middleman config:

1
2
3
4
5
6
7
8
activate :s3_sync do |s3_sync|
  s3_sync.routing_rules = [
    {
      condition: { key_prefix_equals: 'old/' },
      redirect: { replace_key_prefix_with: 'new/', http_redirect_code: '301' }
    }
  ]
end

Improved Content Type Detection

Better MIME type detection using the mime-types gem as a fallback, with support for custom content types via the content_types option.

Other Improvements

  • Reliability: Proper sitemap population before sync ensures all resources are captured
  • CI/CD: GitHub Actions workflows for continuous integration and automated releases
  • Dependencies: Tightened gemspec with bounded dependency versions
  • Ruby: Now requires Ruby >= 3.0

Upgrading

Update your Gemfile:

1
gem 'middleman-s3_sync', '~> 4.7'

Then run:

1
bundle update middleman-s3_sync

Thanks

As always, the source is on GitHub and the gem is on RubyGems. Feedback and PRs welcome!

I'm Back!

A whole lot has happened since I last wrote here. I’ve been busy with work, family, hobbies,and personal projects. I’ve also dealt with some personal issues and challenges that have shaped my perspective and priorities. I’ve learned a lot about myself and...

Read More...

Moving Out of the Home Office

New Office

I was mostly on distributed teams when I worked at Sun Microsystems. Sometimes it was on a multi-site team, but more often than not I was on teams where I was one of the few, if not only, members based in Colorado. As a result, I had a well appointed...

Read More...

Cups of Coffee

coffee Image by Toshiyuki IMAI

I measure my mornings in cups of coffee.

The first one is for me. It accompanies breakfast, is savored as I read my Twitter feed and some interesting stories and helps me ease out of sleepiness into awakeness.

The second cup...

Read More...

Kubernetes Service Discovery

I am helping my client transition from a few large monoliths hosted on AWS to micro-services hosted on Kubernetes. It is my first experience with Kubernetes and I must say that I am impressed so far.

Of course, micro-services work best when it is easy...

Read More...

Page 1 of 8

Next page