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’ve just released version 4.6.5 of middleman-s3_sync, a gem that synchronizes Middleman-built websites to Amazon S3, with optional CloudFront invalidation.
Highlights
- Thread-safe CloudFront invalidation path tracking (use Set + mutex) when running...
Read More... I’ve just released version 4.6.4 of middleman-s3_sync, a gem that synchronizes Middleman-built websites to Amazon S3.
This release completely removes the map gem dependency and replaces it with a native Ruby implementation.
Background
The map gem provides...
Read More... I’ve just released version 4.6.3 of middleman-s3_sync, a gem that synchronizes Middleman-built websites to Amazon S3.
This is a maintenance release that addresses a dependency issue. Thanks to Chad Wilson for identifying and fixing the problem in PR #...
Read More... They say it’s like riding a bicycle - once you learn, you never forget. But after nearly 8 years at Amazon, I’m discovering that muscle memory can get pretty rusty when it comes to Ruby gems and the broader open source ecosystem.
Don’t get me wrong - Amazon...
Read More... 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... 
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...
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... OAuth2 and OpenID Connect both have the notion of a client. In this area, a client is any application or service that relies on the authorization server for authorization.
Clients have their own credentials. They have a client identifier and a secret...
Read More... 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