I didn't think of that.  In my case, it was in a plugin.  I bet it would
work if you set :eval-in-leiningen to true.

Plugins are also pretty easy to write.

I'm not sure you need the lien exec plugin...  an alias for ["run" "-m"
"foo.bar/baz"]?




On Tue, Jun 24, 2014 at 12:03 PM, Phillip Lord <phillip.l...@newcastle.ac.uk
> wrote:

>
> But where did you define the hook? In the project itself.
>
> My current best solution to this problem is to use an alias and the
> lein-exec plugin so I have a sort of working solution now, but I'd still
> like it to be a bit slicker if possible.
>
> Phil
>
> Jason Felice <jason.m.fel...@gmail.com> writes:
>
> > I think this approach should work.  When I've specified hooks in this
> way,
> > I've specified the function name as well... e.g.:
> >
> > `:hooks [skeletor-clojure.hooks/add-revision-to-config.clj]`
> >
> > (don't let the `.clj` confuse you, the function name is _actually_
> > `add-revision-to-config.clj`).
> >
> >
> > On Fri, Jun 20, 2014 at 4:06 AM, Phillip Lord <
> phillip.l...@newcastle.ac.uk>
> > wrote:
> >
> >>
> >>
> >> I've been struggling with leiningen project hooks as I believe that I
> >> need them for my current project.
> >>
> >> I am writing an manual with code examples, using a literate programming
> >> technology. The main source is in asciidoc, but I can untangle these to
> >> produce valid clojure, which I can then evaluate and test.
> >>
> >> To do this, however, I need to run an external process to generate the
> >> "source" -- i.e. the Clojure files which are not really source in this
> >> case, before I try to load them and test the functions in them. In
> >> Maven, I can do this with the exec plugin by attaching to the initialize
> >> phase.
> >>
> >> I thought to try leiningen hooks but as far as I can see this is only
> >> possible within a plugin; so I have tried this...
> >>
> >> (defproject take-wing "0.1.0-SNAPSHOT"
> >>   :dependencies [[org.clojure/clojure "1.6.0"]
> >>                  [uk.org.russet/tawny-owl "1.1.1-SNAPSHOT"]]
> >>
> >>   :hooks [take.build.gensource]
> >>   )
> >>
> >>
> >> where "take.build.gensource" is defined in the src directory of the
> >> project (most of the rest of this directory will be generated).
> >>
> >> Error: cannot resolve take.build.gensource/activate hook
> >> Error: cannot resolve take.build.gensource/activate hook
> >>
> >> The take/build/gensource.clj file exists and it has an "activate"
> >> function.
> >>
> >> I am guessing that this is failing because leiningen is not looking in
> >> the project source-path, only it's own classpath. I'm a bit reticient to
> >> write a leiningen plugin for this as a) it would be entirely specific to
> >> this project and b) it would make the build more complex (AFAIK I'd have
> >> to do a pre-build for the plugin, then another for the actual project)
> >> and c) is a pain for anyone else.
> >>
> >> So, should hooks work under these circumstances? Or must I go the plugin
> >> route?
> >>
> >> Phil
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> >> Groups "Clojure" group.
> >> To post to this group, send email to clojure@googlegroups.com
> >> Note that posts from new members are moderated - please be patient with
> >> your first post.
> >> To unsubscribe from this group, send email to
> >> clojure+unsubscr...@googlegroups.com
> >> For more options, visit this group at
> >> http://groups.google.com/group/clojure?hl=en
> >> ---
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Clojure" group.
> >> To unsubscribe from this group and stop receiving emails from it, send
> an
> >> email to clojure+unsubscr...@googlegroups.com.
> >> For more options, visit https://groups.google.com/d/optout.
> >>
>
> --
> Phillip Lord,                           Phone: +44 (0) 191 222 7827
> Lecturer in Bioinformatics,             Email:
> phillip.l...@newcastle.ac.uk
> School of Computing Science,
> http://homepages.cs.ncl.ac.uk/phillip.lord
> Room 914 Claremont Tower,               skype: russet_apples
> Newcastle University,                   twitter: phillord
> NE1 7RU
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to