mirror of
https://github.com/penpot/penpot.git
synced 2025-05-11 21:46:38 +02:00
feat: improve backend devlopment namespaces
This commit is contained in:
parent
7adc4e3d01
commit
66fc0e68a4
5 changed files with 65 additions and 50 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -14,6 +14,7 @@ node_modules
|
||||||
/backend/resources/media
|
/backend/resources/media
|
||||||
/backend/dist/
|
/backend/dist/
|
||||||
/backend/-
|
/backend/-
|
||||||
|
/backend/.rebel_readline_history
|
||||||
/frontend/.cpcache
|
/frontend/.cpcache
|
||||||
/frontend/npm-debug.log
|
/frontend/npm-debug.log
|
||||||
/frontend/target/
|
/frontend/target/
|
||||||
|
|
|
@ -34,7 +34,11 @@
|
||||||
{:dev
|
{:dev
|
||||||
{:extra-deps {com.bhauman/rebel-readline {:mvn/version "0.1.4"}
|
{:extra-deps {com.bhauman/rebel-readline {:mvn/version "0.1.4"}
|
||||||
org.clojure/tools.namespace {:mvn/version "0.2.11"}
|
org.clojure/tools.namespace {:mvn/version "0.2.11"}
|
||||||
|
clj-http/clj-http {:mvn/version "2.1.0"}
|
||||||
}
|
}
|
||||||
:extra-paths ["test"]}
|
:extra-paths ["test"]}
|
||||||
|
:repl {:main-opts ["-m" "rebel-readline.main"]}
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
56
backend/src/user.clj
Normal file
56
backend/src/user.clj
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
;; This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
;;
|
||||||
|
;; Copyright (c) 2016-2019 Andrey Antukh <niwi@niwi.nz>
|
||||||
|
|
||||||
|
(ns user
|
||||||
|
(:refer-clojure :exclude [test])
|
||||||
|
(:require [clojure.tools.namespace.repl :as repl]
|
||||||
|
[clojure.walk :refer [macroexpand-all]]
|
||||||
|
[clojure.pprint :refer [pprint]]
|
||||||
|
[clojure.test :as test]
|
||||||
|
[clojure.java.io :as io]
|
||||||
|
[buddy.core.codecs :as codecs]
|
||||||
|
[buddy.core.codecs.base64 :as b64]
|
||||||
|
[buddy.core.nonce :as nonce]
|
||||||
|
[mount.core :as mount]
|
||||||
|
[uxbox.main])
|
||||||
|
(:gen-class))
|
||||||
|
|
||||||
|
;; --- Development Stuff
|
||||||
|
|
||||||
|
(defn- make-secret
|
||||||
|
[]
|
||||||
|
(-> (nonce/random-bytes 64)
|
||||||
|
(b64/encode true)
|
||||||
|
(codecs/bytes->str)))
|
||||||
|
|
||||||
|
(defn- start
|
||||||
|
[]
|
||||||
|
(mount/start))
|
||||||
|
|
||||||
|
(defn- stop
|
||||||
|
[]
|
||||||
|
(mount/stop))
|
||||||
|
|
||||||
|
(defn- start-minimal
|
||||||
|
[]
|
||||||
|
(-> (mount/only #{#'uxbox.config/config
|
||||||
|
#'uxbox.db/datasource
|
||||||
|
#'uxbox.migrations/migrations})
|
||||||
|
(mount/start)))
|
||||||
|
|
||||||
|
(defn- test
|
||||||
|
([] (test #"^uxbox.tests.*"))
|
||||||
|
([o]
|
||||||
|
(repl/refresh)
|
||||||
|
(cond
|
||||||
|
(instance? java.util.regex.Pattern o)
|
||||||
|
(test/run-all-tests o)
|
||||||
|
|
||||||
|
(symbol? o)
|
||||||
|
(if-let [sns (namespace o)]
|
||||||
|
(do (require (symbol sns))
|
||||||
|
(test/test-vars [(resolve o)]))
|
||||||
|
(test/test-ns o)))))
|
|
@ -2,19 +2,10 @@
|
||||||
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
;;
|
;;
|
||||||
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
|
;; Copyright (c) 2016-2019 Andrey Antukh <niwi@niwi.nz>
|
||||||
|
|
||||||
(ns uxbox.main
|
(ns uxbox.main
|
||||||
(:refer-clojure :exclude [test])
|
(:require [mount.core :as mount]
|
||||||
(:require [clojure.tools.namespace.repl :as repl]
|
|
||||||
[clojure.walk :refer [macroexpand-all]]
|
|
||||||
[clojure.pprint :refer [pprint]]
|
|
||||||
[clojure.test :as test]
|
|
||||||
[clojure.java.io :as io]
|
|
||||||
[mount.core :as mount]
|
|
||||||
[buddy.core.codecs :as codecs]
|
|
||||||
[buddy.core.codecs.base64 :as b64]
|
|
||||||
[buddy.core.nonce :as nonce]
|
|
||||||
[uxbox.config :as cfg]
|
[uxbox.config :as cfg]
|
||||||
[uxbox.migrations]
|
[uxbox.migrations]
|
||||||
[uxbox.db]
|
[uxbox.db]
|
||||||
|
@ -22,43 +13,6 @@
|
||||||
[uxbox.scheduled-jobs])
|
[uxbox.scheduled-jobs])
|
||||||
(:gen-class))
|
(:gen-class))
|
||||||
|
|
||||||
;; --- Development Stuff
|
|
||||||
|
|
||||||
(defn- start
|
|
||||||
[]
|
|
||||||
(mount/start))
|
|
||||||
|
|
||||||
(defn- stop
|
|
||||||
[]
|
|
||||||
(mount/stop))
|
|
||||||
|
|
||||||
(defn- start-minimal
|
|
||||||
[]
|
|
||||||
(-> (mount/only #{#'uxbox.config/config
|
|
||||||
#'uxbox.db/datasource
|
|
||||||
#'uxbox.migrations/migrations})
|
|
||||||
(mount/start)))
|
|
||||||
|
|
||||||
(defn- make-secret
|
|
||||||
[]
|
|
||||||
(-> (nonce/random-bytes 64)
|
|
||||||
(b64/encode true)
|
|
||||||
(codecs/bytes->str)))
|
|
||||||
|
|
||||||
(defn- test
|
|
||||||
([] (test #"^uxbox.tests.*"))
|
|
||||||
([o]
|
|
||||||
(repl/refresh)
|
|
||||||
(cond
|
|
||||||
(instance? java.util.regex.Pattern o)
|
|
||||||
(test/run-all-tests o)
|
|
||||||
|
|
||||||
(symbol? o)
|
|
||||||
(if-let [sns (namespace o)]
|
|
||||||
(do (require (symbol sns))
|
|
||||||
(test/test-vars [(resolve o)]))
|
|
||||||
(test/test-ns o)))))
|
|
||||||
|
|
||||||
;; --- Entry point (only for uberjar)
|
;; --- Entry point (only for uberjar)
|
||||||
|
|
||||||
(defn -main
|
(defn -main
|
||||||
|
|
|
@ -10,8 +10,8 @@ tmux send-keys -t uxbox 'npm run start' enter
|
||||||
tmux new-window -t uxbox:2 -n 'backend'
|
tmux new-window -t uxbox:2 -n 'backend'
|
||||||
tmux select-window -t uxbox:2
|
tmux select-window -t uxbox:2
|
||||||
tmux send-keys -t uxbox 'cd uxbox/backend' enter C-l
|
tmux send-keys -t uxbox 'cd uxbox/backend' enter C-l
|
||||||
tmux send-keys -t uxbox 'bash ./scripts/fixtures.sh' enter C-l
|
tmux send-keys -t uxbox 'clojure -Adev -m uxbox.fixtures' enter C-l
|
||||||
tmux send-keys -t uxbox 'bash ./scripts/run.sh' enter
|
tmux send-keys -t uxbox 'clojure -Adev:repl' enter
|
||||||
|
|
||||||
tmux new-window -t uxbox:3 -n 'services'
|
tmux new-window -t uxbox:3 -n 'services'
|
||||||
tmux select-window -t uxbox:3
|
tmux select-window -t uxbox:3
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue