[LRUG] Gemfile.lock in unbuilt engines (was Re: September Announcement)

Daniel Barlow dan at telent.net
Tue Aug 27 04:14:52 PDT 2013


> Manuel Morales is going to give a talk called "Scaling beyond Rails" all
about turning a large Rails app into several smaller services.

Prompted by this news, I would like to ask: who's using "unbuilt engines"
for this purpose (perhaps Manual Morales is?) and what has your experience
been?

(Unbuilt engines: creating a rails engine in a subdirectory of your app and
keeping the whole lot in the same git/$dvcs repository as the parent to
ease deploys and avoid versioning issues.  See
http://pivotallabs.com/unbuilt-rails-dependencies-how-to-design-for-loosely-coupled-highly-cohesive-components-within-a-rails-application/)

We've started down that path recently-ish, and one source of friction has
been what to do with the Gemfile.lock created in the engine's directory -
either you don't check it in and end up developing the engine against
different (usually newer) versions of stuff than the main app, or you do
check it in then nobody remembers to update it when they change the main
app, and then your CI builds fail in non-obvious ways.   I know there are
really good reasons that *real* gems shouldn't have a Gemfile.lock at all,
but the basis of that argument is that real gems get more extensive testing
in more environments than an application does, which isn't really the case
here when there's only one client of our unbuilt gem: though technically
it's a gem, spiritually/philosophically it's more of an application
component.

Anyway, tl;dr  One workaround seems to be to do

$ bundle && bundle exec ruby
-e'Bundler::Definition.build("Gemfile","../../Gemfile.lock",
{}).lock("Gemfile.lock")'

in the engine's directory to regenerate Gemfile.lock based on the version
dependencies in the main Gemfile. I *think* it works, but whether it's
supposed to work or whether it just happens to work I am less sure.

Anyone run into this and what did you do?

-dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20130827/3753e90b/attachment-0003.html>


More information about the Chat mailing list