Source : https://www.codeschool.com/code_tv/getting-started-with-clojure-part-3
- 7. Beyond the REPL
- Look into the workflow and general project mgmt with Leinigen
- To create a new project -> lein new test_proj
- To see what has been created, cd into the directory "test_proj". You'd see project.clj and 2 directories - src and test. project.clj contains the configuration of the project
- When you open the file, you'd see that it contains clojure syntax, a list (defproject ....) which has dependencies, version information ..etc.
- "lein deps" downloads dependencies to local machine
- Go into core.clj within src/test_proj folder
- if you define a main function, we can run the project from command line using "lein run" command
- Before doing lein run, you'd need to modify project.clj to indicate where the main function is. e.g ":main test_proj.core"
- You can run lein repl and redefine the function
- Tests are defined in test/test_proj/test folder. Look for core.clj file in this folder.
- Test can be run using lein test
- How to ship a clojure project
- add :gen-class to the namespace declaration in core.clj in src folder
- lein uberjar creates a jar that is executable in standalone which can be run using java - jar <our jar>
- 8. Learning More
- http://clojure.org/
- http://clojuredocs.org
- http://www.4clojure.com
- Programming Clojure book : http://pragprog.com/book/shcloj2/programming-clojure
- Clojure mailing list : https://groups.google.com/forum/#!forum/clojure
No comments:
Post a Comment