Skip to content

Commit

Permalink
add docs for control functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruce Hauman committed Jan 18, 2015
1 parent 847b0c2 commit bc3aff1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
9 changes: 0 additions & 9 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@

* figure out best way to do rlwrap

* eval-clj special-fn

* load-clj special-fn

* add-classpath special-fn

* clean-cljs special-fn


* remove cljsbuild dependency for good

* look at cljs.test plugin for client
Expand Down
3 changes: 1 addition & 2 deletions plugin/src/leiningen/figwheel.clj
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
;; need to get rid of crossovers soon

(defn run-compiler [project {:keys [crossover-path crossovers builds]} figwheel-options]
(println "Compiling ClojureScript.")
; If crossover-path does not exist before eval-in-project is called,
; the files it contains won't be classloadable, for some reason.
(when (not-empty crossovers)
Expand All @@ -71,7 +70,7 @@ See https://github.com/emezeske/lein-cljsbuild/blob/master/doc/CROSSOVERS.md for
(do
(figwheel-sidecar.auto-builder/autobuild*
{ :builds '~parsed-builds
:figwheel-server (figwheel-sidecar.core/start-server ~figwheel-options)})
:figwheel-server (figwheel-sidecar.core/start-server ~figwheel-options)})
;; block because call is non blocking core async
(loop []
(Thread/sleep 30000)
Expand Down
19 changes: 16 additions & 3 deletions sidecar/src/figwheel_sidecar/auto_builder.clj
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@
(binding [*out* log-writer
*err* log-writer]
(build-once*)
(reset! autobuilder-atom (autobuild* {:builds builds
:figwheel-server figwheel-server }))))
(reset! autobuilder-atom
(autobuild* {:builds builds
:figwheel-server figwheel-server }))))
stop-autobuild* #(if @autobuilder-atom
(do
(auto/stop-autobuild! @autobuilder-atom)
Expand All @@ -104,16 +105,28 @@
'build-once build-once*
'clean-build clean-build*}))

(defn repl-function-docs []
"Figwheel Controls:
(stop-autobuild) ;; stops Figwheel autobuilder
(start-autobuild) ;; starts Figwheel autobuilder
(reset-autobuild) ;; stops, cleans, and starts autobuilder
(build-once) ;; builds source once time
(clean-build) ;; deletes compiled cljs target files
Docs: (doc function-name-here)
Exit: Control+C or :cljs/quit
Results: Stored in vars *1, *2, *3, an exception in *e")

(defn autobuild-repl [{:keys [builds figwheel-server] :as opts}]
(let [builds' (mapv auto/prep-build builds)
control-fns (setup-control-fns builds' figwheel-server)
special-fns (into {} (map (fn [[k v]] [k (wrap-special-no-args v)]) control-fns))]

((get control-fns 'start-autobuild))

(newline)
(if (:id (first builds'))
(println "Launching ClojureScript REPL for build:" (:id (first builds')))
(println "Launching ClojureScript REPL"))
(println (repl-function-docs))
(println "Prompt will show when figwheel connects to your application")
(fig-repl/repl (first builds') figwheel-server {:special-fns special-fns})))

Expand Down

0 comments on commit bc3aff1

Please sign in to comment.