开发者

How can I keep my Ruby Gems the same on several servers?

开发者 https://www.devze.com 2023-04-11 12:24 出处:网络
I 开发者_JS百科have several servers for development, staging, testing and production and want to keep my Ruby version and Gem versions in sync between the different machines -- what\'s the best way to

I 开发者_JS百科have several servers for development, staging, testing and production and want to keep my Ruby version and Gem versions in sync between the different machines -- what's the best way to do this?


If you're using Rails 3, you can just use the Gemfile, and bundler, and when you do a "bundle update" on whatever machine you're on, it will automatically install the correct versions of Gems for that user account.

You should use RVM to manage your Ruby versions and to keep the Gems for different Ruby versions separate from each other.

You should also create a "gemset" for your Rails application, to make sure that the Gems installed there are not modified from another Rails application you might use or develop on the same machine.

http://beginrescueend.com/

http://railscasts.com/episodes/200-rails-3-beta-and-rvm


rvm is the best option to manage ruby versions

However I am not sure if you really want to change ruby version often.

bundler & Gemfile is great way to handle gem versions

Track you Gemfile && Gemfile.lock files in git(or other cvs) tree, and run bundle install on change


You can also, in the event you have more gems in a gemset than just what's in your Gemfile, do a

rvm gemset export gemsetname.gems

And then on the other machine you would do a

rvm gemset import gemsetname.gems

You can even do it as

rvm x.x.x@mygemset exec rvm gemset export mygemset.gems

so you don't have to go directly into your gemset. And then on the new machine,

rvm --create use x.x.x@mygemset && rvm gemset import mygemset.gems

which will create and then populate your mygemset gem set.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号