avescodes / lein-try

A Leiningen plugin for trying out new libraries
313 stars 13 forks source link

Default to "RELEASE" if no version given #7

Closed JacekLach closed 11 years ago

JacekLach commented 11 years ago

Allowing people to just say lein try clj-time environ and automatically fetch latest releases of those. I believe this is a significant improvement over having to find out what the latest version number is.

Telling versions from library names should be easy enough - they'll always be "RELEASE", "LATEST", or start with a number. I don't think it's legal for a group name to start with a digit (and project names in lein must be symbols anyway), so this shouldn't clash.

avescodes commented 11 years ago

Given how we currently fetch dependencies (via try.clj#L23) we'd have to come up with some mechanism for reading project.clj's repository listings and doing a search on those repos. I'll have to think on this one for a bit (or wait for a PR :smile:)

xsc commented 11 years ago

@rkneufeld I'm not sure I understand you correctly, but running lein-try with "RELEASE" instead of a version number works for me:

$ rm -rf ~/.m2/repository/panoptic
$ lein try panoptic RELEASE
Retrieving panoptic/panoptic/0.2.1/panoptic-0.2.1.pom from clojars
Retrieving panoptic/panoptic/0.2.1/panoptic-0.2.1.jar from clojars
nREPL server started on port 52700
REPL-y 0.2.0
Clojure 1.5.1
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)

user=>

So, I guess, the only thing you'd need is a mechanism to "expand" a call like lein try panoptic clj-time to the equivalent of lein try [panoptic "RELEASE"] [clj-time "RELEASE"]. I think that's why @JacekLach mentioned that distinguishing between artifact IDs and version numbers is (probably) not very hard.

avescodes commented 11 years ago

@xsc Ahh, I misunderstood. Yeah this wouldn't be terribly hard to do. I'd gladly accept a pull request that came with some good test coverage and updates to the README. I might not get time to get to this for a bit.

xsc commented 11 years ago

@rkneufeld I might tackle this tomorrow afternoon if I can find the time. I really like this plugin so I'm always glad to contribute. :)

avescodes commented 11 years ago

Thanks, I'm off the grid this weekend, so I probably won't get back to you on anything until Monday.

avescodes commented 11 years ago

8 fixed this.