Leiningen 2      Humane build     management forClojureMadeSimple.co.uk
slideshare.net/jr0cket  This slide deck is available to follow along with on slideshare.net
of Java buildmanagement
...there was Ant,  Ant begat Ivy,Ant begat Maven
… and there was much XML all around
buildmanagement
Human verses Computer readable build jobs
Leiningen      … more fun than Maven… easy way to kick-start your Clojure             addiction
Leiningen: Manual installDownload the Leiningen 2 install script from                    leiningen.orgMove the lein file t...
Leiningen: package managers●   Ubuntu●   Debian●   Fedora●   CentOS
Leiningen     also staring in  Eclipse pluginCounter Clockwise
All the usual tasks...lein new       ●   Create a new clojure projectlein deps      ●   Download all dependencieslein run ...
...and then somelein uberjar   - Include Clojure & all your               dependencies in one jarlein repl      - Fire up ...
Fire up the REPL             REPL: read, evaluate, print loop – dynamiclein repl    environment for Clojure and other lisps
Typing code into the REPL Develop functions and data structures on the flyREPL: read, evaluate, print loop – dynamic envir...
Create a new project lein new my-project cd my-project lein depsLein deps will check your project.clj configuration file a...
Anatomy of a new projectNote: dashes in project names are converted to       underscores to make Java happy!
Over-riding defaults
Create project with a different           templatelein new  template-name    my-project
Example: WebNoir templatelein new noir fpdays2012-web
Version your project with Git cd my-project git init Create a repo on github & add it to your project git remote add origi...
Open project in emacscd my-projectemacs project.clj
project.clj - project definitionLein deps will check this project.clj configuration file anddownload any libraries (jar fi...
Group DependenciesUsually a reversed domain name
Dev DependenciesDev-dependencies: Add libraries only needed fordevelopment, not packaged when code deployed
https://clojars.org/
http://search.maven.com
Add a REPL sessionREPL: read, evaluate, print, loop – dynamic environment for Clojureand other lisps
Add REPL session to all projects~/.lein/profiles.clj
Fire up the REPL in Emacs                    M – x                   clojure-                   jack-inM – x represents th...
REPL in Emacs
Add web based REPL     ~/.lein/profiles.cljREPL: read, evaluate, print, loop – dynamic environment for Clojureand other li...
Leiningen WebRepl plugin
Local Repositories  (just like Maven)
Libraries kept in local .m2 folder
Repositorieshttps://github.com/technomancy/leiningen/blob/preview/sample.project.clj
Running your   project
Create a new projectlein runRuns the main function, or specify main with -moption
Long running processeslein trampoline run     -m my-app.server 5000Web applications - noir - enclojure - ring
Running Tests lein tests lein tests my.proj.code lein help testsAutomating test runs ?
Deployment
Jars & Uber Jarslein jar- package up your project,requires Clojure on the serverlein uberjar- package up everything, evenC...
project.clj for jar / uberjar
Clojure code for jar / uberjar
Deploy to ClojarsCreate a maven pomlein pomCreate a maven pomscp pom.xml myproject-0.1.0.jarclojars@clojars.org:
Deploy to ClojarsOr just use lein-clojarshttps://github.com/ato/lein-clojars
Deploying to the     Cloud
Uses your Leiningen project.clj- Create your account & install the toolbelt- Create your instance- Push your git repo- Fir...
Leiningen Plug-ins
Running scripts   Copying files    DVCS (git)   ContinuousIntegration server     (Jenkins)
Leiningen.org      - Tutorials- Github Repository        - News   - Bug reporting
Choose Life...… choose Clojure
Thank you            @jr0cketClojureMadeSimple.co.ukslideshare.net/jr0cket
Leiningen 2 - Humane build management for Clojure
Leiningen 2 - Humane build management for Clojure
Leiningen 2 - Humane build management for Clojure
Leiningen 2 - Humane build management for Clojure
Leiningen 2 - Humane build management for Clojure
Leiningen 2 - Humane build management for Clojure
Leiningen 2 - Humane build management for Clojure
Upcoming SlideShare
Loading in …5
×

Leiningen 2 - Humane build management for Clojure

2,443 views

Published on

Developer experience is important and Clojure developers have the pleasure of managing their build process in Clojure with Leiningen.org

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,443
On SlideShare
0
From Embeds
0
Number of Embeds
15
Actions
Shares
0
Downloads
23
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Leiningen 2 - Humane build management for Clojure

  1. 1. Leiningen 2 Humane build management forClojureMadeSimple.co.uk
  2. 2. slideshare.net/jr0cket This slide deck is available to follow along with on slideshare.net
  3. 3. of Java buildmanagement
  4. 4. ...there was Ant, Ant begat Ivy,Ant begat Maven
  5. 5. … and there was much XML all around
  6. 6. buildmanagement
  7. 7. Human verses Computer readable build jobs
  8. 8. Leiningen … more fun than Maven… easy way to kick-start your Clojure addiction
  9. 9. Leiningen: Manual installDownload the Leiningen 2 install script from leiningen.orgMove the lein file to an executable location, eg. ~/binMake the install script executable and run the install chmod u+x ~/bin/lein lein
  10. 10. Leiningen: package managers● Ubuntu● Debian● Fedora● CentOS
  11. 11. Leiningen also staring in Eclipse pluginCounter Clockwise
  12. 12. All the usual tasks...lein new ● Create a new clojure projectlein deps ● Download all dependencieslein run ● Run your applicationlein jar ● Deploy your app as a jar
  13. 13. ...and then somelein uberjar - Include Clojure & all your dependencies in one jarlein repl - Fire up the dynamic coding environment (REPL) - Hook to start a REPL fromjack-in within Emacs
  14. 14. Fire up the REPL REPL: read, evaluate, print loop – dynamiclein repl environment for Clojure and other lisps
  15. 15. Typing code into the REPL Develop functions and data structures on the flyREPL: read, evaluate, print loop – dynamic environment for Clojure and other lisps
  16. 16. Create a new project lein new my-project cd my-project lein depsLein deps will check your project.clj configuration file anddownload any libraries (jar files) that are required by the project
  17. 17. Anatomy of a new projectNote: dashes in project names are converted to underscores to make Java happy!
  18. 18. Over-riding defaults
  19. 19. Create project with a different templatelein new template-name my-project
  20. 20. Example: WebNoir templatelein new noir fpdays2012-web
  21. 21. Version your project with Git cd my-project git init Create a repo on github & add it to your project git remote add origin git@github.com/account/project.git git push -u origin masterYou may want to edit your .git-ignore file also
  22. 22. Open project in emacscd my-projectemacs project.clj
  23. 23. project.clj - project definitionLein deps will check this project.clj configuration file anddownload any libraries (jar files) that are required by the project
  24. 24. Group DependenciesUsually a reversed domain name
  25. 25. Dev DependenciesDev-dependencies: Add libraries only needed fordevelopment, not packaged when code deployed
  26. 26. https://clojars.org/
  27. 27. http://search.maven.com
  28. 28. Add a REPL sessionREPL: read, evaluate, print, loop – dynamic environment for Clojureand other lisps
  29. 29. Add REPL session to all projects~/.lein/profiles.clj
  30. 30. Fire up the REPL in Emacs M – x clojure- jack-inM – x represents the keyboard combination of the meta key followed by x.Then the command clojure-jack-in is entered.
  31. 31. REPL in Emacs
  32. 32. Add web based REPL ~/.lein/profiles.cljREPL: read, evaluate, print, loop – dynamic environment for Clojureand other lisps
  33. 33. Leiningen WebRepl plugin
  34. 34. Local Repositories (just like Maven)
  35. 35. Libraries kept in local .m2 folder
  36. 36. Repositorieshttps://github.com/technomancy/leiningen/blob/preview/sample.project.clj
  37. 37. Running your project
  38. 38. Create a new projectlein runRuns the main function, or specify main with -moption
  39. 39. Long running processeslein trampoline run -m my-app.server 5000Web applications - noir - enclojure - ring
  40. 40. Running Tests lein tests lein tests my.proj.code lein help testsAutomating test runs ?
  41. 41. Deployment
  42. 42. Jars & Uber Jarslein jar- package up your project,requires Clojure on the serverlein uberjar- package up everything, evenClojure
  43. 43. project.clj for jar / uberjar
  44. 44. Clojure code for jar / uberjar
  45. 45. Deploy to ClojarsCreate a maven pomlein pomCreate a maven pomscp pom.xml myproject-0.1.0.jarclojars@clojars.org:
  46. 46. Deploy to ClojarsOr just use lein-clojarshttps://github.com/ato/lein-clojars
  47. 47. Deploying to the Cloud
  48. 48. Uses your Leiningen project.clj- Create your account & install the toolbelt- Create your instance- Push your git repo- Fire up your browserblog.raynes.me/blog/2011/11/03/moving-try-clojure-to-heroku/devcenter.heroku.com/articles/clojure-web-application
  49. 49. Leiningen Plug-ins
  50. 50. Running scripts Copying files DVCS (git) ContinuousIntegration server (Jenkins)
  51. 51. Leiningen.org - Tutorials- Github Repository - News - Bug reporting
  52. 52. Choose Life...… choose Clojure
  53. 53. Thank you @jr0cketClojureMadeSimple.co.ukslideshare.net/jr0cket

×