├── env ├── prod │ ├── resources │ │ ├── config.edn │ │ └── logback.xml │ └── clj │ │ └── cci_demo_clojure │ │ └── env.clj ├── dev │ ├── resources │ │ ├── config.edn │ │ └── logback.xml │ └── clj │ │ ├── cci_demo_clojure │ │ ├── dev_middleware.clj │ │ └── env.clj │ │ └── user.clj └── test │ └── resources │ ├── config.edn │ └── logback.xml ├── Procfile ├── resources ├── public │ ├── favicon.ico │ ├── img │ │ └── warning_clojure.png │ └── css │ │ └── screen.css ├── templates │ ├── about.html │ ├── home.html │ ├── error.html │ └── base.html └── docs │ └── docs.md ├── .gitignore ├── Dockerfile ├── src └── clj │ └── cci_demo_clojure │ ├── config.clj │ ├── routes │ └── home.clj │ ├── handler.clj │ ├── layout.clj │ ├── core.clj │ └── middleware.clj ├── test └── clj │ └── cci_demo_clojure │ └── test │ └── handler.clj ├── README.md ├── .circleci └── config.yml ├── Capstanfile ├── project.clj └── COPYING /env/prod/resources/config.edn: -------------------------------------------------------------------------------- 1 | {:production true 2 | :port 3000} 3 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: java $JVM_OPTS -cp target/uberjar/cci-demo-clojure.jar clojure.main -m cci-demo-clojure.core 2 | -------------------------------------------------------------------------------- /resources/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/circleci-demo-clojure-luminus/master/resources/public/favicon.ico -------------------------------------------------------------------------------- /env/dev/resources/config.edn: -------------------------------------------------------------------------------- 1 | {:dev true 2 | :port 3000 3 | ;; when :nrepl-port is set the application starts the nREPL server on load 4 | :nrepl-port 7000} 5 | -------------------------------------------------------------------------------- /env/test/resources/config.edn: -------------------------------------------------------------------------------- 1 | {:dev true 2 | :port 3000 3 | ;; when :nrepl-port is set the application starts the nREPL server on load 4 | :nrepl-port 7000} 5 | -------------------------------------------------------------------------------- /resources/public/img/warning_clojure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/circleci-demo-clojure-luminus/master/resources/public/img/warning_clojure.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /lib 3 | /classes 4 | /checkouts 5 | pom.xml 6 | *.jar 7 | *.class 8 | /.lein-* 9 | profiles.clj 10 | /.env 11 | .nrepl-port 12 | /log 13 | -------------------------------------------------------------------------------- /resources/templates/about.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% block content %} 3 | 4 | {% endblock %} 5 | -------------------------------------------------------------------------------- /resources/templates/home.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% block content %} 3 |
4 |
5 | {{docs|markdown}} 6 |
7 |
8 | {% endblock %} 9 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8 2 | MAINTAINER Your Name 3 | 4 | ADD target/uberjar/cci-demo-clojure.jar /cci-demo-clojure/app.jar 5 | 6 | EXPOSE 3000 7 | 8 | CMD ["java", "-jar", "/cci-demo-clojure/app.jar"] 9 | -------------------------------------------------------------------------------- /env/prod/clj/cci_demo_clojure/env.clj: -------------------------------------------------------------------------------- 1 | (ns cci-demo-clojure.env 2 | (:require [clojure.tools.logging :as log])) 3 | 4 | (def defaults 5 | {:init 6 | (fn [] 7 | (log/info "\n-=[cci-demo-clojure started successfully]=-")) 8 | :stop 9 | (fn [] 10 | (log/info "\n-=[cci-demo-clojure has shut down successfully]=-")) 11 | :middleware identity}) 12 | -------------------------------------------------------------------------------- /env/dev/clj/cci_demo_clojure/dev_middleware.clj: -------------------------------------------------------------------------------- 1 | (ns cci-demo-clojure.dev-middleware 2 | (:require [ring.middleware.reload :refer [wrap-reload]] 3 | [selmer.middleware :refer [wrap-error-page]] 4 | [prone.middleware :refer [wrap-exceptions]])) 5 | 6 | (defn wrap-dev [handler] 7 | (-> handler 8 | wrap-reload 9 | wrap-error-page 10 | wrap-exceptions)) 11 | -------------------------------------------------------------------------------- /src/clj/cci_demo_clojure/config.clj: -------------------------------------------------------------------------------- 1 | (ns cci-demo-clojure.config 2 | (:require [cprop.core :refer [load-config]] 3 | [cprop.source :as source] 4 | [mount.core :refer [args defstate]])) 5 | 6 | (defstate env :start (load-config 7 | :merge 8 | [(args) 9 | (source/from-system-props) 10 | (source/from-env)])) 11 | -------------------------------------------------------------------------------- /env/dev/clj/user.clj: -------------------------------------------------------------------------------- 1 | (ns user 2 | (:require [mount.core :as mount] 3 | cci-demo-clojure.core)) 4 | 5 | (defn start [] 6 | (mount/start-without #'cci-demo-clojure.core/http-server 7 | #'cci-demo-clojure.core/repl-server)) 8 | 9 | (defn stop [] 10 | (mount/stop-except #'cci-demo-clojure.core/http-server 11 | #'cci-demo-clojure.core/repl-server)) 12 | 13 | (defn restart [] 14 | (stop) 15 | (start)) 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/clj/cci_demo_clojure/test/handler.clj: -------------------------------------------------------------------------------- 1 | (ns cci-demo-clojure.test.handler 2 | (:require [clojure.test :refer :all] 3 | [ring.mock.request :refer :all] 4 | [cci-demo-clojure.handler :refer :all])) 5 | 6 | (deftest test-app 7 | (testing "main route" 8 | (let [response ((app) (request :get "/"))] 9 | (is (= 200 (:status response))))) 10 | 11 | (testing "not-found route" 12 | (let [response ((app) (request :get "/invalid"))] 13 | (is (= 404 (:status response)))))) 14 | -------------------------------------------------------------------------------- /env/dev/clj/cci_demo_clojure/env.clj: -------------------------------------------------------------------------------- 1 | (ns cci-demo-clojure.env 2 | (:require [selmer.parser :as parser] 3 | [clojure.tools.logging :as log] 4 | [cci-demo-clojure.dev-middleware :refer [wrap-dev]])) 5 | 6 | (def defaults 7 | {:init 8 | (fn [] 9 | (parser/cache-off!) 10 | (log/info "\n-=[cci-demo-clojure started successfully using the development profile]=-")) 11 | :stop 12 | (fn [] 13 | (log/info "\n-=[cci-demo-clojure has shut down successfully]=-")) 14 | :middleware wrap-dev}) 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CircleCI Demo Application: Clojure [![CircleCI](https://circleci.com/gh/circleci/cci-demo-clojure.svg?style=svg)](https://circleci.com/gh/circleci/cci-demo-clojure) 2 | 3 | This is an example application showcasing how to run a Clojure app on CircleCI 2.0. 4 | 5 | You can follow along with this project by reading the [documentation](https://circleci.com/docs/2.0/language-clojure/). 6 | 7 | ## License 8 | 9 | Copyright © 2017 CircleCI 10 | 11 | Distributed under the Eclipse Public License, the same as Clojure 12 | uses. See the file COPYING. 13 | 14 | -------------------------------------------------------------------------------- /src/clj/cci_demo_clojure/routes/home.clj: -------------------------------------------------------------------------------- 1 | (ns cci-demo-clojure.routes.home 2 | (:require [cci-demo-clojure.layout :as layout] 3 | [compojure.core :refer [defroutes GET]] 4 | [ring.util.http-response :as response] 5 | [clojure.java.io :as io])) 6 | 7 | (defn home-page [] 8 | (layout/render 9 | "home.html" {:docs (-> "docs/docs.md" io/resource slurp)})) 10 | 11 | (defn about-page [] 12 | (layout/render "about.html")) 13 | 14 | (defroutes home-routes 15 | (GET "/" [] (home-page)) 16 | (GET "/about" [] (about-page))) 17 | 18 | -------------------------------------------------------------------------------- /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2.1 2 | jobs: 3 | build: 4 | docker: 5 | - image: circleci/clojure:lein-2.9.1 6 | environment: 7 | LEIN_ROOT: nbd 8 | JVM_OPTS: -Xmx3200m 9 | steps: 10 | - checkout 11 | - restore_cache: 12 | key: cci-demo-clojure-{{ checksum "project.clj" }} 13 | - run: lein deps 14 | - save_cache: 15 | paths: 16 | - ~/.m2 17 | key: cci-demo-clojure-{{ checksum "project.clj" }} 18 | - run: lein do test, uberjar 19 | - store_artifacts: 20 | path: target/uberjar/cci-demo-clojure.jar 21 | destination: uberjar 22 | -------------------------------------------------------------------------------- /resources/public/css/screen.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; 4 | height: 100%; 5 | } 6 | .navbar { 7 | margin-bottom: 10px; 8 | border-radius: 0px; 9 | } 10 | .navbar-brand { 11 | float: none; 12 | } 13 | .navbar-nav .nav-item { 14 | float: none; 15 | } 16 | .navbar-divider, 17 | .navbar-nav .nav-item+.nav-item, 18 | .navbar-nav .nav-link + .nav-link { 19 | margin-left: 0; 20 | } 21 | @media (min-width: 34em) { 22 | .navbar-brand { 23 | float: left; 24 | } 25 | .navbar-nav .nav-item { 26 | float: left; 27 | } 28 | .navbar-divider, 29 | .navbar-nav .nav-item+.nav-item, 30 | .navbar-nav .nav-link + .nav-link { 31 | margin-left: 1rem; 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /Capstanfile: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Name of the base image. Capstan will download this automatically from 4 | # Cloudius S3 repository. 5 | # 6 | #base: cloudius/osv 7 | base: cloudius/osv-openjdk8 8 | 9 | # 10 | # The command line passed to OSv to start up the application. 11 | # 12 | cmdline: /java.so -jar /cci-demo-clojure/app.jar 13 | 14 | # 15 | # The command to use to build the application. 16 | # You can use any build tool/command (make/rake/lein/boot) - this runs locally on your machine 17 | # 18 | # For Leiningen, you can use: 19 | #build: lein uberjar 20 | # For Boot, you can use: 21 | #build: boot build 22 | 23 | # 24 | # List of files that are included in the generated image. 25 | # 26 | files: 27 | /cci-demo-clojure/app.jar: ./target/uberjar/cci-demo-clojure.jar 28 | 29 | -------------------------------------------------------------------------------- /src/clj/cci_demo_clojure/handler.clj: -------------------------------------------------------------------------------- 1 | (ns cci-demo-clojure.handler 2 | (:require [compojure.core :refer [routes wrap-routes]] 3 | [cci-demo-clojure.layout :refer [error-page]] 4 | [cci-demo-clojure.routes.home :refer [home-routes]] 5 | [compojure.route :as route] 6 | [cci-demo-clojure.env :refer [defaults]] 7 | [mount.core :as mount] 8 | [cci-demo-clojure.middleware :as middleware])) 9 | 10 | (mount/defstate init-app 11 | :start ((or (:init defaults) identity)) 12 | :stop ((or (:stop defaults) identity))) 13 | 14 | (def app-routes 15 | (routes 16 | (-> #'home-routes 17 | (wrap-routes middleware/wrap-csrf) 18 | (wrap-routes middleware/wrap-formats)) 19 | (route/not-found 20 | (:body 21 | (error-page {:status 404 22 | :title "page not found"}))))) 23 | 24 | 25 | (defn app [] (middleware/wrap-base #'app-routes)) 26 | -------------------------------------------------------------------------------- /env/prod/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | log/cci-demo-clojure.log 6 | 7 | log/cci-demo-clojure.%d{yyyy-MM-dd}.%i.log 8 | 9 | 100MB 10 | 11 | 12 | 30 13 | 14 | 15 | UTF-8 16 | %date{ISO8601} [%thread] %-5level %logger{36} - %msg %n 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/clj/cci_demo_clojure/layout.clj: -------------------------------------------------------------------------------- 1 | (ns cci-demo-clojure.layout 2 | (:require [selmer.parser :as parser] 3 | [selmer.filters :as filters] 4 | [markdown.core :refer [md-to-html-string]] 5 | [ring.util.http-response :refer [content-type ok]] 6 | [ring.util.anti-forgery :refer [anti-forgery-field]] 7 | [ring.middleware.anti-forgery :refer [*anti-forgery-token*]])) 8 | 9 | (declare ^:dynamic *app-context*) 10 | (parser/set-resource-path! (clojure.java.io/resource "templates")) 11 | (parser/add-tag! :csrf-field (fn [_ _] (anti-forgery-field))) 12 | (filters/add-filter! :markdown (fn [content] [:safe (md-to-html-string content)])) 13 | 14 | (defn render 15 | "renders the HTML template located relative to resources/templates" 16 | [template & [params]] 17 | (content-type 18 | (ok 19 | (parser/render-file 20 | template 21 | (assoc params 22 | :page template 23 | :csrf-token *anti-forgery-token* 24 | :servlet-context *app-context*))) 25 | "text/html; charset=utf-8")) 26 | 27 | (defn error-page 28 | "error-details should be a map containing the following keys: 29 | :status - error status 30 | :title - error title (optional) 31 | :message - detailed error message (optional) 32 | 33 | returns a response map with the error page as the body 34 | and the status specified by the status key" 35 | [error-details] 36 | {:status (:status error-details) 37 | :headers {"Content-Type" "text/html; charset=utf-8"} 38 | :body (parser/render-file "error.html" error-details)}) 39 | -------------------------------------------------------------------------------- /src/clj/cci_demo_clojure/core.clj: -------------------------------------------------------------------------------- 1 | (ns cci-demo-clojure.core 2 | (:require [cci-demo-clojure.handler :as handler] 3 | [luminus.repl-server :as repl] 4 | [luminus.http-server :as http] 5 | [cci-demo-clojure.config :refer [env]] 6 | [clojure.tools.cli :refer [parse-opts]] 7 | [clojure.tools.logging :as log] 8 | [mount.core :as mount]) 9 | (:gen-class)) 10 | 11 | (def cli-options 12 | [["-p" "--port PORT" "Port number" 13 | :parse-fn #(Integer/parseInt %)]]) 14 | 15 | (mount/defstate ^{:on-reload :noop} 16 | http-server 17 | :start 18 | (http/start 19 | (-> env 20 | (assoc :handler (handler/app)) 21 | (update :port #(or (-> env :options :port) %)))) 22 | :stop 23 | (http/stop http-server)) 24 | 25 | (mount/defstate ^{:on-reload :noop} 26 | repl-server 27 | :start 28 | (when-let [nrepl-port (env :nrepl-port)] 29 | (repl/start {:port nrepl-port})) 30 | :stop 31 | (when repl-server 32 | (repl/stop repl-server))) 33 | 34 | 35 | (defn stop-app [] 36 | (doseq [component (:stopped (mount/stop))] 37 | (log/info component "stopped")) 38 | (shutdown-agents)) 39 | 40 | (defn start-app [args] 41 | (doseq [component (-> args 42 | (parse-opts cli-options) 43 | mount/start-with-args 44 | :started)] 45 | (log/info component "started")) 46 | (.addShutdownHook (Runtime/getRuntime) (Thread. stop-app))) 47 | 48 | (defn -main [& args] 49 | (start-app args)) 50 | -------------------------------------------------------------------------------- /resources/templates/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Something bad happened 5 | 6 | 7 | {% style "/assets/bootstrap/css/bootstrap.min.css" %} 8 | {% style "/assets/bootstrap/css/bootstrap-theme.min.css" %} 9 | 35 | 36 | 37 |
38 |
39 |
40 |
41 |
42 |

Error: {{status}}

43 |
44 | {% if title %} 45 |

{{title}}

46 | {% endif %} 47 | {% if message %} 48 |

{{message}}

49 | {% endif %} 50 |
51 |
52 |
53 |
54 |
55 | 56 | 57 | -------------------------------------------------------------------------------- /env/dev/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | UTF-8 9 | %date{ISO8601} [%thread] %-5level %logger{36} - %msg %n 10 | 11 | 12 | 13 | log/cci-demo-clojure.log 14 | 15 | log/cci-demo-clojure.%d{yyyy-MM-dd}.%i.log 16 | 17 | 100MB 18 | 19 | 20 | 30 21 | 22 | 23 | UTF-8 24 | %date{ISO8601} [%thread] %-5level %logger{36} - %msg %n 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /env/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | UTF-8 9 | %date{ISO8601} [%thread] %-5level %logger{36} - %msg %n 10 | 11 | 12 | 13 | log/cci-demo-clojure.log 14 | 15 | log/cci-demo-clojure.%d{yyyy-MM-dd}.%i.log 16 | 17 | 100MB 18 | 19 | 20 | 30 21 | 22 | 23 | UTF-8 24 | %date{ISO8601} [%thread] %-5level %logger{36} - %msg %n 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /resources/templates/base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Welcome to cci-demo-clojure 7 | 8 | 9 | {% style "/assets/bootstrap/css/bootstrap.min.css" %} 10 | {% style "/assets/font-awesome/css/font-awesome.min.css" %} 11 | 12 | {% style "/css/screen.css" %} 13 | 14 | 15 | 16 | 41 | 42 |
43 | {% block content %} 44 | {% endblock %} 45 |
46 | 47 | 48 | {% script "/assets/jquery/jquery.min.js" %} 49 | {% script "/assets/tether/dist/js/tether.min.js" %} 50 | {% script "/assets/bootstrap/js/bootstrap.min.js" %} 51 | 52 | 55 | {% block page-scripts %} 56 | {% endblock %} 57 | 58 | 59 | -------------------------------------------------------------------------------- /project.clj: -------------------------------------------------------------------------------- 1 | (defproject cci-demo-clojure "0.1.0-SNAPSHOT" 2 | 3 | :description "FIXME: write description" 4 | :url "http://example.com/FIXME" 5 | 6 | :dependencies [[compojure "1.5.2"] 7 | [cprop "0.1.10"] 8 | [funcool/struct "1.0.0"] 9 | [luminus-immutant "0.2.3"] 10 | [luminus-nrepl "0.1.4"] 11 | [markdown-clj "0.9.98"] 12 | [metosin/ring-http-response "0.8.1"] 13 | [mount "0.1.11"] 14 | [org.clojure/clojure "1.8.0"] 15 | [org.clojure/tools.cli "0.3.5"] 16 | [org.clojure/tools.logging "0.3.1"] 17 | [org.webjars.bower/tether "1.4.0"] 18 | [org.webjars/bootstrap "4.0.0-alpha.5"] 19 | [org.webjars/font-awesome "4.7.0"] 20 | [org.webjars/jquery "3.1.1"] 21 | [org.webjars/webjars-locator-jboss-vfs "0.1.0"] 22 | [ring-middleware-format "0.7.2"] 23 | [ring-webjars "0.1.1"] 24 | [ring/ring-core "1.6.0-RC1"] 25 | [ring/ring-defaults "0.2.3"] 26 | [selmer "1.10.6"]] 27 | 28 | :min-lein-version "2.0.0" 29 | 30 | :jvm-opts ["-server" "-Dconf=.lein-env"] 31 | :source-paths ["src/clj"] 32 | :test-paths ["test/clj"] 33 | :resource-paths ["resources"] 34 | :target-path "target/%s/" 35 | :main ^:skip-aot cci-demo-clojure.core 36 | 37 | :plugins [[lein-cprop "1.0.1"] 38 | [lein-immutant "2.1.0"]] 39 | 40 | :profiles 41 | {:uberjar {:omit-source true 42 | :aot :all 43 | :uberjar-name "cci-demo-clojure.jar" 44 | :source-paths ["env/prod/clj"] 45 | :resource-paths ["env/prod/resources"]} 46 | 47 | :dev [:project/dev :profiles/dev] 48 | :test [:project/dev :project/test :profiles/test] 49 | 50 | :project/dev {:dependencies [[prone "1.1.4"] 51 | [ring/ring-mock "0.3.0"] 52 | [ring/ring-devel "1.5.1"] 53 | [pjstadig/humane-test-output "0.8.1"]] 54 | :plugins [[com.jakemccrary/lein-test-refresh "0.18.1"]] 55 | :source-paths ["env/dev/clj"] 56 | :resource-paths ["env/dev/resources"] 57 | :repl-options {:init-ns user} 58 | :injections [(require 'pjstadig.humane-test-output) 59 | (pjstadig.humane-test-output/activate!)]} 60 | :project/test {:resource-paths ["env/test/resources"]} 61 | :profiles/dev {} 62 | :profiles/test {}}) 63 | -------------------------------------------------------------------------------- /src/clj/cci_demo_clojure/middleware.clj: -------------------------------------------------------------------------------- 1 | (ns cci-demo-clojure.middleware 2 | (:require [cci-demo-clojure.env :refer [defaults]] 3 | [clojure.tools.logging :as log] 4 | [cci-demo-clojure.layout :refer [*app-context* error-page]] 5 | [ring.middleware.anti-forgery :refer [wrap-anti-forgery]] 6 | [ring.middleware.webjars :refer [wrap-webjars]] 7 | [ring.middleware.format :refer [wrap-restful-format]] 8 | [cci-demo-clojure.config :refer [env]] 9 | [ring.middleware.flash :refer [wrap-flash]] 10 | [immutant.web.middleware :refer [wrap-session]] 11 | [ring.middleware.defaults :refer [site-defaults wrap-defaults]]) 12 | (:import [javax.servlet ServletContext])) 13 | 14 | (defn wrap-context [handler] 15 | (fn [request] 16 | (binding [*app-context* 17 | (if-let [context (:servlet-context request)] 18 | ;; If we're not inside a servlet environment 19 | ;; (for example when using mock requests), then 20 | ;; .getContextPath might not exist 21 | (try (.getContextPath ^ServletContext context) 22 | (catch IllegalArgumentException _ context)) 23 | ;; if the context is not specified in the request 24 | ;; we check if one has been specified in the environment 25 | ;; instead 26 | (:app-context env))] 27 | (handler request)))) 28 | 29 | (defn wrap-internal-error [handler] 30 | (fn [req] 31 | (try 32 | (handler req) 33 | (catch Throwable t 34 | (log/error t) 35 | (error-page {:status 500 36 | :title "Something very bad has happened!" 37 | :message "We've dispatched a team of highly trained gnomes to take care of the problem."}))))) 38 | 39 | (defn wrap-csrf [handler] 40 | (wrap-anti-forgery 41 | handler 42 | {:error-response 43 | (error-page 44 | {:status 403 45 | :title "Invalid anti-forgery token"})})) 46 | 47 | (defn wrap-formats [handler] 48 | (let [wrapped (wrap-restful-format 49 | handler 50 | {:formats [:json-kw :transit-json :transit-msgpack]})] 51 | (fn [request] 52 | ;; disable wrap-formats for websockets 53 | ;; since they're not compatible with this middleware 54 | ((if (:websocket? request) handler wrapped) request)))) 55 | 56 | (defn wrap-base [handler] 57 | (-> ((:middleware defaults) handler) 58 | wrap-webjars 59 | wrap-flash 60 | (wrap-session {:cookie-attrs {:http-only true}}) 61 | (wrap-defaults 62 | (-> site-defaults 63 | (assoc-in [:security :anti-forgery] false) 64 | (dissoc :session))) 65 | wrap-context 66 | wrap-internal-error)) 67 | -------------------------------------------------------------------------------- /resources/docs/docs.md: -------------------------------------------------------------------------------- 1 |

Congratulations, your Luminus site is ready!

2 | 3 | This page will help guide you through the first steps of building your site. 4 | 5 | #### Why are you seeing this page? 6 | 7 | The `home-routes` handler in the `cci-demo-clojure.routes.home` namespace 8 | defines the route that invokes the `home-page` function whenever an HTTP 9 | request is made to the `/` URI using the `GET` method. 10 | 11 | ``` 12 | (defroutes home-routes 13 | (GET "/" [] (home-page)) 14 | (GET "/about" [] (about-page))) 15 | ``` 16 | 17 | The `home-page` function will in turn call the `cci-demo-clojure.layout/render` function 18 | to render the HTML content: 19 | 20 | ``` 21 | (defn home-page [] 22 | (layout/render 23 | "home.html" {:docs (-> "docs/docs.md" io/resource slurp)})) 24 | ``` 25 | 26 | The `render` function will render the `home.html` template found in the `resources/templates` 27 | folder using a parameter map containing the `:docs` key. This key points to the 28 | contents of the `resources/docs/docs.md` file containing these instructions. 29 | 30 | 31 | The HTML templates are written using [Selmer](https://github.com/yogthos/Selmer) templating engine. 32 | 33 | 34 | ``` 35 |
36 |
37 | {{docs|markdown}} 38 |
39 |
40 | ``` 41 | 42 | learn more about HTML templating » 43 | 44 | 45 | 46 | #### Organizing the routes 47 | 48 | The routes are aggregated and wrapped with middleware in the `cci-demo-clojure.handler` namespace: 49 | 50 | ``` 51 | (def app-routes 52 | (routes 53 | (-> #'home-routes 54 | (wrap-routes middleware/wrap-csrf) 55 | (wrap-routes middleware/wrap-formats)) 56 | (route/not-found 57 | (:body 58 | (error-page {:status 404 59 | :title "page not found"}))))) 60 | ``` 61 | 62 | The `app-routes` definition groups all the routes in the application into a single handler. 63 | A default route group is added to handle the `404` case. 64 | 65 | learn more about routing » 66 | 67 | The `home-routes` are wrapped with two middleware functions. The first enables CSRF protection. 68 | The second takes care of serializing and deserializing various encoding formats, such as JSON. 69 | 70 | #### Managing your middleware 71 | 72 | Request middleware functions are located under the `cci-demo-clojure.middleware` namespace. 73 | 74 | This namespace is reserved for any custom middleware for the application. Some default middleware is 75 | already defined here. The middleware is assembled in the `wrap-base` function. 76 | 77 | Middleware used for development is placed in the `cci-demo-clojure.dev-middleware` namespace found in 78 | the `env/dev/clj/` source path. 79 | 80 | learn more about middleware » 81 | 82 | 83 | 84 | 85 | #### Need some help? 86 | 87 | Visit the [official documentation](http://www.luminusweb.net/docs) for examples 88 | on how to accomplish common tasks with Luminus. The `#luminus` channel on the [Clojurians Slack](http://clojurians.net/) and [Google Group](https://groups.google.com/forum/#!forum/luminusweb) are both great places to seek help and discuss projects with other users. 89 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Source code distributed under the Eclipse Public License - v 1.0: 2 | 3 | THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE 4 | PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF 5 | THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. 6 | 7 | 1. DEFINITIONS 8 | 9 | "Contribution" means: 10 | 11 | a) in the case of the initial Contributor, the initial code and 12 | documentation distributed under this Agreement, and 13 | 14 | b) in the case of each subsequent Contributor: 15 | 16 | i) changes to the Program, and 17 | 18 | ii) additions to the Program; 19 | 20 | where such changes and/or additions to the Program originate from and 21 | are distributed by that particular Contributor. A Contribution 22 | 'originates' from a Contributor if it was added to the Program by such 23 | Contributor itself or anyone acting on such Contributor's 24 | behalf. Contributions do not include additions to the Program which: 25 | (i) are separate modules of software distributed in conjunction with 26 | the Program under their own license agreement, and (ii) are not 27 | derivative works of the Program. 28 | 29 | "Contributor" means any person or entity that distributes the Program. 30 | 31 | "Licensed Patents" mean patent claims licensable by a Contributor 32 | which are necessarily infringed by the use or sale of its Contribution 33 | alone or when combined with the Program. 34 | 35 | "Program" means the Contributions distributed in accordance with this 36 | Agreement. 37 | 38 | "Recipient" means anyone who receives the Program under this 39 | Agreement, including all Contributors. 40 | 41 | 2. GRANT OF RIGHTS 42 | 43 | a) Subject to the terms of this Agreement, each Contributor hereby 44 | grants Recipient a non-exclusive, worldwide, royalty-free copyright 45 | license to reproduce, prepare derivative works of, publicly display, 46 | publicly perform, distribute and sublicense the Contribution of such 47 | Contributor, if any, and such derivative works, in source code and 48 | object code form. 49 | 50 | b) Subject to the terms of this Agreement, each Contributor hereby 51 | grants Recipient a non-exclusive, worldwide, royalty-free patent 52 | license under Licensed Patents to make, use, sell, offer to sell, 53 | import and otherwise transfer the Contribution of such Contributor, if 54 | any, in source code and object code form. This patent license shall 55 | apply to the combination of the Contribution and the Program if, at 56 | the time the Contribution is added by the Contributor, such addition 57 | of the Contribution causes such combination to be covered by the 58 | Licensed Patents. The patent license shall not apply to any other 59 | combinations which include the Contribution. No hardware per se is 60 | licensed hereunder. 61 | 62 | c) Recipient understands that although each Contributor grants the 63 | licenses to its Contributions set forth herein, no assurances are 64 | provided by any Contributor that the Program does not infringe the 65 | patent or other intellectual property rights of any other entity. Each 66 | Contributor disclaims any liability to Recipient for claims brought by 67 | any other entity based on infringement of intellectual property rights 68 | or otherwise. As a condition to exercising the rights and licenses 69 | granted hereunder, each Recipient hereby assumes sole responsibility 70 | to secure any other intellectual property rights needed, if any. For 71 | example, if a third party patent license is required to allow 72 | Recipient to distribute the Program, it is Recipient's responsibility 73 | to acquire that license before distributing the Program. 74 | 75 | d) Each Contributor represents that to its knowledge it has sufficient 76 | copyright rights in its Contribution, if any, to grant the copyright 77 | license set forth in this Agreement. 78 | 79 | 3. REQUIREMENTS 80 | 81 | A Contributor may choose to distribute the Program in object code form 82 | under its own license agreement, provided that: 83 | 84 | a) it complies with the terms and conditions of this Agreement; and 85 | 86 | b) its license agreement: 87 | 88 | i) effectively disclaims on behalf of all Contributors all warranties 89 | and conditions, express and implied, including warranties or 90 | conditions of title and non-infringement, and implied warranties or 91 | conditions of merchantability and fitness for a particular purpose; 92 | 93 | ii) effectively excludes on behalf of all Contributors all liability 94 | for damages, including direct, indirect, special, incidental and 95 | consequential damages, such as lost profits; 96 | 97 | iii) states that any provisions which differ from this Agreement are 98 | offered by that Contributor alone and not by any other party; and 99 | 100 | iv) states that source code for the Program is available from such 101 | Contributor, and informs licensees how to obtain it in a reasonable 102 | manner on or through a medium customarily used for software exchange. 103 | 104 | When the Program is made available in source code form: 105 | 106 | a) it must be made available under this Agreement; and 107 | 108 | b) a copy of this Agreement must be included with each copy of the Program. 109 | 110 | Contributors may not remove or alter any copyright notices contained 111 | within the Program. 112 | 113 | Each Contributor must identify itself as the originator of its 114 | Contribution, if any, in a manner that reasonably allows subsequent 115 | Recipients to identify the originator of the Contribution. 116 | 117 | 4. COMMERCIAL DISTRIBUTION 118 | 119 | Commercial distributors of software may accept certain 120 | responsibilities with respect to end users, business partners and the 121 | like. While this license is intended to facilitate the commercial use 122 | of the Program, the Contributor who includes the Program in a 123 | commercial product offering should do so in a manner which does not 124 | create potential liability for other Contributors. Therefore, if a 125 | Contributor includes the Program in a commercial product offering, 126 | such Contributor ("Commercial Contributor") hereby agrees to defend 127 | and indemnify every other Contributor ("Indemnified Contributor") 128 | against any losses, damages and costs (collectively "Losses") arising 129 | from claims, lawsuits and other legal actions brought by a third party 130 | against the Indemnified Contributor to the extent caused by the acts 131 | or omissions of such Commercial Contributor in connection with its 132 | distribution of the Program in a commercial product offering. The 133 | obligations in this section do not apply to any claims or Losses 134 | relating to any actual or alleged intellectual property 135 | infringement. In order to qualify, an Indemnified Contributor must: a) 136 | promptly notify the Commercial Contributor in writing of such claim, 137 | and b) allow the Commercial Contributor to control, and cooperate with 138 | the Commercial Contributor in, the defense and any related settlement 139 | negotiations. The Indemnified Contributor may participate in any such 140 | claim at its own expense. 141 | 142 | For example, a Contributor might include the Program in a commercial 143 | product offering, Product X. That Contributor is then a Commercial 144 | Contributor. If that Commercial Contributor then makes performance 145 | claims, or offers warranties related to Product X, those performance 146 | claims and warranties are such Commercial Contributor's responsibility 147 | alone. Under this section, the Commercial Contributor would have to 148 | defend claims against the other Contributors related to those 149 | performance claims and warranties, and if a court requires any other 150 | Contributor to pay any damages as a result, the Commercial Contributor 151 | must pay those damages. 152 | 153 | 5. NO WARRANTY 154 | 155 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS 156 | PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 157 | KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY 158 | WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY 159 | OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely 160 | responsible for determining the appropriateness of using and 161 | distributing the Program and assumes all risks associated with its 162 | exercise of rights under this Agreement , including but not limited to 163 | the risks and costs of program errors, compliance with applicable 164 | laws, damage to or loss of data, programs or equipment, and 165 | unavailability or interruption of operations. 166 | 167 | 6. DISCLAIMER OF LIABILITY 168 | 169 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR 170 | ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, 171 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING 172 | WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF 173 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 174 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR 175 | DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED 176 | HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 177 | 178 | 7. GENERAL 179 | 180 | If any provision of this Agreement is invalid or unenforceable under 181 | applicable law, it shall not affect the validity or enforceability of 182 | the remainder of the terms of this Agreement, and without further 183 | action by the parties hereto, such provision shall be reformed to the 184 | minimum extent necessary to make such provision valid and enforceable. 185 | 186 | If Recipient institutes patent litigation against any entity 187 | (including a cross-claim or counterclaim in a lawsuit) alleging that 188 | the Program itself (excluding combinations of the Program with other 189 | software or hardware) infringes such Recipient's patent(s), then such 190 | Recipient's rights granted under Section 2(b) shall terminate as of 191 | the date such litigation is filed. 192 | 193 | All Recipient's rights under this Agreement shall terminate if it 194 | fails to comply with any of the material terms or conditions of this 195 | Agreement and does not cure such failure in a reasonable period of 196 | time after becoming aware of such noncompliance. If all Recipient's 197 | rights under this Agreement terminate, Recipient agrees to cease use 198 | and distribution of the Program as soon as reasonably 199 | practicable. However, Recipient's obligations under this Agreement and 200 | any licenses granted by Recipient relating to the Program shall 201 | continue and survive. 202 | 203 | Everyone is permitted to copy and distribute copies of this Agreement, 204 | but in order to avoid inconsistency the Agreement is copyrighted and 205 | may only be modified in the following manner. The Agreement Steward 206 | reserves the right to publish new versions (including revisions) of 207 | this Agreement from time to time. No one other than the Agreement 208 | Steward has the right to modify this Agreement. The Eclipse Foundation 209 | is the initial Agreement Steward. The Eclipse Foundation may assign 210 | the responsibility to serve as the Agreement Steward to a suitable 211 | separate entity. Each new version of the Agreement will be given a 212 | distinguishing version number. The Program (including Contributions) 213 | may always be distributed subject to the version of the Agreement 214 | under which it was received. In addition, after a new version of the 215 | Agreement is published, Contributor may elect to distribute the 216 | Program (including its Contributions) under the new version. Except as 217 | expressly stated in Sections 2(a) and 2(b) above, Recipient receives 218 | no rights or licenses to the intellectual property of any Contributor 219 | under this Agreement, whether expressly, by implication, estoppel or 220 | otherwise. All rights in the Program not expressly granted under this 221 | Agreement are reserved. 222 | 223 | This Agreement is governed by the laws of the State of New York and 224 | the intellectual property laws of the United States of America. No 225 | party to this Agreement will bring a legal action under this Agreement 226 | more than one year after the cause of action arose. Each party waives 227 | its rights to a jury trial in any resulting litigation. 228 | 229 | 230 | 231 | Images distributed under the Creative Commons Attribution + ShareAlike 232 | License version 3.0: 233 | 234 | THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS 235 | CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS 236 | PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE 237 | WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS 238 | PROHIBITED. 239 | 240 | BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND 241 | AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS 242 | LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU 243 | THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH 244 | TERMS AND CONDITIONS. 245 | 246 | 1. Definitions 247 | 248 | "Adaptation" means a work based upon the Work, or upon the Work 249 | and other pre-existing works, such as a translation, adaptation, 250 | derivative work, arrangement of music or other alterations of a 251 | literary or artistic work, or phonogram or performance and 252 | includes cinematographic adaptations or any other form in which 253 | the Work may be recast, transformed, or adapted including in any 254 | form recognizably derived from the original, except that a work 255 | that constitutes a Collection will not be considered an Adaptation 256 | for the purpose of this License. For the avoidance of doubt, where 257 | the Work is a musical work, performance or phonogram, the 258 | synchronization of the Work in timed-relation with a moving image 259 | ("synching") will be considered an Adaptation for the purpose of 260 | this License. 261 | 262 | "Collection" means a collection of literary or artistic works, 263 | such as encyclopedias and anthologies, or performances, phonograms 264 | or broadcasts, or other works or subject matter other than works 265 | listed in Section 1(f) below, which, by reason of the selection 266 | and arrangement of their contents, constitute intellectual 267 | creations, in which the Work is included in its entirety in 268 | unmodified form along with one or more other contributions, each 269 | constituting separate and independent works in themselves, which 270 | together are assembled into a collective whole. A work that 271 | constitutes a Collection will not be considered an Adaptation (as 272 | defined below) for the purposes of this License. 273 | 274 | "Creative Commons Compatible License" means a license that is 275 | listed at http://creativecommons.org/compatiblelicenses that has 276 | been approved by Creative Commons as being essentially equivalent 277 | to this License, including, at a minimum, because that license: 278 | (i) contains terms that have the same purpose, meaning and effect 279 | as the License Elements of this License; and, (ii) explicitly 280 | permits the relicensing of adaptations of works made available 281 | under that license under this License or a Creative Commons 282 | jurisdiction license with the same License Elements as this 283 | License. 284 | 285 | "Distribute" means to make available to the public the original 286 | and copies of the Work or Adaptation, as appropriate, through sale 287 | or other transfer of ownership. 288 | 289 | "License Elements" means the following high-level license 290 | attributes as selected by Licensor and indicated in the title of 291 | this License: Attribution, ShareAlike. 292 | 293 | "Licensor" means the individual, individuals, entity or entities 294 | that offer(s) the Work under the terms of this License. 295 | 296 | "Original Author" means, in the case of a literary or artistic 297 | work, the individual, individuals, entity or entities who created 298 | the Work or if no individual or entity can be identified, the 299 | publisher; and in addition (i) in the case of a performance the 300 | actors, singers, musicians, dancers, and other persons who act, 301 | sing, deliver, declaim, play in, interpret or otherwise perform 302 | literary or artistic works or expressions of folklore; (ii) in the 303 | case of a phonogram the producer being the person or legal entity 304 | who first fixes the sounds of a performance or other sounds; and, 305 | (iii) in the case of broadcasts, the organization that transmits 306 | the broadcast. 307 | 308 | "Work" means the literary and/or artistic work offered under the 309 | terms of this License including without limitation any production 310 | in the literary, scientific and artistic domain, whatever may be 311 | the mode or form of its expression including digital form, such as 312 | a book, pamphlet and other writing; a lecture, address, sermon or 313 | other work of the same nature; a dramatic or dramatico-musical 314 | work; a choreographic work or entertainment in dumb show; a 315 | musical composition with or without words; a cinematographic work 316 | to which are assimilated works expressed by a process analogous to 317 | cinematography; a work of drawing, painting, architecture, 318 | sculpture, engraving or lithography; a photographic work to which 319 | are assimilated works expressed by a process analogous to 320 | photography; a work of applied art; an illustration, map, plan, 321 | sketch or three-dimensional work relative to geography, 322 | topography, architecture or science; a performance; a broadcast; a 323 | phonogram; a compilation of data to the extent it is protected as 324 | a copyrightable work; or a work performed by a variety or circus 325 | performer to the extent it is not otherwise considered a literary 326 | or artistic work. 327 | 328 | "You" means an individual or entity exercising rights under this 329 | License who has not previously violated the terms of this License 330 | with respect to the Work, or who has received express permission 331 | from the Licensor to exercise rights under this License despite a 332 | previous violation. 333 | 334 | "Publicly Perform" means to perform public recitations of the Work 335 | and to communicate to the public those public recitations, by any 336 | means or process, including by wire or wireless means or public 337 | digital performances; to make available to the public Works in 338 | such a way that members of the public may access these Works from 339 | a place and at a place individually chosen by them; to perform the 340 | Work to the public by any means or process and the communication 341 | to the public of the performances of the Work, including by public 342 | digital performance; to broadcast and rebroadcast the Work by any 343 | means including signs, sounds or images. 344 | 345 | "Reproduce" means to make copies of the Work by any means 346 | including without limitation by sound or visual recordings and the 347 | right of fixation and reproducing fixations of the Work, including 348 | storage of a protected performance or phonogram in digital form or 349 | other electronic medium. 350 | 351 | 2. Fair Dealing Rights. Nothing in this License is intended to reduce, 352 | limit, or restrict any uses free from copyright or rights arising from 353 | limitations or exceptions that are provided for in connection with the 354 | copyright protection under copyright law or other applicable laws. 355 | 356 | 3. License Grant. Subject to the terms and conditions of this License, 357 | Licensor hereby grants You a worldwide, royalty-free, non-exclusive, 358 | perpetual (for the duration of the applicable copyright) license to 359 | exercise the rights in the Work as stated below: 360 | 361 | to Reproduce the Work, to incorporate the Work into one or more 362 | Collections, and to Reproduce the Work as incorporated in the 363 | Collections; 364 | 365 | to create and Reproduce Adaptations provided that any such 366 | Adaptation, including any translation in any medium, takes 367 | reasonable steps to clearly label, demarcate or otherwise identify 368 | that changes were made to the original Work. For example, a 369 | translation could be marked "The original work was translated from 370 | English to Spanish," or a modification could indicate "The 371 | original work has been modified."; 372 | 373 | to Distribute and Publicly Perform the Work including as 374 | incorporated in Collections; and, 375 | 376 | to Distribute and Publicly Perform Adaptations. 377 | 378 | For the avoidance of doubt: 379 | 380 | Non-waivable Compulsory License Schemes. In those 381 | jurisdictions in which the right to collect royalties through 382 | any statutory or compulsory licensing scheme cannot be waived, 383 | the Licensor reserves the exclusive right to collect such 384 | royalties for any exercise by You of the rights granted under 385 | this License; 386 | 387 | Waivable Compulsory License Schemes. In those jurisdictions in 388 | which the right to collect royalties through any statutory or 389 | compulsory licensing scheme can be waived, the Licensor waives 390 | the exclusive right to collect such royalties for any exercise 391 | by You of the rights granted under this License; and, 392 | 393 | Voluntary License Schemes. The Licensor waives the right to 394 | collect royalties, whether individually or, in the event that 395 | the Licensor is a member of a collecting society that 396 | administers voluntary licensing schemes, via that society, 397 | from any exercise by You of the rights granted under this 398 | License. 399 | 400 | The above rights may be exercised in all media and formats whether now 401 | known or hereafter devised. The above rights include the right to make 402 | such modifications as are technically necessary to exercise the rights 403 | in other media and formats. Subject to Section 8(f), all rights not 404 | expressly granted by Licensor are hereby reserved. 405 | 406 | 4. Restrictions. The license granted in Section 3 above is expressly 407 | made subject to and limited by the following restrictions: 408 | 409 | You may Distribute or Publicly Perform the Work only under the 410 | terms of this License. You must include a copy of, or the Uniform 411 | Resource Identifier (URI) for, this License with every copy of the 412 | Work You Distribute or Publicly Perform. You may not offer or 413 | impose any terms on the Work that restrict the terms of this 414 | License or the ability of the recipient of the Work to exercise 415 | the rights granted to that recipient under the terms of the 416 | License. You may not sublicense the Work. You must keep intact all 417 | notices that refer to this License and to the disclaimer of 418 | warranties with every copy of the Work You Distribute or Publicly 419 | Perform. When You Distribute or Publicly Perform the Work, You may 420 | not impose any effective technological measures on the Work that 421 | restrict the ability of a recipient of the Work from You to 422 | exercise the rights granted to that recipient under the terms of 423 | the License. This Section 4(a) applies to the Work as incorporated 424 | in a Collection, but this does not require the Collection apart 425 | from the Work itself to be made subject to the terms of this 426 | License. If You create a Collection, upon notice from any Licensor 427 | You must, to the extent practicable, remove from the Collection 428 | any credit as required by Section 4(c), as requested. If You 429 | create an Adaptation, upon notice from any Licensor You must, to 430 | the extent practicable, remove from the Adaptation any credit as 431 | required by Section 4(c), as requested. 432 | 433 | You may Distribute or Publicly Perform an Adaptation only under 434 | the terms of: (i) this License; (ii) a later version of this 435 | License with the same License Elements as this License; (iii) a 436 | Creative Commons jurisdiction license (either this or a later 437 | license version) that contains the same License Elements as this 438 | License (e.g., Attribution-ShareAlike 3.0 US)); (iv) a Creative 439 | Commons Compatible License. If you license the Adaptation under 440 | one of the licenses mentioned in (iv), you must comply with the 441 | terms of that license. If you license the Adaptation under the 442 | terms of any of the licenses mentioned in (i), (ii) or (iii) (the 443 | "Applicable License"), you must comply with the terms of the 444 | Applicable License generally and the following provisions: (I) You 445 | must include a copy of, or the URI for, the Applicable License 446 | with every copy of each Adaptation You Distribute or Publicly 447 | Perform; (II) You may not offer or impose any terms on the 448 | Adaptation that restrict the terms of the Applicable License or 449 | the ability of the recipient of the Adaptation to exercise the 450 | rights granted to that recipient under the terms of the Applicable 451 | License; (III) You must keep intact all notices that refer to the 452 | Applicable License and to the disclaimer of warranties with every 453 | copy of the Work as included in the Adaptation You Distribute or 454 | Publicly Perform; (IV) when You Distribute or Publicly Perform the 455 | Adaptation, You may not impose any effective technological 456 | measures on the Adaptation that restrict the ability of a 457 | recipient of the Adaptation from You to exercise the rights 458 | granted to that recipient under the terms of the Applicable 459 | License. This Section 4(b) applies to the Adaptation as 460 | incorporated in a Collection, but this does not require the 461 | Collection apart from the Adaptation itself to be made subject to 462 | the terms of the Applicable License. 463 | 464 | If You Distribute, or Publicly Perform the Work or any Adaptations 465 | or Collections, You must, unless a request has been made pursuant 466 | to Section 4(a), keep intact all copyright notices for the Work 467 | and provide, reasonable to the medium or means You are utilizing: 468 | (i) the name of the Original Author (or pseudonym, if applicable) 469 | if supplied, and/or if the Original Author and/or Licensor 470 | designate another party or parties (e.g., a sponsor institute, 471 | publishing entity, journal) for attribution ("Attribution 472 | Parties") in Licensor's copyright notice, terms of service or by 473 | other reasonable means, the name of such party or parties; (ii) 474 | the title of the Work if supplied; (iii) to the extent reasonably 475 | practicable, the URI, if any, that Licensor specifies to be 476 | associated with the Work, unless such URI does not refer to the 477 | copyright notice or licensing information for the Work; and (iv) , 478 | consistent with Ssection 3(b), in the case of an Adaptation, a 479 | credit identifying the use of the Work in the Adaptation (e.g., 480 | "French translation of the Work by Original Author," or 481 | "Screenplay based on original Work by Original Author"). The 482 | credit required by this Section 4(c) may be implemented in any 483 | reasonable manner; provided, however, that in the case of a 484 | Adaptation or Collection, at a minimum such credit will appear, if 485 | a credit for all contributing authors of the Adaptation or 486 | Collection appears, then as part of these credits and in a manner 487 | at least as prominent as the credits for the other contributing 488 | authors. For the avoidance of doubt, You may only use the credit 489 | required by this Section for the purpose of attribution in the 490 | manner set out above and, by exercising Your rights under this 491 | License, You may not implicitly or explicitly assert or imply any 492 | connection with, sponsorship or endorsement by the Original 493 | Author, Licensor and/or Attribution Parties, as appropriate, of 494 | You or Your use of the Work, without the separate, express prior 495 | written permission of the Original Author, Licensor and/or 496 | Attribution Parties. 497 | 498 | Except as otherwise agreed in writing by the Licensor or as may be 499 | otherwise permitted by applicable law, if You Reproduce, 500 | Distribute or Publicly Perform the Work either by itself or as 501 | part of any Adaptations or Collections, You must not distort, 502 | mutilate, modify or take other derogatory action in relation to 503 | the Work which would be prejudicial to the Original Author's honor 504 | or reputation. Licensor agrees that in those jurisdictions 505 | (e.g. Japan), in which any exercise of the right granted in 506 | Section 3(b) of this License (the right to make Adaptations) would 507 | be deemed to be a distortion, mutilation, modification or other 508 | derogatory action prejudicial to the Original Author's honor and 509 | reputation, the Licensor will waive or not assert, as appropriate, 510 | this Section, to the fullest extent permitted by the applicable 511 | national law, to enable You to reasonably exercise Your right 512 | under Section 3(b) of this License (right to make Adaptations) but 513 | not otherwise. 514 | 515 | 5. Representations, Warranties and Disclaimer 516 | 517 | UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, 518 | LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR 519 | WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, 520 | STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF 521 | TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, 522 | NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, 523 | OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT 524 | DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED 525 | WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU. 526 | 527 | 6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY 528 | APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY 529 | LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR 530 | EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, 531 | EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 532 | 533 | 7. Termination 534 | 535 | This License and the rights granted hereunder will terminate 536 | automatically upon any breach by You of the terms of this 537 | License. Individuals or entities who have received Adaptations or 538 | Collections from You under this License, however, will not have 539 | their licenses terminated provided such individuals or entities 540 | remain in full compliance with those licenses. Sections 1, 2, 5, 541 | 6, 7, and 8 will survive any termination of this License. 542 | 543 | Subject to the above terms and conditions, the license granted 544 | here is perpetual (for the duration of the applicable copyright in 545 | the Work). Notwithstanding the above, Licensor reserves the right 546 | to release the Work under different license terms or to stop 547 | distributing the Work at any time; provided, however that any such 548 | election will not serve to withdraw this License (or any other 549 | license that has been, or is required to be, granted under the 550 | terms of this License), and this License will continue in full 551 | force and effect unless terminated as stated above. 552 | 553 | 8. Miscellaneous 554 | 555 | Each time You Distribute or Publicly Perform the Work or a 556 | Collection, the Licensor offers to the recipient a license to the 557 | Work on the same terms and conditions as the license granted to 558 | You under this License. 559 | 560 | Each time You Distribute or Publicly Perform an Adaptation, 561 | Licensor offers to the recipient a license to the original Work on 562 | the same terms and conditions as the license granted to You under 563 | this License. 564 | 565 | If any provision of this License is invalid or unenforceable under 566 | applicable law, it shall not affect the validity or enforceability 567 | of the remainder of the terms of this License, and without further 568 | action by the parties to this agreement, such provision shall be 569 | reformed to the minimum extent necessary to make such provision 570 | valid and enforceable. 571 | 572 | No term or provision of this License shall be deemed waived and no 573 | breach consented to unless such waiver or consent shall be in 574 | writing and signed by the party to be charged with such waiver or 575 | consent. 576 | 577 | This License constitutes the entire agreement between the parties 578 | with respect to the Work licensed here. There are no 579 | understandings, agreements or representations with respect to the 580 | Work not specified here. Licensor shall not be bound by any 581 | additional provisions that may appear in any communication from 582 | You. This License may not be modified without the mutual written 583 | agreement of the Licensor and You. 584 | 585 | The rights granted under, and the subject matter referenced, in 586 | this License were drafted utilizing the terminology of the Berne 587 | Convention for the Protection of Literary and Artistic Works (as 588 | amended on September 28, 1979), the Rome Convention of 1961, the 589 | WIPO Copyright Treaty of 1996, the WIPO Performances and 590 | Phonograms Treaty of 1996 and the Universal Copyright Convention 591 | (as revised on July 24, 1971). These rights and subject matter 592 | take effect in the relevant jurisdiction in which the License 593 | terms are sought to be enforced according to the corresponding 594 | provisions of the implementation of those treaty provisions in the 595 | applicable national law. If the standard suite of rights granted 596 | under applicable copyright law includes additional rights not 597 | granted under this License, such additional rights are deemed to 598 | be included in the License; this License is not intended to 599 | restrict the license of any rights under applicable law. 600 | --------------------------------------------------------------------------------