capistrano / rbenv

Idiomatic rbenv support for Capistrano 3.x
MIT License
203 stars 60 forks source link

ruby is not installed or not found #79

Closed ktimothy closed 6 years ago

ktimothy commented 6 years ago

The message:

00:00 rbenv:validate
      WARN  rbenv: 2.5.1
 is not installed or not found in $HOME/.rbenv/versions/2.5.1
set :rbenv_type, :user # or :system, depends on your rbenv setup
set :rbenv_ruby, `cat .ruby-version`

the directory exists:

$ ls $HOME/.rbenv/versions/2.5.1
bin  include  lib  share

capistrano 3.11.0, capistrano-rbenv 2.3.1

What may be the problem with it?

ktimothy commented 6 years ago

LOOOOL, actually, I have found the problem :D

set :rbenv_ruby, `cat .ruby-version`

adds a newline to rbenv_ruby, which then leads to wrong generated test command

[-d $HOME/.rbenv/versions/2.5.1; ]

(note the semicolon).

mattbrictson commented 6 years ago

Good catch! You can get rid of that newline with chomp, like this:

set :rbenv_ruby, `cat .ruby-version`.chomp

Glad to hear you figured it out!