GithubHelp home page GithubHelp logo

leinjacker's Introduction

leinjacker

leinjacker is a library of utilities for Leiningen plug-in developers. Current features include:

  • leinjacker.eval gives you an easy way for your project to call eval-in-project or sh and have it work independent of the version of Leiningen the user is running. Additionally, there is a function hook-eval-in-project. This function can be used provide custom behavior (like middleware) for eval-in-project, such as for code instrumentation or alternative JVM launching scripts.

    Finally, there is the in-project macro. This allows you to eval code in your project without having to construct the form by hand. You just provide the bindings used to pass state to your project along with the code that uses those bindings.

  • leinjacker.deps adds some handy functions for querying and manipulating the dependencies of a project.

  • leinjacker.utils provides useful utilities for supporting multiple Leiningen generations, such as:

    • try-resolve and try-resolve-any - useful for resolving namespaced symbols at runtime.
    • lein-generation - returns the current Leiningen generation (1 or 2) as an integer.
    • lein-home - returns the path to current Leiningen home (typically ~/.lein/). This abstracts away the location of Leiningen's leiningen-home, since it moved between generations.
    • read-lein-project - reads a project.clj and returns the project map. This abstracts away the location and name of Leiningen's project read function, since it was renamed between generations.
    • abort - 1.x- and 2.x-compatible way to signal task failure.
    • apply-task - 1.x- and 2.x-compatible way to apply arguments to a task.
    • get-classpath - 1.x- and 2.x-compatible way to get the classpath from a project map.
  • leinjacker.lein-runner has functions for finding and running the lein command on the path for each Leiningen generation. Useful for testing plugins under various Leiningen versions. It provides:

    • find-lein-cmd - looks for lein on the $PATH by trying to call it. It takes a generation argument, which should be 1 or 2. It will then look for a command called lein or lein<generation> that reports the correct generation when called with lein version. It will memoize the found cmd to ./.lein-commands to speed up subsequent calls. This can be disabled via the memoize? arg.
    • run-lein - Will execute the given Leiningen generation in dir with the given args, returning the result map from the 'clojure.java.shell/sh' call.

    See leinjacker's tests for examples of usage.

Usage

Just drop the following into your plug-in’s project.clj:

(defproject lein-tau "6.283"
  :name "The π is a lie!"
  // other stuff
  :dependecies [[leinjacker "0.4.0"]
                // more deps
		])

Although this library is built using Leiningen 2, the library itself does not require it. It should also work with Clojure 1.2 and above.

Contributing

If you ever find yourself writing the same generic code in more than one of your plug-ins, feel free to send it here.

Contributors

  • Daniel Solano Gómez
  • Tobias Crawley
  • Phil Hagelberg
  • David Greenberg
  • Justin Balthrop

License

Copyright © 2012 Sattvik Software & Technology Resources, Ltd. Co. All rights reserved.

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

leinjacker's People

Contributors

dgrnbrg avatar ninjudd avatar raynes avatar sattvik avatar technomancy avatar tobias 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.