I'm trying to integrate backup gem (github.com/backup/backup) at rails project. Backup gem is not recommended for using in Gemfile, so I'm trying to install it by capistrano task. And I make task in lib/rasks/backup.rake path, contained something like:
namespace :backup do
desc "Perfom Backup"
task :perform do
%x{ backup perform -t beam_bank -c config/Backup/config.rb }
end
end
But executing that task cause error:
micron-l% rake backup:perform
/home/space/.gem/ruby/2.2.0/gems/bundler-1.10.6/lib/bundler/rubygems_integration.rb:292:in `block in replace_gem': backup is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
from /home/space/.gem/ruby/2.2.0/bin/backup:22:in `<main>'
Adding "gem 'backup', require: false" to Gemfile cause some dependency conflict. So we decide the using Gemfile is not apropriate in our current case.
I would be very thankful for ideas to solve this problem... Thanks in advance..
The answer is:
Use bundler helper for run script in clean environment. In this case it can be done something like this:
Bundler.clean_system('backup perform -t beam_bank -c config/Backup/config.rb')
The reference to docs on this problem: http://bundler.io/v1.10/man/bundle-exec.1.html#Shelling-out
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.