leiningen2 - humane build management for clojure

Download Leiningen2 - humane build management for clojure

If you can't read please download the document

Upload: john-stevenson

Post on 16-Apr-2017

1.729 views

Category:

Business


0 download

TRANSCRIPT

Leiningen 2

Humane build management for

ClojureMadeSimple.co.uk

This slide deck is available to follow along with on slideshare.net

slideshare.net/jr0cket

of Java build management

...there was Ant,Ant begat Ivy,Ant begat Maven

and there was much XML all around

Here end'eth the lesson..

(except of course this is just the end of the beginning)

Human verses Computer readable build jobs

build management

Leiningen

more fun than Maven

easy way to kick-start your Clojure addiction

Installing Leiningen

Download the Leiningen 2 install script from leiningen.org

Move the lein file to an executable location, eg. ~/bin

Make the install script executable and run the install chmod u+x ~/bin/leinlein

All the usual tasks,
and then some

lein newlein depslein runlein jarlein uberjar

lein repllein jack-in

Create a new clojure project

Download all dependencies

Run your application

Deploy your app as a jar

Deploy your app & clojure libraries

Start the interactive shell (repl)

Start repl server and connect (in Emacs)

lein repl

Fire up the REPL

REPL: read, evaluate, print loop dynamic environment for Clojure and other lisps

(doc map)

View function documentation

(source map)

Show function source code

REPL driven development

Develop functions and data structures on the fly

REPL: read, evaluate, print loop dynamic environment for Clojure and other lisps

Loading code into the REPL

Develop functions and data structures on the fly

REPL: read, evaluate, print loop dynamic environment for Clojure and other lisps

lein new my-projectcd my-projectlein deps

Create a new project

Lein deps will check your project.clj configuration file and download any libraries (jar files) that are required by the project

Anatomy of a new project

lein new my-projectcd my-projectlein deps

Create a new project

Lein deps will check your project.clj configuration file and download any libraries (jar files) that are required by the project

cd my-projectgit init Create a repo on github & add it to your projectgit remote add origin [email protected]/account/project.git git push -u origin master

Version your project with Git

You may want to edit your .git-ignore file also

cd my-projectemacs project.clj

Open project in emacs

project.clj - project definition

Lein deps will check this project.clj configuration file and download any libraries (jar files) that are required by the project

Dev Dependencies

Add libraries only needed for developmentNot packaged when code deployed

https://clojars.org/

http://search.maven.com

Add a REPL server

REPL: read, evaluate, print, loop dynamic environment for Clojure and other lisps

Add REPL server to all projects

~/.lein/profiles.clj

M x clojure-jack-in

Fire up the REPL in Emacs

M x represents the keyboard combination of the meta key followed by x. Then the command clojure-jack-in is entered.

C c C j

Define your own Global short-cut

(global-set-key (kbd "C-c C-j") 'clojure-jack-in)

Open your .emacs.d/init.el file and add:

In Emacs, start the REPL with

REPL in Emacs

Add web based REPL

REPL: read, evaluate, print, loop dynamic environment for Clojure and other lisps

~/.lein/profiles.clj

Leiningen WebRepl plugin

Local Repositories

(just like Maven)

Libraries kept in local .m2 folder

Nexus / Artefactory repositories

https://github.com/technomancy/leiningen/blob/preview/sample.project.clj

Running your project

lein runRuns the main function, or specify main with -m option

Create a new project

lein trampoline run -m my-stuff.server 5000

Long running processes

lein testslein tests my.proj.code

Running Tests

Deployment

Jars & Uber Jars

lein uberjar

Leiningen Plug-ins

Running scriptsCopying filesDVCS (git)Continuous Integration server (Jenkins)

Leiningen.org

- Tutorials- Github Repository- News- Bug reporting

Choose Life...

choose Clojure

Thank you

LondonClojurians.org

@jr0cket ClojureMadeSimple.co.uk

slideshare.net/jr0cket

Muokkaa otsikon tekstimuotoa napsauttamalla

Muokkaa jsennyksen tekstimuotoa napsauttamallaToinen jsennystasoKolmas jsennystasoNeljs jsennystasoViides jsennystasoKuudes jsennystasoSeitsems jsennystasoKahdeksas jsennystasoYhdekss jsennystaso