Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Ruby on Rails, what's the difference between installing something as a gem or as a plugin?

On http://github.com/collectiveidea/delayed_job

it says:

To install as a gem, add the following to config/environment.rb:
config.gem 'delayed_job'
Run rake gems:install

versus

To install as a plugin:
script/plugin install git://github.com/collectiveidea/delayed_job.git

What is the difference between installing it as a gem or as a plugin?

Also, the first method just install gem 2.0.3 which might be the tobi's version? (rake gems:install installs the version by gem list -r delayed_job) Is it http://github.com/tobi/delayed_job ? The "plugin" method specifically says it is the collectiveidea version? Doesn't it matter which one you install?

like image 763
nonopolarity Avatar asked Dec 13 '25 19:12

nonopolarity


2 Answers

Both the Gem and the vendored plugin refers to the collectiveidea's fork. In fact, collectiveidea is the current maintainer for the delayed_job Gem on RubyGems.

That said, generally speaking installing a plugins as a Gem has many advantages.

  • You can install it once and use it in many different projects
  • You can take advantage of dependency resolution
  • You can upgrade just changing version number
  • You don't need to store the entire plugin code in your SCM

So, why you can install a plugin "as a plugin"? There are many different answers.

At the very beginning, Rails plugins came as simple libraries. Time passes and developers started to notice the advantage of packaging plugins as Gem.

Also, before Rails 3, some plugin features were only reserved to plugins and not to Gems. For instance, before Rails 3, plugins could bundle rake tasks while there wasn't a way to inject new rake tasks or new routes into the main application.

In the last two years, the most part of Rails plugins offers the ability to be installed as a plugin or as a Gem. With Rails 3 and the arrival of Bundler, I'm sure plugins are going to be deprecated in favor of Gems.

like image 86
Simone Carletti Avatar answered Dec 15 '25 12:12

Simone Carletti


That are 2 different repositorys, maybe you shoult try

config.gem 'delayed_job', :source => http://github.com/collectiveidea/delayed_job.git

Look at: http://ryandaigle.com/articles/2008/4/1/what-s-new-in-edge-rails-gem-dependencies

Btw. maybe you want to look at a maybe better solution: resque - see http://ruby-toolbox.com/categories/queueing.html for a comparison of used queing gems

like image 41
BvuRVKyUVlViVIc7 Avatar answered Dec 15 '25 14:12

BvuRVKyUVlViVIc7



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!