From eb4c69f4606bcae608abe661375b5e90fb8b1be3 Mon Sep 17 00:00:00 2001 From: Benjamin Barenblat Date: Tue, 16 Aug 2016 17:10:06 -0400 Subject: Use a database Enable future development with queries by switch to a SQLite database for next actions. --- .gitignore | 2 ++ Makefile | 15 ++++++++++++--- main.ur | 16 ++++++---------- prepopulate.sql | 20 ++++++++++++++++++++ ugtd.urp | 4 +++- 5 files changed, 43 insertions(+), 14 deletions(-) create mode 100644 prepopulate.sql diff --git a/.gitignore b/.gitignore index 93f87fe..c0813ec 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,8 @@ mdl/lib.urp mdl/mdl.ur # Ur/Web +*.db +initialize.sql ugtd diff --git a/Makefile b/Makefile index 36bd738..7b78731 100644 --- a/Makefile +++ b/Makefile @@ -14,8 +14,16 @@ MDL = mdl/lib.urp mdl/mdl.ur -ugtd: ugtd.urp $(MDL) main.urs main.ur - urweb -ccompiler build_scripts/clang -output $@ ugtd +.PHONY: all +all: ugtd ugtd.db + +ugtd initialize.sql: ugtd.urp $(MDL) main.urs main.ur + urweb -ccompiler build_scripts/clang -output ugtd ugtd + +ugtd.db: initialize.sql prepopulate.sql + printf "" >$@ + sqlite3 $@
  • - {[action]} + {[action.Nam]}
  • val main = + actionItems <- queryX1 (SELECT * FROM nextAction) renderNextAction; setHeader (blessResponseHeader "X-UA-Compatible") "IE=edge"; return @@ -68,7 +64,7 @@ val main =
      - {List.mapX renderNextAction actionsForTesting} + {actionItems}
    diff --git a/prepopulate.sql b/prepopulate.sql new file mode 100644 index 0000000..4d3437b --- /dev/null +++ b/prepopulate.sql @@ -0,0 +1,20 @@ +-- Copyright 2016 Benjamin Barenblat +-- +-- Licensed under the Apache License, Version 2.0 (the “License”); you may not +-- use this file except in compliance with the License. You may obtain a copy +-- of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an “AS IS” BASIS, WITHOUT +-- WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +-- License for the specific language governing permissions and limitations under +-- the License. + +INSERT INTO uw_Main_nextAction (uw_nam) +VALUES + ("Print cover for TPS report"), + ("Collect information for TPS report"), + ("Generate charts for TPS report"), + ("Lorem ipsum dolor sit amet"); diff --git a/ugtd.urp b/ugtd.urp index 32f5e0e..e7cfe83 100644 --- a/ugtd.urp +++ b/ugtd.urp @@ -4,9 +4,11 @@ allow meta viewport allow responseHeader X-UA-Compatible allow url https://fonts.googleapis.com/* allow url https://code.getmdl.io/* +database dbname=ugtd.db +dbms sqlite library mdl script https://storage.googleapis.com/code.getmdl.io/1.1.3/material.min.js +sql initialize.sql rewrite url Main/main -$/list main -- cgit v1.2.3