Skip to content

Navigation Menu

Sign up
trptcolin edited this page Apr 25, 2013 · 4 revisions

If you'd like to use REPLy from your app, great!

This page will walk you through an example of setting it up. I'm sure you already have a project ready if you're on this page, but if not, lein new foo && cd foo will get you one created.

In project.clj, get yourself a REPLy dependency and a :main namespace:

(defproject foo "0.1.0-SNAPSHOT"
 :description "FIXME: write description"
 :url "http://example.com/FIXME"
 :license {:name "Eclipse Public License"
 :url "http://www.eclipse.org/legal/epl-v10.html"}
 :dependencies [[org.clojure/clojure "1.5.1"]
 [reply "0.2.0-SNAPSHOT"]]
 :main foo.core)

Then, in src/foo/core.clj, add this to your :main function. There's a little song and dance here to avoid transitively AOT'ing the world, but such is life.

(ns foo.core
 (:gen-class))
(defn -main [& args]
 (require 'reply.main)
 ((ns-resolve 'reply.main 'launch)
 {:custom-eval '(do (println "Welcome to this awesome app"))
 :port 9999}))

The :custom-eval and :port bits aren't necessary (though having a map in that function slot is required): they're just examples of configurations you might want to do.

Clone this wiki locally

AltStyle によって変換されたページ (->オリジナル) /