xsc / lein-ancient

Check your Projects for outdated Dependencies
MIT License
561 stars 33 forks source link

Work on templated project.clj files #16

Closed clojens closed 10 years ago

clojens commented 11 years ago

Hey xsc,

Thanks for the work you've done on lein-ancient I like to use it as much as I can and has made life on the version management level a lot easier so thumbs up. The new :upgrade has been something I long anticipated for as well so I'm a happy camper.

One thing I noticed today though, which probably would make for a nice feature expansion, is if it would be possible to process any leiningen/new/project.clj files. Those have some handlebars in them for file names and such like {{project_name}} and what not. As it seems, currently ancient will throw exceptions on these.

Reason being a lot of projects like, for example Pedestal which I am updating parts of, carry around templates to help bootstrap their application and I feel these could benefit as well from the magic. Another next step could be to (use fs?) to find nested project.clj files within a folder and :interactive-ly perhaps ask for those to be checked as well or turned on perhaps using a :nested or the likes to enable searching the subfolders and taking those into account? Just an idea that popped up, let me know what you think.

Regards, Rob

xsc commented 11 years ago

Hi Rob,

thank you for some great ideas!

Those have some handlebars in them for file names and such like {{project_name}} and what not.

That's something that would have to be included into rewrite-clj. Since {{...}} isn't really valid Clojure code/EDN (or is it?) I'm not sure how to handle this. But I'll work something out.

Another next step could be to (use fs?) to find nested project.clj files within a folder [...]

This is definitely possible and should be included in one of the next releases. (Actually, I'm not sure when that will be since I'm currently swamped with work. But, no worries, I'll find the time. Soon-ish.)

Yannick

clojens commented 11 years ago

Hey Yannick,

No I fear you have a point with the brackets being invalid Clojure, it wouldn't be since the outer map is missing a key. Not so much joking as stating a fact on how any parser would view it. And I just checked, crappy (EDN) string-reader even reads forms, not strings. I'm not sure if I can think up a elegant solution one, two, three besides the crude method: all involved regex/subst. I haven't dived into your source either so I'll let you be the judge of what is appropriate for the plugin in terms of viable solutions.

Great job so far tho so I trust we'll find something, and if not, it's not a huge loss :) Thanks for the update,

Rob

xsc commented 11 years ago

@clojens I included the recursive check/upgrade into the freshly crafted 0.5.1 release of lein-ancient. Unfortunately, working on templated files does not seem to be particularly easy and even though rewrite-clj can handle them without problems I still need the respective project map as a Clojure data structure which is currently generated using Leiningen's built-in read function. Obviously, that one doesn't like malformed Clojure.

I'll keep on trying, though.

EDIT: Messed up the 0.5.0 release...

mynomoto commented 10 years ago

@clojens There is an alternative approach to keep templates updated but it's really aggressive, as it checks the latest versions of libs when the user runs lein new template. The Hoplon template uses that method: https://github.com/tailrecursion/hoplon-template/blob/master/src/leiningen/new/hoplon.clj

xsc commented 10 years ago

I'll close this for now since there exists an alternative, albeit not ideal, approach (see above). Also, I fear that accepting malformed Clojure might cause some problems in the long run.