Comments (14)
That's obviously a good idea. However, it would require rewriting the "project.clj" which poses a few problems:
- Currently, lein-ancient gets a preprocessed project map (that contains everything in "project.clj" extended by things like default values or plugins specified in "~/.lein/profiles.clj"), so what exactly should be written back into "project.clj"? This can be solved by not relying on the preprocessed map anymore and instead parsing "project.clj"/"profiles.clj" directly - losing the advantage of having Leiningen do all the heavy lifting I/O-wise.
- Comments and indentation have to be preserved. This is the only thing I found remotely capable of doing that and it looks rather complicated...
So, do you know of any plugins that rewrite source files? I could use some inspiration here. :)
from lein-ancient.
re space preservation - I was going to recommend whatever https://github.com/lynaghk/cljx uses, turns out to be the same as what you've already found. :)
from lein-ancient.
Thanks, @trevor, that will at least give me some hints on usage. I'll play around with it once I find some time and then address the enhancement.
from lein-ancient.
Okay, so I wrote my own rewrite library and used it to implement this enhancement. I'd be very glad for feedback before I release it officially; so use the latest snapshot version to try it out:
[lein-ancient "0.4.3-SNAPSHOT"]
You can then run:
lein ancient :upgrade
(to automatically upgrade all dependencies)lein ancient :upgrade :interactive
(to have lein-ancient prompt you for input before changing something)lein ancient :upgrade :print
(to print the resulting project.clj instead of writing it to disk)
Options can be freely combined and include the ones for the standard "check" task, so the following is possible, too:
lein ancient :upgrade :interactive :print :plugins :allow-snapshots
That about what you imagined?
from lein-ancient.
@xsc Not sure if it fits here, but I've just tested lein ancient for the first time. lein ancient :upgrade :interactive
worked smoothly and did what it advertised. Very, very nice!
One minor problem, though. My project.clj's :description string was spanning multiple lines, and it became converted to a all-on-one-line string with \n line breaks. I'd prefer "real" line breaks in the file, I mean, that's why clojure's strings can span multiple lines.
from lein-ancient.
Looks really good! And I confirm what @tsdh said. If the description is in newlines after doing :upgrade it becomes "First line\n Second line."
Everything else is working great. It even preserved the comments.
Tried on 3 different projects.
Thank you for your efforts :)
from lein-ancient.
I'll look into fixing the string issue. That's a problem in rewrite-clj's parser/printer implementation.
Glad you like it so far. :-)
from lein-ancient.
Btw any idea if this will work for plugins as well?
from lein-ancient.
@firesofmay I've just tried it out. It works with plugins declared in your project.clj, but not those declared user-wide in ~/.lein/profiles.clj.
lein ancient :upgrade :plugins :interactive
It would be nice if it also had a :user-profiles option to check those instead of the current project.
from lein-ancient.
I'll add a user profile upgrade mechanism after my next round of refactoring. Gotta clean up a little first. ;-)
from lein-ancient.
@yannick
Awesome! Thanks a lot! :)
On Fri, Jul 26, 2013 at 1:28 PM, Yannick Scherer
[email protected]:
I'll add a user profile upgrade mechanism after my next round of
refactoring. Gotta clean up a little first. ;-)—
Reply to this email directly or view it on GitHubhttps://github.com//issues/7#issuecomment-21606660
.
Regards,
Mayank.
from lein-ancient.
rewrite-clj should now support multi-line strings; lein-ancient should thus now create the expected output. You might have to force the download of the latest rewrite-clj SNAPSHOT:
rm -rf ~/.m2/repository/rewrite-clj
I'll close this issue if everything works as expected and open a new one for the whole "profiles.clj" thing.
from lein-ancient.
@xsc Yes, now the multi-line strings work. Thanks.
from lein-ancient.
Yup, multi-line strings is working! :)
On Fri, Jul 26, 2013 at 7:28 PM, Tassilo Horn [email protected]:
@xsc https://github.com/xsc Yes, now the multi-line strings work.
Thanks.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/7#issuecomment-21622226
.
Regards,
Mayank.
from lein-ancient.
Related Issues (20)
- How do we make it work with s3-wagon-private? HOT 4
- Fail to detect out of date plugin HOT 3
- Is `lein-ancient` incapable of dealing with permanent redirects (301)? HOT 1
- Ability to prevent dependencies from updating -> LOCK HOT 2
- Enhancement: check dependencies defined via tools.deps in addition to / instead of those in project.clj HOT 1
- Support for versions defined via a var?
- Release date metadata?
- Any good way to exclude weird versions? HOT 5
- exit code not set for `upgrade` failure
- Resolve aliases for test task recursively
- lein ancient should warn if the version of the `lein-ancient` plugin is old
- Should support ":env" as repository password HOT 1
- Check dependencies that are not part of `project.clj` HOT 1
- Failed to run upgrade when private maven mirror is configured. HOT 1
- Unable to load library jansi on version 0.7.0 HOT 7
- java.lang.AssertionError on 0.7.0 HOT 6
- False positive on Kaocha
- "upgrade" breaks projects with mysql-connector HOT 1
- Lots of java.lang.NoSuchMethodError warnings HOT 4
- re-matches assertion error with profiles section in project.clj
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lein-ancient.