status-react/env/dev/user.clj
Roman Volosovskyi 239a0cbfe6 split console bot into separate files
bots dir
slurp-bot macro
split commands.js into browse, mailman and wallet
bot-url & loading of default bots
command schema
command-parameter schema
global-command in default_commands
@browse command in all chats
load global command from jail
optimize applications startup

 Conflicts:
	bots/wallet/translations.js
	resources/console.js
	resources/dapp.js
	resources/default_contacts.json
	resources/status.js
	resources/wallet.js
	src/status_im/accounts/screen.cljs
	src/status_im/chat/constants.cljs
	src/status_im/chat/handlers.cljs
	src/status_im/chat/handlers/commands.cljs
	src/status_im/chat/handlers/send_message.cljs
	src/status_im/chat/subs.cljs
	src/status_im/chat/suggestions.cljs
	src/status_im/chat/views/command.cljs
	src/status_im/chat/views/suggestions.cljs
	src/status_im/commands/handlers/jail.cljs
	src/status_im/commands/handlers/loading.cljs
	src/status_im/contacts/handlers.cljs
	src/status_im/data_store/realm/schemas/account/core.cljs
	src/status_im/data_store/realm/schemas/account/v5/core.cljs
	src/status_im/models/commands.cljs
	src/status_im/utils/js_resources.cljs
2017-04-28 15:08:53 +03:00

78 lines
2.2 KiB
Clojure

(ns user
(:use [figwheel-sidecar.repl-api :as ra])
(:require [hawk.core :as hawk]
[re-frisk-sidecar.core :as rfs]
[clojure.string :as s]))
;; This namespace is loaded automatically by nREPL
;; read project.clj to get build configs
(def profiles (->> "project.clj"
slurp
read-string
(drop-while #(not= % :profiles))
(apply hash-map)
:profiles))
(defn get-test-build [build]
(update build :source-paths
(fn [paths] (let [paths-set (set paths)]
(-> paths-set
(disj "env/dev")
(conj "env/test" "test/cljs")
vec)))))
(def cljs-builds
(get-in profiles [:dev :cljsbuild :builds]))
(def buids-by-id
(into {} (map (fn [{:keys [id] :as build}] [id build]) cljs-builds)))
(defn start-figwheel
"Start figwheel for one or more builds"
[build-ids cljs-builds]
(ra/start-figwheel!
{:figwheel-options {:nrepl-port 7888}
:build-ids build-ids
:all-builds cljs-builds}))
(def start-cljs-repl ra/cljs-repl)
(defn stop-figwheel
"Stops figwheel"
[]
(ra/stop-figwheel!))
(hawk/watch! [{:paths ["resources" "bots"]
:handler (fn [ctx e]
(let [path "src/status_im/utils/js_resources.cljs"
js-resourced (slurp path)]
(spit path (str js-resourced " ;;"))
(spit path js-resourced))
ctx)}])
(defn test-id? [id]
(s/includes? (name id) "-test"))
(defn get-id [id]
(-> id
name
(s/replace #"-test" "")
keyword))
(defn get-builds [ids all-builds]
(keep
(fn [id]
(let [build (get all-builds (get-id id))]
(if (test-id? id)
(get-test-build build)
build)))
ids))
(let [env-build-ids (System/getenv "BUILD_IDS")
build-ids (if env-build-ids
(map keyword (s/split env-build-ids #","))
[:android])
builds (get-builds build-ids buids-by-id)]
(start-figwheel build-ids builds)
(rfs/-main))