Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3
ruby-version: 3.4
- name: Install dependencies
run: bundle install
- name: Run RuboCop against BASE..HEAD changes
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ on: [push]
jobs:
test:
strategy:
fail-fast: false
matrix:
ruby-version:
- '3.1'
- '3.2'
- '3.3'
- '3.4'
gemfile:
- gemfiles/Gemfile.rails70
- gemfiles/Gemfile.rails71
Expand All @@ -20,6 +22,10 @@ jobs:
# https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html
- ruby-version: '3.1'
gemfile: 'gemfiles/Gemfile.rails80'
# rails 7.0 requires ruby <= 3.3
# https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html
- ruby-version: '3.4'
gemfile: 'gemfiles/Gemfile.rails70'

name: Ruby ${{ matrix.ruby-version }} / Bundle ${{ matrix.gemfile }}

Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## [Unreleased]
*no unreleased changes*
### Fixed
* Capistrano: deploy:preinstall should fix up installed gem permissions
* Support Ruby 3.4

### Added
* Capistrano: cleanup bundled gems for old ruby versions.

## 7.3.3 / 2025-07-31
### Fixed
Expand Down
22 changes: 22 additions & 0 deletions lib/ndr_dev_support/capistrano/install_ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,29 @@
fi
SHELL
end

desc <<~DESC
Cleanup bundled gems for old ruby versions.

Deletes shared bundle files that no longer match any installed releases.

This interacts reasonably with deploy:preinstall:
When deploy:preinstall installs new .rbenv and new shared bundled gems, this
will not delete them. If an older ruby version is then deployed, this removes
the new version's installed bundle, but leaves the .rbenv installation.
DESC
task :cleanup_unused_bundles do
# For ruby X.Y.Z, bundled gems are in .../shared/bundle/ruby/X.Y.0
# Generates e.g.
# find_options="-not ( -name DUMMY -or -name 3.1.0 -or -name 3.2.0 )"
# and then removes e.g. shared/bundle/ruby/3.0.0
run "find_options=\"-not ( -name DUMMY `grep -ho '^[0-9]*[.][0-9]*' " \
"#{releases_path}/*/.ruby-version | sed -e 's/.*/-or -name &.0/'` ) \"; " \
"find #{File.join(shared_path, 'bundle/ruby/*')} -maxdepth 0 $find_options " \
"-exec echo rm -rf '{}' ';' -exec rm -rf '{}' ';'"
end
end

before 'bundle:install', 'ndr_dev_support:install_ruby'
after 'deploy:finalize_update', 'ndr_dev_support:cleanup_unused_bundles'
end
9 changes: 7 additions & 2 deletions lib/ndr_dev_support/capistrano/ndr_model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,12 @@
# already there:
run "rm -rf #{File.join(release_path, path)} && ln -s #{File.join(shared_path, path)} #{File.join(release_path, path)}"
end
end

after 'deploy:finalize_update', 'ndr_dev_support:filesystem_tweaks'

# Make the shared/bundle/ directory writeable by deployers:
desc 'Make the shared/bundle/ directory writeable by deployers'
task :bundle_permissions do
# We already set group permissions correctly in the bundle directory, but some gem installs
# ignore these permissions, so we need to fix them up.
# Set deployer group for everything created by this user
Expand All @@ -178,7 +182,8 @@
'-not -perm -0064 -print0 |xargs -r0 chmod g+rw,o+r'
end

after 'deploy:finalize_update', 'ndr_dev_support:filesystem_tweaks'
# Ensure we have fixed the bundle permissions before potentially aborting
before 'ndr_dev_support:check_preinstall', 'ndr_dev_support:bundle_permissions'
end
end

Expand Down