Commit 5dee0b73 authored by Michael Hanus 's avatar Michael Hanus

Loadpath added

parent 11f1622a
......@@ -4,17 +4,13 @@ The Spicey Web Application Framework
To generate an application, follow the steps below.
1. Create a Curry program containing a constant of type `Database.ERD.ERD`
(the module `Database.ERD` is part of the package `cdbi`)
which describes your entity-relationship model
(see the file "examples/BlogERD.curry" as an example).
2. Since the imported module `Database.ERD` is part of the package `cdbi`,
this package must be installed, e.g., by the command
2. Execute `spiceup` and supply the name of the Curry ERD program, e.g.,
cypm add --dependency cdbi
3. Execute `spiceup` and supply the name of the Curry ERD program, e.g.,
cypm exec spiceup .../BlogERD.curry
spiceup .../BlogERD.curry
This generates the complete source code of the initial application
(see the generated file README.txt for some explanations).
......@@ -22,7 +18,7 @@ To generate an application, follow the steps below.
You can also provide a file name for the SQLite3 database in which
all data is stored, e.g.,
cypm exec spiceup --db BlogData.db .../Blog.erdterm
spiceup --db BlogData.db .../Blog.erdterm
If the parameter "--db ..." is not provided, then the name of database
file is "<ERD>.db" where <ERD> is the name of the specified ER model.
......@@ -34,17 +30,17 @@ To generate an application, follow the steps below.
This path could also be set in the definition of the constant
`sqliteDBFile` in the generated Curry program `Model/<ERD>.curry`.
4. Change into the generated directory containing all sources as a
3. Change into the generated directory containing all sources as a
Curry package, e.g., by `cd Blog`.
5. Install all required packages by `make install`.
4. Install all required packages by `make install`.
6. Compile the generated programs by `make compile`.
5. Compile the generated programs by `make compile`.
7. Configure the Makefile (variable WEBSERVERDIR) and execute
6. Configure the Makefile (variable WEBSERVERDIR) and execute
`make deploy` to deploy the web application.
8. After the successful compilation, the application is executable
7. After the successful compilation, the application is executable
in a web browser by loading `<URL of web dir>/spicey.cgi`.
Note that the database is generated with the `cdbi` package.
......
......@@ -55,21 +55,16 @@ This is an ER model for university lectures as
presented in the paper \cite{BrasselHanusMueller08PADL}.
\end{description}
%
Since the imported module \code{Database.ERD} is part of the package
\code{cdbi}, you have to install this package first, e.g., by the command
\begin{curry}
> cypm add --dependency cdbi
\end{curry}
Then you can generate the sources of your web application
by the command\pindex{spiceup}
\begin{curry}
> cypm exec spiceup MyERD.curry
> spiceup MyERD.curry
\end{curry}
with the ERD program as a parameter.
You can also provide a file name for the SQLite3 database used
by the application generated by Spicey, e.g.,
\begin{curry}
> cypm exec spiceup --db MyData.db MyERD.curry
> spiceup --db MyData.db MyERD.curry
\end{curry}
If the parameter \ccode{--db DBFILE} is not provided,
then \code{DBDFILE} is set to the default name \ccode{$ERD$.db}
......
......@@ -2,21 +2,21 @@
module Spicey.SpiceUp where
import Database.ERD (ERD, readERDTermFile)
import Database.ERD.Goodies (erdName, storeERDFromProgram)
import Database.ERD ( ERD, readERDTermFile )
import Database.ERD.Goodies ( erdName, storeERDFromProgram )
import Directory
import Distribution
import FilePath ((</>))
import List (isSuffixOf, last)
import System (system, getArgs, exitWith)
import FilePath ( (</>) )
import List ( isSuffixOf, last )
import System ( setEnviron, system, getArgs, exitWith )
import Spicey.PackageConfig (packagePath, packageVersion)
import Spicey.PackageConfig ( packagePath, packageVersion, packageLoadPath )
import Spicey.Scaffolding
systemBanner :: String
systemBanner =
let bannerText = "Spicey Web Framework (Version " ++ packageVersion ++
" of 08/01/18)"
" of 14/01/18)"
bannerLine = take (length bannerText) (repeat '-')
in bannerLine ++ "\n" ++ bannerText ++ "\n" ++ bannerLine
......@@ -173,6 +173,8 @@ main = do
_ -> putStrLn ("Wrong arguments!\n") >> spiceupHelp 1
where
createStructureWith orgfile dbfile = do
-- set CURRYPATH in order to compile ERD model (which requires Database.ERD)
unless (null packageLoadPath) $ setEnviron "CURRYPATH" packageLoadPath
-- The directory containing the project generator:
let resourcedir = packagePath </> "resource_files"
exfile <- doesFileExist orgfile
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment