Closed jrochkind closed 9 years ago
This is meant to snapshot the Rails version that was used when the test app was generated.
Isn't that in the test app's Gemfile.lock
(which may be what @jcoyne meant) (and/or in your gem's Gemfile.lock, if you've bundle install
ed after generating the app)
Yes, I guess it would be in the test app's Gemfile.lock.
The end goal I'm thinking of is a rake task that notices when an existing generated app is outdated, and warns and/or regenerates it. (The current task notices if it exists or not by the presence of a .generated_engine_cart, and assumes if it exists it's good).
In some cases, you have a stale generated app, that no longer matches the current Rails version and/or ruby version. I'm good so far?
Writing code to figure out the rails version a test app was generated with by looking at it's Gemfile lock -- seems pretty tricky. I don't want to parse a Gemfile.lock. Getting it out of yaml is easy. The .generated_engine_cart dotfile already exists with a simple 'true' in it, so I figured why not add some metadata to it. I don't think there's a way to get the ruby version it was generated under from the gemfile.lock, so that value would have to be stored somewhere else anyway. So why not store the rails version there too, one place with the pertintent environmental context details.
@jrochkind - I've encountered problems with updating a rails version (4.2.2 to 4.2.3), which I've tried to discuss in https://github.com/cbeer/engine_cart/issues/23, and these problems are related to the general idea of trying to detect a stale test app.
@darrenleeweber Still seems like a good idea to me, but I've learned that engine cart is just gonna be a struggle no matter what, I think. The maintainers maybe think this will just add complexity and make it worse, and I don't know that they're wrong.
Looking towards a future feature that can notice a 'stale' generated app (for a different ruby or rails), and clean it and regenerate it automatically.
But in the meantime, it's still potentially useful to store some contextual information in the .generated_engine_cart file that already exists, for possible debugging purposes. At any rate, doesn't hurt.