Search code examples
ruby-on-railsrubygemsrubymine

How extract code from project to gem fast (move class from project to gem)


I have a complex project written in Ruby on Rails. And i need to split it for smaller subrojects. And some code used in all subroject, so I want to move it to librabry (core) and after just reuse the library.

in .NET you could easily add project to your solution and project will be library type, then put classes to that project and compiler will compile dll and here it is - we have what we need. I need something ideologically the same but in Ruby.

How I could do that with the minimum eforts?

I'm using Rubymine 5


The real question is only how to move classe to gem. Technically. I never done it before. So no decomposition and stuff like that. Only mechanism how to get class from project and put it to gem with easiest way.


Solution

  • Look at http://guides.rubyonrails.org/plugins.html

    I would suggest looking at popular gems and see how they do things. There's really not one right way of doing things.