Added a main class, to allow command line invocation.
This commit is contained in:
parent
f4330aad6b
commit
1338b54846
|
@ -1,3 +1,11 @@
|
||||||
|
# Release 1.4.1
|
||||||
|
|
||||||
|
Release 1.4.1 adds a 'magnitude' element to entities, in order to provide a pragma for when
|
||||||
|
to switch to asynchronous select widgets.
|
||||||
|
|
||||||
|
It also provides a family of transforms, written in Clojure, to generate a skeleton Clojure
|
||||||
|
web app from an ADL specification.
|
||||||
|
|
||||||
# Release 1.4
|
# Release 1.4
|
||||||
|
|
||||||
Release 1.4 adds an 'order' element as a possible child of the 'list' element, in order to specify
|
Release 1.4 adds an 'order' element as a possible child of the 'list' element, in order to specify
|
||||||
|
|
10
project.clj
10
project.clj
|
@ -1,10 +1,12 @@
|
||||||
(defproject adl "0.1.0-SNAPSHOT"
|
(defproject adl "1.4.1-SNAPSHOT"
|
||||||
:description "FIXME: write description"
|
:description "An application to transform an ADL application specification document into skeleton code for a Clojure web-app"
|
||||||
:url "http://example.com/FIXME"
|
:url "http://example.com/FIXME"
|
||||||
:license {:name "Eclipse Public License"
|
:license {:name "GNU General Public License,version 2.0 or (at your option) any later version"
|
||||||
:url "http://www.eclipse.org/legal/epl-v10.html"}
|
:url "https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html"}
|
||||||
:dependencies [[org.clojure/clojure "1.8.0"]
|
:dependencies [[org.clojure/clojure "1.8.0"]
|
||||||
[org.clojure/math.combinatorics "0.1.4"]
|
[org.clojure/math.combinatorics "0.1.4"]
|
||||||
[bouncer "1.0.1"]
|
[bouncer "1.0.1"]
|
||||||
[hiccup "1.0.5"]]
|
[hiccup "1.0.5"]]
|
||||||
|
:aot [adl.main]
|
||||||
|
:main adl.main
|
||||||
:plugins [[lein-codox "0.10.3"]])
|
:plugins [[lein-codox "0.10.3"]])
|
||||||
|
|
50
src/adl/main.clj
Normal file
50
src/adl/main.clj
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
(ns ^{:doc "Application Description Language - command line invocation."
|
||||||
|
:author "Simon Brooke"}
|
||||||
|
adl.main
|
||||||
|
(:require [adl.utils :refer :all]
|
||||||
|
[adl.to-hugsql-queries :as h]
|
||||||
|
[adl.to-json-routes :as j]
|
||||||
|
[adl.to-selmer-routes :as s]
|
||||||
|
[adl.to-selmer-templates :as t]
|
||||||
|
[clojure.xml :as x])
|
||||||
|
(:gen-class))
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;;;;
|
||||||
|
;;;; adl.main
|
||||||
|
;;;;
|
||||||
|
;;;; This program is free software; you can redistribute it and/or
|
||||||
|
;;;; modify it under the terms of the GNU General Public License
|
||||||
|
;;;; as published by the Free Software Foundation; either version 2
|
||||||
|
;;;; of the License, or (at your option) any later version.
|
||||||
|
;;;;
|
||||||
|
;;;; This program is distributed in the hope that it will be useful,
|
||||||
|
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
;;;; GNU General Public License for more details.
|
||||||
|
;;;;
|
||||||
|
;;;; You should have received a copy of the GNU General Public License
|
||||||
|
;;;; along with this program; if not, write to the Free Software
|
||||||
|
;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||||
|
;;;; USA.
|
||||||
|
;;;;
|
||||||
|
;;;; Copyright (C) 2018 Simon Brooke
|
||||||
|
;;;;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(defn print-usage [_]
|
||||||
|
(println "Argument should be a pathname to an ADL file"))
|
||||||
|
|
||||||
|
(defn -main
|
||||||
|
"Expects as arg the name of the git hook to be handled, followed by the arguments to it"
|
||||||
|
[& args]
|
||||||
|
(cond
|
||||||
|
(empty? args)
|
||||||
|
(print-usage args)
|
||||||
|
(.exists (java.io.File. (first args)))
|
||||||
|
(let [application (x/parse (first args))]
|
||||||
|
(h/to-hugsql-queries application)
|
||||||
|
;; (j/to-json-routes application)
|
||||||
|
(s/to-selmer-routes application)
|
||||||
|
(t/to-selmer-templates application))))
|
||||||
|
|
|
@ -33,10 +33,6 @@
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
|
||||||
(def ^:dynamic *output-path*
|
|
||||||
"The path to which generated files will be written."
|
|
||||||
"resources/auto/")
|
|
||||||
|
|
||||||
(defn where-clause
|
(defn where-clause
|
||||||
"Generate an appropriate `where` clause for queries on this `entity`;
|
"Generate an appropriate `where` clause for queries on this `entity`;
|
||||||
if `properties` are passed, filter on those properties, otherwise the key
|
if `properties` are passed, filter on those properties, otherwise the key
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
(:require [clojure.java.io :refer [file]]
|
(:require [clojure.java.io :refer [file]]
|
||||||
[clojure.string :as s]
|
[clojure.string :as s]
|
||||||
[clj-time.core :as t]
|
[clj-time.core :as t]
|
||||||
[clj-time.format :as f]))
|
[clj-time.format :as f]
|
||||||
|
[adl.utils :refer :all]))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;;;
|
;;;;
|
||||||
|
|
|
@ -34,11 +34,6 @@
|
||||||
|
|
||||||
;;; Generally. there's one route in the generated file for each Selmer template which has been generated.
|
;;; Generally. there's one route in the generated file for each Selmer template which has been generated.
|
||||||
|
|
||||||
(def ^:dynamic *output-path*
|
|
||||||
"The path to which generated files will be written."
|
|
||||||
"resources/auto/")
|
|
||||||
|
|
||||||
|
|
||||||
(defn file-header
|
(defn file-header
|
||||||
[application]
|
[application]
|
||||||
(list
|
(list
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(ns ^{;; :doc "Application Description Language - generate Selmer templates for the HTML pages implied by an ADL file."
|
(ns ^{:doc "Application Description Language - generate Selmer templates for the HTML pages implied by an ADL file."
|
||||||
:author "Simon Brooke"}
|
:author "Simon Brooke"}
|
||||||
adl.to-selmer-templates
|
adl.to-selmer-templates
|
||||||
(:require [adl.utils :refer :all]
|
(:require [adl.utils :refer :all]
|
||||||
|
@ -34,15 +34,6 @@
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
|
||||||
(def ^:dynamic *locale*
|
|
||||||
"The locale for which files will be generated."
|
|
||||||
"en-GB")
|
|
||||||
|
|
||||||
(def ^:dynamic *output-path*
|
|
||||||
"The path to which generated files will be written."
|
|
||||||
"resources/auto/")
|
|
||||||
|
|
||||||
|
|
||||||
(defn big-link
|
(defn big-link
|
||||||
[content url]
|
[content url]
|
||||||
{:tag :div
|
{:tag :div
|
||||||
|
|
|
@ -26,6 +26,17 @@
|
||||||
;;;;
|
;;;;
|
||||||
;;;; Copyright (C) 2018 Simon Brooke
|
;;;; Copyright (C) 2018 Simon Brooke
|
||||||
;;;;
|
;;;;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
|
||||||
|
(def ^:dynamic *locale*
|
||||||
|
"The locale for which files will be generated."
|
||||||
|
"en-GB")
|
||||||
|
|
||||||
|
(def ^:dynamic *output-path*
|
||||||
|
"The path to which generated files will be written."
|
||||||
|
"resources/auto/")
|
||||||
|
|
||||||
|
|
||||||
(defn link-table-name
|
(defn link-table-name
|
||||||
"Canonical name of a link table between entity `e1` and entity `e2`."
|
"Canonical name of a link table between entity `e1` and entity `e2`."
|
||||||
|
|
Loading…
Reference in a new issue