Skip to content

Commit

Permalink
Allow ruby_build to install new upgrades automatically
Browse files Browse the repository at this point in the history
Addresses #138
  • Loading branch information
SeanSith committed May 16, 2023
1 parent d52fe6b commit 8ebdce2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

- Allow ruby-build to recognize when it needs to be upgraded.
- Allow ruby-build to reinstall Ruby if the version changes.

## 2.4.1 - *2023-05-16*

## 2.4.0 - *2023-05-16*
Expand Down
5 changes: 4 additions & 1 deletion resources/definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@
environment env
user new_resource.user
group new_resource.group
not_if { ::File.exist?("#{installation_path}/bin") }
not_if do
::Dir.exist?("#{installation_path}/bin") &&
new_resource.definition == `#{installation_path}/bin/ruby -e 'print RUBY_VERSION'`
end
live_stream true
action :run
end
Expand Down
5 changes: 4 additions & 1 deletion resources/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
execute 'Install ruby-build' do
cwd src_path
command %(sh ./install.sh)
not_if { ::File.exist?('/usr/local/bin/ruby-build') }
not_if do
::File.exist?('/usr/local/bin/ruby-build') &&
`#{src_path}/bin/ruby-build --version` == `/usr/local/bin/ruby-build --version`
end
end
end

0 comments on commit 8ebdce2

Please sign in to comment.