Coder Social home page Coder Social logo

b12n-deps's Introduction

b12n-deps

Clojars Project Dependencies Status ClojarsDownloads

A Clojure library designed to add dependency to your project at runtime. It uses alembic behind the scene.

Usage

To add new dependency to your active REPL session at runtime try

For leiningen base project, you can add the following to your project.clj

:profiles {:dev {:dependencies [[net.b12n/deps "1.0.0"]]}}

Then from your Clojure file you can then try something like

(require '[b12n.deps.core :refer [add-depency]]')
(require '[alembic.still :refer [distill lein load-project]])

;; Add new dependency to your session without adding it to your project.clj or deps.edn
(add-dependency :hara/io.file "3.0.12")   ;;=> nil
(add-dependency "hara/io.file" "3.0.12")  ;;=> nil
(add-dependency '[hara/io.file "3.0.12"]) ;;=> nil

;; Now use it in the project
(require '[hara.io.file :as hf])

;; Test that we can actually call the function of this library
(hf/list ".")

;; Call lein task to printout the dependency tree
(alembic.still/lein deps :tree) ;;=> see your REPL

;; To make your change permanent, you can add the above dependency to your `project.clj` or `deps.edn` file as appropriate.
;; Then run the following command in your active session.
;; See: https://github.com/pallet/alembic/blob/develop/src/alembic/still.clj#L299

;; Tips: If you are using Emacs and install clj-refactor you can use this like
;; M-x cljr-add-project-dependency
;; Then you can use this dependency permanently in your project

(load-project "project.clj")    ;;=> see your REPL
(alembic.still/lein deps :tree) ;;=> see your REPL

;; Check if we can use the new dependency
(require '[hara.io.file :as hf])
(hf/list ".")

;;=> You should see the same result as before

;; useful for check out the source
(clojure.repl/source hf/list)
(clojure.repl/doc hf/list)

TODO

License

Copyright © 2020 Burin Choomnuan

This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.

This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version, with the GNU Classpath Exception which is available at https://www.gnu.org/software/classpath/license.html.

b12n-deps's People

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.