Lein console (e.g. sbt)

Is there any built-in functionality or a plugin to get a lein console, so, for example, you could test it without waiting for a JVM every time you start.

$ lein console >>> test ... >>> test ... >>> jar 

Note. I would like to run test runs myself, and not, for example, by viewing the source files. That is why I would like to have a lein console.

Clarification: I'm not looking for lein repl . I would like to have a console where I could execute lein task commands.

+5
source share
3 answers

Perhaps you should take a look at grenchman . Although not a Leiningen console, it at least allows reuse of an existing REPL session. From what I am collecting, the usage is as follows:

  • Move something that is inside the project and call:

     $ lein repl :headless 
  • In the project directory use:

     $ grench lein <task> <options> 

Tasks will be executed inside the already deployed JVM Leiningen, and the launch overhead should disappear.

Creating a grenchman seems tedious, though, and it is recommended that you use one of the precompiled binaries ( BUT they are currently unavailable ).

And finally, this page also states:

The Grenchman is still very new and may not be completely reliable.

So good luck, probably?

+1
source

In older versions of leiningen, lein interactive , which behaved in the same way as the function you are requesting: it opened a shell into which you could enter test and run its lein test from an already running jvm lane, etc. I think this feature was removed when switching to lane 2.0, and although I don’t know why I suspect there is a good reason. Maybe try asking in #leiningen on freenode?

+1
source

One option is to run a replica from leiningen own jar file.

 $ java -cp ~/.lein/self-installs/leiningen-2.5.0-standalone.jar clojure.main Clojure 1.6.0 user=> (require '[leiningen.core.project :as project] '[leiningen.test :as test]) nil user=> (def prj (project/read)) #'user/prj user=> (test/test prj) lein test org.noisesmith.orsos.load-test Ran 3 tests containing 3 assertions. 0 failures, 0 errors. nil user=> (require '[leiningen.jar :as jar]) nil user=> (jar/jar prj 'org.noisesmith.orsos) Compiling org.noisesmith.orsos Created /media/justin/806084F16084EEEA/clojure/orsos/target/orsos-0.1.0-SNAPSHOT.jar {[:extension "jar"] "/media/justin/806084F16084EEEA/clojure/orsos/target/orsos-0.1.0-SNAPSHOT.jar"} user=> 

As a baseline, this can run lein tasks without having to restart the lane every time. If you also use rlwrap or use nrepl , it becomes more convenient. As far as I know, this does not have convenient tools (although it can easily be there).

If you want to use tasks from lein plugins, you can add them to arg -cp .

0
source

Source: https://habr.com/ru/post/1212533/


All Articles