xscDev

Something Something Development

Upgrade your Project’s Dependencies using lein-ancient (wip)

with 2 comments

Following an idea by Mayank Jain, I let lein-ancient meet my new Clojure rewrite library rewrite-clj to be able to automatically upgrade the dependencies/plugins in a project’s “project.clj”. They got along quite well and the work is done – however, seeing as there is a variety of Clojure project files out there and I’m not 100% sure that everything always works correctly, I’d very much like for as many people as possible to try out the new feature and tell me if they encounter any problems. I’d really appreciate that!

This comment on GitHub sums up how to retrieve and run the latest version of lein-ancient. If everything works smoothly you might get an output similar to the following:

$ lein ancient :upgrade :interactive

[com.taoensso/timbre "2.4.1"] is available but we use "2.1.2"
Do you want to upgrade? [yes/no] yes
Upgrade to [com.taoensso/timbre "2.4.1"] from "2.1.2"

[potemkin "0.3.1"] is available but we use "0.3.0"
Do you want to upgrade? [yes/no] no

[pandect "0.3.0"] is available but we use "0.2.3"
Do you want to upgrade? [yes/no] yes
Upgrade to [pandect "0.3.0"] from "0.2.3"

And to verify that the right changes where made you can, for example, use Git’s “diff” command (if your project.clj is under version control):

$ git diff project.clj
diff --git a/project.clj b/project.clj
index 18a408a..3031031 100644
--- a/project.clj
+++ b/project.clj
@@ -4,9 +4,9 @@
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
   :dependencies [[org.clojure/clojure "1.5.1"]
-                 [com.taoensso/timbre "2.1.2"]
+                 [com.taoensso/timbre "2.4.1"]
                  [potemkin "0.3.0"]
-                 [pandect "0.2.3"]]
+                 [pandect "0.3.0"]]
   :repositories  {"sonatype-oss-public" "https://oss.sonatype.org/content/groups/public/"}
   :exclusions [org.clojure/clojure]
   :profiles {:test {:dependencies [[midje "1.5.1"]]

Thanks in any case!

Written by Yannick

July 24th, 2013 at 4:51 pm

  • http://daddye.it/ DAddYE

    Thanks for that! Looks awesome! Would be nice to see the same thing for user profile

    • http://dev.xscheme.de/ Yannick

      Glad you like it. The user profile upgrade mechanism is on the TODO list. You can expect it to be part of the final 0.4.3 release. :)