-
Notifications
You must be signed in to change notification settings - Fork 491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rvm:use without environment parameter #297
Comments
Would love a PR with this. |
Looking a bit more into this, I found out that the workaround doesn't work - it does not take the ruby version according to the .ruby-version file but the default ruby on the system. I found no way to set the environment according to the .ruby-version file in the current deploy commit - in the environment task the git commit is not cloned yet; and later after cloning; environment variables cannot be set (after queuing a command, the changed environment seems to be thrown away). I worked around this issue by reading the .ruby-version according to the local file: task :environment do
ruby_version = File.read('.ruby-version').strip
raise "Couldn't determine Ruby version: Do you have a file .ruby-version in your project root?" if ruby_version.empty?
queue %{
source /etc/profile.d/rvm.sh
rvm use #{ruby_version} || exit 1
}
end Do you see a way to do this in a more clean way using the file in the deploy commit on the server? If we find a clean solution, I would take the time to create a PR to add this to the rvm task. |
btw, here is a full guide to the setup for which I cooked up this workaround: http://www.ralfebert.de/tutorials/rails-deployment/ |
👍 for finding a solution to this problem, I had the exact same issue and the workaround @ralfebert provided worked as a charm, thanks! |
rvm:use[] requires an environment which is unnecessary when the project has a .ruby-version file.
Workaround:
The text was updated successfully, but these errors were encountered: