ajib
ajib

Reputation: 309

Convert a Gem to a Plugin in Ruby

I currently have a gem installed on my development machine. Now that I want to use this gem on the production but I could not install it due to some issue with the server. Is there a way that I can convert this gem to a plugin so that I can transfer it to the server?

if no, is there a way to transfer this gem from my machine to the server?

BTW, I'm using an old version of Ruby on Rails (2.1)

Thanks.

Upvotes: 2

Views: 168

Answers (2)

Maz
Maz

Reputation: 3375

Just copy the gem's single source code file into your project's lib directory. https://github.com/ambethia/smtp-tls/blob/master/lib/smtp-tls.rb

Upvotes: 1

Andrew
Andrew

Reputation: 43153

Well, if the plugin is compatible with Rails 2.1 you should be able to move the plugin to your /vendor directory, and it should work from there. As mentioned in the comments, the vendor directory is going to be removed and that style of plugins will be removed in Rails 4, but for Rails 2.1 that doesn't matter.

To get the files, go on rubygems.org and find the project homepage. You can probably find the source code for the plugin you're interested in (including a version that's compatible with Rails 2.x) on Github, then just clone it to your vendor directory.

Upvotes: 1

Related Questions