'lein run -m <namespace>' will run the "main-" function of a namespace, which otherwise won't be run unless deliberately invoked (like all functions). Is that what you're looking for?
(See https://github.com/technomancy/leiningen#basic-usage). On 26 February 2014 09:57, Aaron France <[email protected]> wrote: > > Hi, > > > You can implement https://github.com/clojure-cookbook/my-daemon for > your application. I've had great success with this. > > Aaron > > On Wed, Feb 26, 2014 at 01:50:43AM -0800, macdevign mac wrote: >> Hi, >> is there a function to determine if the clojure code is running as library >> or as script ? >> >> In ruby, there is >> >> if __FILE__==$0 >> # this will only run if the script was the main, not load'd or require'd >> end >> >> In Java, we could include main method in class, and choose to run it, >> >> How about clojure ? >> >> Is there any function/macro like the following ? >> >> (run-main >> (code ......)) >> >> so that it can be run standalone, or it can be ignored running as >> library. I find this useful for quick experimenting. >> >> thank >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to [email protected] >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> [email protected] >> 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 [email protected]. >> For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] 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 [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
