How do I use frozen Capistrano part 2?

2019-08-27 01:00发布

问题:

Following on from my question on using frozen Capistrano a couple of days back I'm still having issues running Capistrano frozen in my vendor folder.

When I try and run my frozen version of cap

ruby -r rubygems ./vendor/gems/capistrano-2.5.2/bin/cap deploy-with-migrations

I get an error

... RubyGem version error: net-ssh(1.0.8 not >= 2.0.0) (Gem::LoadError) ...

I have net-ssh-2.0.4 frozen in my vendor folder as I knew it was a dependency so how do I make use of it?

I'd hoped adding my vendor folder to my .gemrc file under the gempath: would have done the trick, but it hasn't. 'gem environment' shows the vendor path, but 'gem list' doesn't show the gems in the vendor folder.

Any ideas?

回答1:

In the end I decided not to freeze Capistrano and dependancies to my vendor gems directory as they weren't gems used by my application - they were used to deploy my application.

Instead I locally installed them on my hosting account and all worked fine.



回答2:

If you want to completely avoid the system-installed gems (which isn't a bad idea if you don't have control over them), I'd install a copy of rubygems to vendor directory.

Set GEM_PATH and GEM_HOME environment variables to /path/to/your/vendor/gems directory, and then install rubygems and go from there.