When executing any ruby script outside the project root, to avoid errors like
Gemfile not found
or
.bundle folder not found add BUNDLE_GEMFILE path
Do this
execute "BUNDLE_GEMFILE=#{current_path}/Gemfile ~/.rvm/wrappers/<ruby-version>@<gemset>/bundle exec ruby #{current_path}/path/to/script.rb