Giter VIP home page Giter VIP logo

lein-git-version's Introduction

lein-git-version

I'm a big fan of DRY. I already have version information in git for my projects. Remembering to maintain that information in my project.clj is a PITA. So... Here's a Leiningen plugin to obtain a version identifier from git, using:

git describe --match 'v*.*' --abbrev=4 --dirty=**DIRTY**

It uses annotated git tags (those set with git tag -a) as the authoritative source of version information for your project.

It then substitutes that version into the project on the fly, so every lein task that uses the project version sees the one obtained from git.

In addition, it injects a file into /src//version.clj, containing a def for the version.

Usage

Put [org.clojars.cvillecsteele/lein-git-version "1.0.0"] into the :plugins vector of your project.clj.

That's it. The version string set in your project.clj will be ignored, and all lein tasks relying on it will instead see the git-ified version.

For example, with a project.clj that looks like this:

(defproject nifty "bLAH BLaH"
  :description "Do nifty things"
  ...)

You can do this:

$ git tag -a -m "First version!" v1.0.0
$ lein git-version
1.0.0
$ lein jar
Created /Users/colinsteele/Projects/nifty/target/nifty-1.0.0.jar
$ cat src/nifty/version.clj
;; Do not edit.  Generated by lein-git-version plugin
(ns nifty.version)
(def version "1.0.0")
$

License

Copyright © 2012 Colin Steele

Distributed under the Eclipse Public License, the same as Clojure.

lein-git-version's People

Contributors

cvillecsteele avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.