How to organize the development of a Rails application and several engines

It’s hard to formulate the question really, so I’ll just explain the situation.

I am working on an application that consists of several routines. The main application simply provides a navigation bar and some basic functions, such as user configuration and permissions, while auxiliary applications provide actual functions.

Now this is a Rails 2 application, and sub-applications are embedded in frames, it is not a very good design and quite complicated to configure. Fortunately, we now have engines, and that would be a more reasonable solution for this application.

Until now, everyone lives in subversive activities and can be updated immediately, the general code uses external ones. We would like to switch to git while we are engaged in restructuring and refactoring. I searched the Internet for the past few days about the bundle, git submodules, and git subtrees, but I did not find a good description of how to properly manage a large project that consists of several engines / gems when you develop on all of them at the same time.

In particular, I would like to be able to:

  • use the bundler to manage dependencies
  • don't install our own gems and engines in the global gem path, but relative to the main application, like git storage
  • We have our own nuggets and engines as a git repository (possibly using a local Bundler constraint)
  • an easy way to get all the dependencies (bundle install) that pull out the latest version of our own gems and engines, if this is not possible, then one git command will pull out all our own gems and engines (maybe a rake task?)
  • make it easy for new developers to quickly configure the entire development environment (git install the application locally, install installation dependencies, including all proprietary aircraft and engines).
  • deployment with capistrano, easy

What I already thought about:

  • including everything in one repository, the goal of individual Gems / Engines seems to defeat me, also I think that this will not allow us to manage the dependencies of the main application on our Engines through the Bundler
  • using submodules, I read too many messages about why this is bad, and with our number of developers it is only a matter of time until someone makes a submodule pointer to a commit that exists only in its local repo
  • The git subtree utility seems to me rather complicated.

Do you have any of you who have a similar installation and how do you manage to make updating and making changes as easy as possible? Where do you put your Engine / Gem code that the application depends on?

TL DR How to manage a large rails project that consists of several engines and gems?

+4
source share
2 answers

We have a similar (but probably less complicated) case in my company. What we are doing (as it is now), and this may work for you:

Put the Rails application in your own git repository. Different gems also get their own repository (while otherwise it’s possible, “one gem = one git repository” will make your life easier).

Then in your Rails application gemfile you have some options

  • The default value should apply to every gem in the git repository (so the package will load them from there)
  • When using some of the gems and the Rails application locally, either change the Gemfile to use the local path ( http://gembundler.com/v1.2/gemfile.html ), or better by overriding the path locally (see http: // gembundler. com / v1.2 / git.html ). Be careful that the two options are different: the first uses the path, the second uses the local git repository (so the new uncommitted change will be visible first, not second).

To easily upgrade all your gems, I would create a small .sh script (just to run various cloning or updating operations, and also install the package so that everything works out clean) and transfer it using the main application, I would also get a "standard organization folders "among the team (that is, so that everyone uses the base folder of their choice, there were folders for the Rails application and each stone below it) to simplify the procedure.

I hope this can help or get ideas (your question is quite complex and diverse, so I'm not 100% sure, this is what you are looking for).

+4
source

How to manage Gem dependencies?
Bundler via Gemfile.

How to control your engines?
Bundler via Gemfile.
Architect your engines like gems and indicate their git repo location in your gemfile. If you need examples, check out how to include https://github.com/radar/forem in your Gemfile.

It also helped me learn Rails Engines, http://edgeguides.rubyonrails.org/engines.html .

Are you coming from Java Land?
Rails has a learning curve, but does not look like a Java cliff.

+1
source

All Articles