Skip to content
Permalink
Browse files

Merge branch 'feature/modern-lein'

  • Loading branch information
emil0r committed Dec 2, 2019
2 parents d42276d + ee462d7 commit 288fd1aff1e78a97d51026c662c73ef870e79c39
Showing with 493 additions and 1,068 deletions.
  1. +0 −2 .gitignore
  2. +234 −171 LICENSE
  3. +14 −12 README.md
  4. +8 −4 project.clj
  5. +11 −0 resources/leiningen/new/reverie/core/README.adoc
  6. +4 −3 {src/leiningen/new/reverie → resources/leiningen/new/reverie/core}/gitignore
  7. +32 −0 resources/leiningen/new/reverie/core/project.clj
  8. +29 −0 resources/leiningen/new/reverie/core/settings.edn
  9. +28 −0 resources/leiningen/new/reverie/dev/dev.clj
  10. +12 −0 resources/leiningen/new/reverie/docker/docker-compose.yml
  11. +10 −0 resources/leiningen/new/reverie/src/core.clj
  12. +11 −0 resources/leiningen/new/reverie/src/init.clj
  13. +51 −0 resources/leiningen/new/reverie/src/templates/common.clj
  14. +14 −0 resources/leiningen/new/reverie/src/templates/start.clj
  15. +35 −104 src/leiningen/new/reverie.clj
  16. +0 −214 src/leiningen/new/reverie/LICENSE
  17. +0 −14 src/leiningen/new/reverie/README.md
  18. +0 −3 src/leiningen/new/reverie/doc/intro.md
  19. +0 −19 src/leiningen/new/reverie/project.clj
  20. +0 −45 src/leiningen/new/reverie/settings.edn
  21. +0 −15 src/leiningen/new/reverie/src/example/apps/myapp.clj
  22. +0 −112 src/leiningen/new/reverie/src/example/command.clj
  23. +0 −11 src/leiningen/new/reverie/src/example/core.clj
  24. +0 −41 src/leiningen/new/reverie/src/example/dev.clj
  25. +0 −10 src/leiningen/new/reverie/src/example/endpoints/api.clj
  26. +0 −149 src/leiningen/new/reverie/src/example/init.clj
  27. +0 −1 src/leiningen/new/reverie/src/example/objects/migrations/raw/0001-raw.down.sql
  28. +0 −5 src/leiningen/new/reverie/src/example/objects/migrations/raw/0001-raw.up.sql
  29. +0 −1 src/leiningen/new/reverie/src/example/objects/migrations/text/0001-text.down.sql
  30. +0 −6 src/leiningen/new/reverie/src/example/objects/migrations/text/0001-text.up.sql
  31. +0 −16 src/leiningen/new/reverie/src/example/objects/raw.clj
  32. +0 −33 src/leiningen/new/reverie/src/example/objects/text.clj
  33. +0 −51 src/leiningen/new/reverie/src/example/templates/common.clj
  34. +0 −19 src/leiningen/new/reverie/src/example/templates/main.clj
  35. +0 −7 src/leiningen/new/reverie/test/test/core_test.clj
@@ -7,5 +7,3 @@ pom.xml.asc
*.class
/.lein-*
/.nrepl-port
/src/leiningen/new/test*
.emacs*
405 LICENSE

Large diffs are not rendered by default.

@@ -1,20 +1,22 @@
# reverie-template
# reverie

A Leiningen template for [reverie](https://github.com/emil0r/reverie).
A Leiningen template for FIXME.

## Usage

lein new reverie newsite

From clojars:

```clojure
[reverie/lein-template "1.1-alpha1"]
```
FIXME

## License

Copyright © 2013-2015 Emil Bengtsson
Copyright © 2019 FIXME

This program and the accompanying materials are made available under the
terms of the Eclipse Public License 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0.

Distributed under the Eclipse Public License either version 1.0 or (at
your option) any later version.
This Source Code may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the Eclipse
Public License, v. 2.0 are satisfied: GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or (at your
option) any later version, with the GNU Classpath Exception which is available
at https://www.gnu.org/software/classpath/license.html.
@@ -1,6 +1,10 @@
(defproject reverie/lein-template "1.2.0"
(defproject reverie/lein-template "2.0.0"

:description "Template for setting up a reverie installation"
:url "http://reveriecms.org"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}

:url "https://github.com/emil0r/reverie-template"

:license {:name "EPL-2.0"
:url "https://www.eclipse.org/legal/epl-2.0/"}

:eval-in-leiningen true)
@@ -0,0 +1,11 @@
= {{name}}

A website for...

== Usage

FIXME

== License

Copyright © {{year}} FIXME
@@ -1,10 +1,11 @@
/target
/lib
/classes
/checkouts
pom.xml
pom.xml.asc
*.jar
*.class
/.lein-*
/.nrepl-port
settings.edn
.lein-*
.nrepl*
media
@@ -0,0 +1,32 @@
(defproject {{name}} "0.1.0-SNAPSHOT"
:description "FIXME: write description"

:url "http://example.com/FIXME"

:dependencies [[org.clojure/clojure "1.10.1"]

;; reverie
[reverie-core "0.9.0-alpha7"]
[reverie-sql "0.9.0-alpha7"]

;; web server
[http-kit "2.3.0"]

;; batteries
[ez-form "0.7.3"]
{{& deps-batteries}}

;; database
[org.postgresql/postgresql "42.2.8"]
[hikari-cp "2.9.0"]
[ez-database "0.7.0-alpha2"]]

:main {{name}}.core

:min-lein-version "2.0.0"

:uberjar-name "{{name}}.jar"

:profiles {:uberjar {:aot [{{name}}.core]}
:dev {:dependencies [[reverie-dev "0.3.0"]]}})

@@ -0,0 +1,29 @@
{
;; reverie

:server {:mode :dev}

:http {:server {:options {:port 3000}
:middleware {}}}

:database {:specs {:default {:classname "org.postgresql.Driver"
:subprotocol "postgresql"
:subname "//localhost:5432/{{db-name}}"
:user "{{db-username}}"
:password "{{db-password}}"}}
:ds-specs {:default {:maximum-pool-size 3
:adapter "postgresql"
:port-number 5432
:database-name "{{db-name}}"
:username "{{db-username}}"
:password "{{db-password}}"}}}

:admin {:tasks {:edits {:minutes 30}}}

:log {:appenders {:rotor {:path "logs/{{name}}.log"}}}

:site {:host-names []}

:filemanager {:base-directory "media"
:media-dirs ["media/images"
"media/files"]}}
@@ -0,0 +1,28 @@
(ns dev
(:require [{{name}}.init :refer [start-server opts]]
[reverie.dev.migration :as migration]
[reverie.dev.app :as app]
[reverie.dev.module :as module]
[reverie.dev.object :as object]
[reverie.dev.page :as page]
[reverie.server :as server]))

(comment

;; run this for running the server in dev mode through the REPL
(do
(server/stop)
(start-server opts))


;; copy/paste and change the commented out migration to suit your needs
;; run in the REPL as necessary during development

(object/create {:override? true} 'myobject)
(migration/migrate :object 'myobject)
(migration/rollback :object 'myobject)
(object/add-migration 'myobject "foobar")
(object/remove-migration 'myobject "foobar")

)

@@ -0,0 +1,12 @@
version: '3'
services:
postgres:
image: postgres
volumes:
- .docker/postgresql:/var/lib/postgresql/data
ports:
- '5432:5432'
environment:
- POSTGRES_DB={{db-name}}
- POSTGRES_USER={{db-username}}
- POSTGRES_PASSWORD={{db-password}}
@@ -0,0 +1,10 @@
(ns {{name}}.core
(:gen-class)
(:require [{{name}}.init :refer [start-server opts]]
[reverie.command :as command]))

(defn -main [& args]
;; run commands first. if a command is sent in the system exits after the command has run
(command/run-command opts args)
;; if we manage to continue, we start the server
(start-server))
@@ -0,0 +1,11 @@
(ns {{name}}.init
(:require [reverie.server :as server]))

(def opts {:reverie.settings/path "settings.edn"
:reverie.system/load-namespaces ['{{name}}.templates
'{{name}}.objects
'{{name}}.apps
'{{name}}.endpoints]})

(defn start-server [opts]
(server/start opts []))
@@ -0,0 +1,51 @@
(ns {{name}}.templates.common
(:require [clojure.string :as str]
[hiccup.core :refer [html]]
[hiccup.page :refer [html5]]
[reverie.page :as page]
[reverie.settings :as settings]))

(defn head [{:keys [page] :as context}]
(let [title (->> [(page/title page)
(page/name page)]
(remove str/blank?))]
(list
[:meta {:charset "utf-8"}]
[:title title])))

(defn scripts [{:keys [dev?]}]
(let [js-scripts (if dev?
[]
[])]
(map (fn [src]
[:script {:src src} :type "text/javascript"])
js-scripts)))

(defn menu [contenxt]
[:div
"my menu here"])

(defn footer [context]
[:div "my footer here"])


(defn base [{:keys [request content] :as context}]
(let [{:keys [settings]} (get request :reverie)
context (assoc context
:dev? (settings/dev? settings))
;; render the content up here to force any lazyness to be
;; executed. this is in order for downstream to work properly
;; if you need to use it
rendered-content (html content)]
(html5
[:head
(head context)
(scripts context)]
[:body
(menu context)
[:div.container
[:div.content
rendered-content]]
(footer context)])))


@@ -0,0 +1,14 @@
(ns {{name}}.templates.start
(:require [{{name}}.templates.common :refer [base]]
[reverie.core :refer [deftemplate area]]))


(defn template-start [request page properites params]
(base {:request request
:page page
:content [:div.start
(area start)]}))

(deftemplate start template-start)


0 comments on commit 288fd1a

Please sign in to comment.
You can’t perform that action at this time.