kumarshantanu / lein-sub

Leiningen plugin for executing tasks on sub-projects
67 stars 10 forks source link

Tasks not run in sub project directory #3

Closed mylesmegyesi closed 12 years ago

mylesmegyesi commented 12 years ago

I have speclj working in all my sub projects for unit testing, but if I run "lein sub spec", in the root project directory, it just says that the task is not installed.

Is it possible to have the tasks run within the actual sub project directory where those tasks do exist?

kumarshantanu commented 12 years ago

Problem no. 1 appears to be unavailability of the "speclj" plugin in the parent as a dev-dependency, which is why you are getting the "task not installed" error. Try installing the plugin, so that it is available to all (parent and sub) projects.

lein plugin install speclj "1.2.0"

Problem no. 2 seems to be related to the way speclj invokes the command to run speclj.main: https://github.com/slagyr/speclj/blob/master/src/leiningen/spec.clj

A Leiningen plugin should never assume that the lein command was invoked in the project directory, or that the current directory is the project directory. Rather, the plugin should use the :root key of project to find out the project base directory: http://groups.google.com/group/leiningen/browse_thread/thread/9e87cab2959ece54/5b9821898592de02

As I understand, speclj should fix the invocation of speclj.main by setting the base directory as the value of (:root project) when launching the new process: http://docs.oracle.com/javase/6/docs/api/java/lang/Runtime.html#exec(java.lang.String, java.lang.String[], java.io.File)

mylesmegyesi commented 12 years ago

Thanks, I'll submit a pull request for speclj.