开发者

Gem or Plugin , what is good for a ruby on rails project

开发者 https://www.devze.com 2022-12-21 00:39 出处:网络
I amfacing some problem with rails gem when deploying to a differet machine.It requires some extra work on installing gem.Which is most suitable for a rails project.Plugin or Gem.

I am facing some problem with rails gem when deploying to a differet machine.It requires some extra work on installing gem.Which is most suitable for a rails project.Plugin or Gem. For Some gems there is n开发者_JS百科o corresponding plugins found.

I am searching for advantages of using plugin over gems and vice versa.


You can unpack gems to your Rails application, which will make sure that they are deployed together with your application:

rake gems:unpack:dependencies

Now you no longer have to install the gems on the server you deploy to. This already takes care of most of the deployment issues. Most others are solved by Bundler, which will be included with Rails 3.

If you can, use gems over plugins. Gems are generally easier to manage, because their versioning is superior to plugins. For public Rails extensions, I see no reason to use plugins instead of gems, but some authors only offer one of the two. In that case you have no choice.


I usually always use a plugin if it is available as it gets frozen into the project, meaning there are no issues when the project is deployed. You can freeze gems into a project but if they require a native build it causes more hassle than it's worth from my experience.

My understanding is gems are easier to upgrade than plugins.

You should also look into the rails 3 bundler which is used to handle these deployment issues.


For me, plugins are preferred. I've run into many a situation where I'll have an improperly configured environment.rb and gems won't have versions assigned to them. Then the server admin does a:

sudo gem update

And now my rspec tests won't run because the update installed test-unit 1.2.2 and my specific setup needs 1.0.1 (or something).

0

精彩评论

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