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..
namespace :backup do
desc "Perfom Backup"
task :perform do
Bundler.with_clean_env { %x{ backup perform -t beam_bank -c config/Backup/config.rb } }
end
end
In this case, where you're not actually using the return value from %x, you could also use the `clean_system` helper method:namespace :backup do
desc "Perfom Backup"
task :perform do
Bundler.clean_system 'backup perform -t beam_bank -c config/Backup/config.rb'
end
end
There are docs about this at http://bundler.io/v1.10/man/bundle-exec.1.html#Shelling-out--
You received this message because you are subscribed to the Google Groups "ruby-bundler" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-bundler...@googlegroups.com.
To post to this group, send email to ruby-b...@googlegroups.com.
Visit this group at http://groups.google.com/group/ruby-bundler.
For more options, visit https://groups.google.com/d/optout.