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
21 changes: 8 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,13 @@ on:
jobs:
build:
runs-on: ubuntu-latest
name: Ruby ${{ matrix.ruby }}
strategy:
matrix:
ruby:
- '3.3.4'
name: Test and lint

steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run the default task
run: bundle exec rake
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Run the default task
run: bundle exec rake
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby 3.3.6
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.5.2

Make ASDF version really usable with `asdf_version` variable.

## 1.5.1

Remove update of ASDF which has been removed. See https://github.com/asdf-vm/asdf/pull/1806.
Expand Down
2 changes: 1 addition & 1 deletion lib/capistrano/asdf/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Capistrano
module Asdf
VERSION = "1.5.1"
VERSION = "1.5.2"
end
end
52 changes: 24 additions & 28 deletions lib/capistrano/tasks/asdf.rake
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,18 @@ namespace :asdf do
if fetch(:asdf_setup)
on roles(fetch(:asdf_roles)) do
if test("[ -d #{fetch(:asdf_path)} ]")
info "ASDF is installed on #{fetch(:asdf_path)}"
within(fetch(:asdf_path)) do
version = capture(:cat, "version.txt").strip
if fetch(:asdf_version) == version
info "ASDF #{fetch(:asdf_version)} is already installed on #{fetch(:asdf_path)}"
else
execute :git, "checkout", "v#{fetch(:asdf_version)}"
info "ASDF is updated from #{version} to #{fetch(:asdf_version)} (on #{fetch(:asdf_path)})"
end
end
else
execute(:git, "clone", fetch(:asdf_repository), fetch(:asdf_path), "--branch", fetch(:asdf_version))
info "ASDF #{fetch(:asdf_version)} is installed on #{fetch(:asdf_path)}"
end
end
end
Expand Down Expand Up @@ -61,20 +70,13 @@ namespace :asdf do
end

namespace :uninstall do
desc "Uninstall ASDF Ruby version based on the .tool-versions of your project"
task :ruby do
on roles(fetch(:asdf_roles)) do
within(release_path) do
execute(:asdf, "uninstall", "ruby")
end
end
end

desc "Uninstall ASDF NodeJS version based on the .tool-versions of your project"
task :nodejs do
on roles(fetch(:asdf_roles)) do
within(release_path) do
execute(:asdf, "uninstall", "nodejs")
%i[ruby nodejs].each do |tool|
desc "Uninstall ASDF #{tool} version based on the .tool-versions of your project"
task tool do
on roles(fetch(:asdf_roles)) do
within(release_path) do
execute(:asdf, "uninstall", tool.to_s)
end
end
end
end
Expand All @@ -87,22 +89,16 @@ namespace :asdf do
asdf_prefix = fetch(:asdf_prefix, -> { "#{fetch(:asdf_path)}/bin/asdf exec" })
SSHKit.config.command_map[:asdf] = "#{fetch(:asdf_path)}/bin/asdf"

if fetch(:asdf_tools).include?("ruby")
if fetch(:asdf_ruby_use_jemalloc)
on roles(fetch(:asdf_roles)) do
if test("[ -f #{fetch(:asdf_jemalloc_path)}/jemalloc.h ]")
SSHKit.config.default_env.merge!(ruby_configure_opts: "--with-jemalloc=#{fetch(:asdf_jemalloc_path)}")
end
if fetch(:asdf_tools).include?("ruby") && fetch(:asdf_ruby_use_jemalloc)
on roles(fetch(:asdf_roles)) do
if test("[ -f #{fetch(:asdf_jemalloc_path)}/jemalloc.h ]")
SSHKit.config.default_env.merge!(ruby_configure_opts: "--with-jemalloc=#{fetch(:asdf_jemalloc_path)}")
end
end

fetch(:asdf_map_ruby_bins).uniq.each do |command|
SSHKit.config.command_map.prefix[command.to_sym].unshift(asdf_prefix)
end
end

if fetch(:asdf_tools).include?("nodejs")
fetch(:asdf_map_nodejs_bins).uniq.each do |command|
fetch(:asdf_tools).each do |tool|
fetch(:"asdf_map_#{tool}_bins", []).uniq.each do |command|
SSHKit.config.command_map.prefix[command.to_sym].unshift(asdf_prefix)
end
end
Expand All @@ -119,7 +115,7 @@ namespace :load do
task :defaults do
set :asdf_path, fetch(:asdf_path, "~/.asdf")
set :asdf_repository, fetch(:asdf_repository, "https://github.com/asdf-vm/asdf.git")
set :asdf_version, fetch(:asdf_version, "v0.14.1")
set :asdf_version, fetch(:asdf_version, "0.15.0")
set :asdf_setup, fetch(:asdf_setup, true)
set :asdf_roles, fetch(:asdf_roles, :all)
set :asdf_ruby_use_jemalloc, fetch(:asdf_ruby_use_jemalloc, true)
Expand Down
Loading