I used chef for automation.
In one of my scenarios I need to extract a version number of passenger from rvm installed in my system.
I used 'pasver' variable for this:
pasver = `/usr/local/rvm/bin/gem list | grep passenger`.sub /.*\((.*)\).*/, '\1'
But If I use this variable, in this case:
if ! ::File.exists?("/usr/local/rvm/gems/#{node['redmine']['rubyversion']}/gems/passenger-#{pasver}/buildout/apache2/mod_passenger.so") then
Then this condition is always false, and code in if block does not run.
This is because pasver variable contains new of line.
How I can remove this new of line ?
I used next way, but without successfully:
pasver = `/usr/local/rvm/bin/gem list | grep passenger`.sub /.*\((.*)\).*/, '\1'.gsub("\n",'')