-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #770 from ocsigen/templates
Basic dune template
- Loading branch information
Showing
27 changed files
with
832 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
(ignored_subdirs (templates)) | ||
(install | ||
(section lib) | ||
(files (glob_files templates/basic.ppx/*))) | ||
(files (glob_files templates/client-server.basic/*) | ||
(glob_files templates/basic.ppx/*))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.eliomreserve | ||
upgrade.sql | ||
.eliomignore | ||
.eliomverbatim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
db | ||
local | ||
mobile | ||
options | ||
os | ||
demo | ||
style |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
assets!images!icon.png | ||
mobile!www!img!logo.png | ||
static!fonts!FontAwesome.otf | ||
static!fonts!fontawesome-webfont.eot | ||
static!fonts!fontawesome-webfont.svg | ||
static!fonts!fontawesome-webfont.ttf | ||
static!fonts!fontawesome-webfont.woff | ||
static!fonts!fontawesome-webfont.woff2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Database | ||
local_db | ||
|
||
# Local server configuration | ||
local | ||
|
||
# Eliom | ||
.depend | ||
_client | ||
_deps | ||
_server | ||
|
||
# Mobile application | ||
cordova | ||
|
||
# Style | ||
.sass-cache | ||
|
||
static/css/%%%PROJECT_NAME%%%.css.map | ||
static/css/%%%PROJECT_NAME%%%.css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
break-cases = fit | ||
break-collection-expressions = fit-or-vertical | ||
break-fun-decl = wrap | ||
break-fun-sig = wrap | ||
break-infix = wrap | ||
break-infix-before-func = false | ||
break-sequences = false | ||
break-separators = before | ||
break-string-literals = never | ||
break-struct = force | ||
cases-matching-exp-indent = compact | ||
doc-comments = after-when-possible | ||
dock-collection-brackets = false | ||
indicate-multiline-delimiters = no | ||
infix-precedence = indent | ||
let-and = compact | ||
let-binding-spacing = compact | ||
module-item-spacing = compact | ||
parens-tuple = multi-line-only | ||
parens-tuple-patterns = multi-line-only | ||
sequence-style = terminator | ||
sequence-blank-line = compact | ||
single-case = compact | ||
type-decl = compact | ||
if-then-else = keyword-first | ||
field-space = loose | ||
space-around-arrays = false | ||
space-around-records = false | ||
space-around-lists = false | ||
space-around-variants = false | ||
ocp-indent-compat = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
normal | ||
with=0 | ||
syntax=lwt mll | ||
max_indent=2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#---------------------------------------------------------------------- | ||
# GLOBAL MAKEFILE | ||
#---------------------------------------------------------------------- | ||
|
||
# Local settings (optional). See Makefile.local.example for an example. | ||
# WARNING: do not commit to a repository! | ||
-include Makefile.local | ||
|
||
# Eliom settings. Contains all variables. | ||
include Makefile.options | ||
|
||
# Eliom default makefile | ||
# Makefile.PROJECT_NAME is also included in this makefile | ||
include Makefile.eliom |
187 changes: 187 additions & 0 deletions
187
pkg/distillery/templates/client-server.basic/Makefile.eliom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,187 @@ | ||
#---------------------------------------------------------------------- | ||
# OCSIGEN-START MAKEFILE, NOT TO BE MODIFIED | ||
#---------------------------------------------------------------------- | ||
|
||
##---------------------------------------------------------------------- | ||
## DISCLAIMER | ||
## | ||
## This file contains the rules to make an Eliom project. The project is | ||
## configured through the variables in the file Makefile.options. | ||
##---------------------------------------------------------------------- | ||
|
||
##---------------------------------------------------------------------- | ||
## Internals | ||
|
||
## Required binaries | ||
OCSIGENSERVER := ocsigenserver | ||
OCSIGENSERVER.OPT := ocsigenserver.opt | ||
|
||
ifneq ($(DEBUG),yes) | ||
DUNE_OPTIONS = --profile release | ||
endif | ||
|
||
##---------------------------------------------------------------------- | ||
|
||
##---------------------------------------------------------------------- | ||
## General | ||
|
||
.PHONY: all css byte opt | ||
|
||
DIST_DIRS := $(ETCDIR) $(DATADIR) $(LIBDIR) $(LOGDIR) \ | ||
$(FILESDIR)/avatars/tmp $(ELIOMSTATICDIR) \ | ||
$(shell dirname $(CMDPIPE)) | ||
JS_PREFIX := $(TEST_PREFIX)$(ELIOMSTATICDIR)/$(PROJECT_NAME) | ||
|
||
CONF_IN := $(wildcard *.conf.in) | ||
CONFIG_FILES := $(patsubst %.conf.in,$(TEST_PREFIX)$(ETCDIR)/%.conf,$(CONF_IN)) | ||
TEST_CONFIG_FILES := $(patsubst %.conf.in,$(TEST_PREFIX)$(ETCDIR)/%-test.conf,$(CONF_IN)) | ||
|
||
|
||
all:: css | ||
all byte opt:: ${VOLATILE_SCHEMA} | ||
|
||
##---------------------------------------------------------------------- | ||
|
||
##---------------------------------------------------------------------- | ||
## Testing | ||
|
||
DIST_FILES = $(ELIOMSTATICDIR)/$(PROJECT_NAME).js $(LIBDIR)/$(PROJECT_NAME).cma | ||
|
||
.PHONY: test.byte test.opt staticfiles | ||
|
||
test.byte:: byte | $(addprefix $(TEST_PREFIX),$(DIST_DIRS)) staticfiles | ||
@echo "==== The website is available at http://localhost:$(TEST_PORT) ====" | ||
$(OCSIGENSERVER) $(RUN_DEBUG) -c $(patsubst %.conf.in,$(TEST_PREFIX)$(ETCDIR)/%-test.conf,$(CONF_IN)) | ||
test.opt:: opt | $(addprefix $(TEST_PREFIX),$(DIST_DIRS)) staticfiles | ||
@echo "==== The website is available at http://localhost:$(TEST_PORT) ====" | ||
$(OCSIGENSERVER.OPT) $(RUN_DEBUG) -c $(patsubst %.conf.in,$(TEST_PREFIX)$(ETCDIR)/%-test.conf,$(CONF_IN)) | ||
|
||
$(addprefix $(TEST_PREFIX), $(DIST_DIRS)): | ||
mkdir -p $@ | ||
|
||
staticfiles: | ||
cp -rf $(LOCAL_STATIC_CSS) $(TEST_PREFIX)$(ELIOMSTATICDIR) | ||
|
||
##---------------------------------------------------------------------- | ||
## Installing & Running | ||
|
||
.PHONY: install install.byte install.byte install.opt install.static install.etc install.lib install.lib.byte install.lib.opt run.byte run.opt | ||
install: install.byte install.opt | ||
install.byte: install.lib.byte install.etc install.static | $(addprefix $(PREFIX),$(DATADIR) $(LOGDIR) $(shell dirname $(CMDPIPE))) | ||
install.opt: install.lib.opt install.etc install.static | $(addprefix $(PREFIX),$(DATADIR) $(LOGDIR) $(shell dirname $(CMDPIPE))) | ||
install.lib: install.lib.byte install.lib.opt | ||
install.lib.byte: $(TEST_PREFIX)$(LIBDIR)/$(PROJECT_NAME).cma | $(PREFIX)$(LIBDIR) | ||
install $< $(PREFIX)$(LIBDIR) | ||
install.lib.opt: $(TEST_PREFIX)$(LIBDIR)/$(PROJECT_NAME).cmxs | $(PREFIX)$(LIBDIR) | ||
install $< $(PREFIX)$(LIBDIR) | ||
install.static: $(TEST_PREFIX)$(ELIOMSTATICDIR)/$(PROJECT_NAME).js | $(PREFIX)$(STATICDIR) $(PREFIX)$(ELIOMSTATICDIR) | ||
cp -r $(LOCAL_STATIC_CSS) $(PREFIX)$(FILESDIR) | ||
[ -z $(WWWUSER) ] || chown -R $(WWWUSER) $(PREFIX)$(FILESDIR) | ||
install $(addprefix -o ,$(WWWUSER)) $< $(PREFIX)$(ELIOMSTATICDIR) | ||
install.etc: $(TEST_PREFIX)$(ETCDIR)/$(PROJECT_NAME).conf | $(PREFIX)$(ETCDIR) | ||
install $< $(PREFIX)$(ETCDIR)/$(PROJECT_NAME).conf | ||
|
||
.PHONY: | ||
print-install-files: | ||
@echo $(PREFIX)$(LIBDIR) | ||
@echo $(PREFIX)$(ELIOMSTATICDIR) | ||
@echo $(PREFIX)$(ETCDIR) | ||
|
||
$(addprefix $(PREFIX),$(ETCDIR) $(LIBDIR)): | ||
install -d $@ | ||
$(addprefix $(PREFIX),$(DATADIR) $(LOGDIR) $(ELIOMSTATICDIR) $(shell dirname $(CMDPIPE))): | ||
install $(addprefix -o ,$(WWWUSER)) -d $@ | ||
|
||
run.byte: | ||
@echo "==== The website is available at http://localhost:$(PORT) ====" | ||
$(OCSIGENSERVER) $(RUN_DEBUG) -c ${PREFIX}${ETCDIR}/${PROJECT_NAME}.conf | ||
run.opt: | ||
@echo "==== The website is available at http://localhost:$(PORT) ====" | ||
$(OCSIGENSERVER.OPT) $(RUN_DEBUG) -c ${PREFIX}${ETCDIR}/${PROJECT_NAME}.conf | ||
|
||
##---------------------------------------------------------------------- | ||
|
||
##---------------------------------------------------------------------- | ||
## Config files | ||
|
||
ELIOM_MODULES=$(patsubst %,\<eliommodule\ findlib-package=\"%\"\ /\>,$(SERVER_ELIOM_PACKAGES)) | ||
FINDLIB_PACKAGES=$(patsubst %,\<extension\ findlib-package=\"%\"\ /\>,$(SERVER_PACKAGES)) | ||
EDIT_WARNING=DON\'T EDIT THIS FILE! It is generated from $(PROJECT_NAME).conf.in, edit that one, or the variables in Makefile.options | ||
SED_ARGS = -e "/^ *%%%/d" | ||
SED_ARGS += -e "s|%%PROJECT_NAME%%|$(PROJECT_NAME)|g" | ||
SED_ARGS += -e "s|%%DB_NAME%%|$(DB_NAME)|g" | ||
SED_ARGS += -e "s|%%DB_HOST%%|$(DB_HOST)|g" | ||
SED_ARGS += -e "s|%%DB_PORT%%|$(DB_PORT)|g" | ||
SED_ARGS += -e "s|%%DB_USER%%|$(DB_USER)|g" | ||
SED_ARGS += -e "s|%%DB_PASSWORD%%|$(DB_PASSWORD)|g" | ||
SED_ARGS += -e "s|%%CMDPIPE%%|%%PREFIX%%$(CMDPIPE)|g" | ||
SED_ARGS += -e "s|%%LOGDIR%%|%%PREFIX%%$(LOGDIR)|g" | ||
SED_ARGS += -e "s|%%DATADIR%%|%%PREFIX%%$(DATADIR)|g" | ||
SED_ARGS += -e "s|%%LIBDIR%%|%%PREFIX%%$(LIBDIR)|g" | ||
SED_ARGS += -e "s|%%WARNING%%|$(EDIT_WARNING)|g" | ||
SED_ARGS += -e "s|%%PACKAGES%%|$(FINDLIB_PACKAGES)|g" | ||
SED_ARGS += -e "s|%%ELIOM_MODULES%%|$(ELIOM_MODULES)|g" | ||
SED_ARGS += -e "s|%%FILESDIR%%|%%PREFIX%%$(FILESDIR)|g" | ||
SED_ARGS += -e "s|%%ELIOMSTATICDIR%%|%%PREFIX%%$(ELIOMSTATICDIR)|g" | ||
SED_ARGS += -e "s|%%APPNAME%%|$(shell basename `readlink $(JS_PREFIX).js` .js)|g" | ||
SED_ARGS += -e "s|%%CSSNAME%%|$(shell readlink $(CSS_PREFIX).css)|g" | ||
ifeq ($(DEBUG),yes) | ||
SED_ARGS += -e "s|%%DEBUGMODE%%|\<debugmode /\>|g" | ||
else | ||
SED_ARGS += -e "s|%%DEBUGMODE%%||g" | ||
endif | ||
LOCAL_SED_ARGS := -e "s|%%PORT%%|$(TEST_PORT)|g" | ||
LOCAL_SED_ARGS += -e "s|%%USERGROUP%%||g" | ||
GLOBAL_SED_ARGS := -e "s|%%PORT%%|$(PORT)|g" | ||
ifeq ($(WWWUSER)$(WWWGROUP),) | ||
GLOBAL_SED_ARGS += -e "s|%%USERGROUP%%||g" | ||
else | ||
GLOBAL_SED_ARGS += -e "s|%%USERGROUP%%|<user>$(WWWUSER)</user><group>$(WWWGROUP)</group>|g" | ||
endif | ||
JS_AND_CSS=$(JS_PREFIX).js $(CSS_PREFIX).css | ||
$(CONFIG_FILES): $(TEST_PREFIX)$(ETCDIR)/%.conf: %.conf.in $(JS_AND_CSS) | $(TEST_PREFIX)$(ETCDIR) | ||
sed $(SED_ARGS) $(GLOBAL_SED_ARGS) $< | sed -e "s|%%PREFIX%%|$(PREFIX)|g" > $@ | ||
$(TEST_CONFIG_FILES): $(TEST_PREFIX)$(ETCDIR)/%-test.conf: %.conf.in $(JS_AND_CSS) | $(TEST_PREFIX)$(ETCDIR) | ||
sed $(SED_ARGS) $(LOCAL_SED_ARGS) $< | sed -e "s|%%PREFIX%%|$(TEST_PREFIX)|g" > $@ | ||
##---------------------------------------------------------------------- | ||
##---------------------------------------------------------------------- | ||
## Compilation | ||
.PHONY: gen-dune config-files | ||
config-files: | $(TEST_PREFIX)$(ELIOMSTATICDIR) $(TEST_PREFIX)$(LIBDIR) | ||
HASH=`md5sum _build/default/client/$(PROJECT_NAME).bc.js | cut -d ' ' -f 1` && \ | ||
cp -f _build/default/client/$(PROJECT_NAME).bc.js $(JS_PREFIX)_$$HASH.js && \ | ||
ln -sf $(PROJECT_NAME)_$$HASH.js $(JS_PREFIX).js | ||
cp -f _build/default/$(PROJECT_NAME).cm* $(TEST_PREFIX)$(LIBDIR)/ | ||
$(MAKE) $(CONFIG_FILES) $(TEST_CONFIG_FILES) PROJECT_NAME=$(PROJECT_NAME) | ||
all:: gen-dune | ||
$(ENV_PSQL) dune build $(DUNE_OPTIONS) @install @$(PROJECT_NAME) $(PROJECT_NAME).cmxs | ||
byte:: gen-dune | ||
$(ENV_PSQL) dune build $(DUNE_OPTIONS) @$(PROJECT_NAME) | ||
make config-files PROJECT_NAME=$(PROJECT_NAME) | ||
opt:: gen-dune | ||
$(ENV_PSQL) dune build $(DUNE_OPTIONS) $(PROJECT_NAME).cmxs @$(PROJECT_NAME) | ||
make config-files PROJECT_NAME=$(PROJECT_NAME) | ||
gen-dune: | ||
@ocaml tools/gen_dune.ml > client/dune.client | ||
##---------------------------------------------------------------------- | ||
##---------------------------------------------------------------------- | ||
## Clean up | ||
.PHONY: clean | ||
clean:: | ||
dune clean |
79 changes: 79 additions & 0 deletions
79
pkg/distillery/templates/client-server.basic/Makefile.options
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#---------------------------------------------------------------------- | ||
# SETTINGS FOR THE ELIOM PROJECT %%%PROJECT_NAME%%% | ||
#---------------------------------------------------------------------- | ||
# Required binaries | ||
OPAM := opam | ||
|
||
PROJECT_NAME := %%%PROJECT_NAME%%% | ||
|
||
##---------------------------------------------------------------------- | ||
|
||
##---------------------------------------------------------------------- | ||
## The following part contains the settings for the compilation process like the | ||
## server/client OPAM packages and the server/client files. | ||
|
||
# OCamlfind packages for the server (for modules which defines services) | ||
SERVER_ELIOM_PACKAGES := | ||
|
||
# OCamlfind packages for the server | ||
SERVER_PACKAGES := | ||
|
||
##---------------------------------------------------------------------- | ||
|
||
##---------------------------------------------------------------------- | ||
## The following part contains the configuration for the ocsigenserver. | ||
|
||
# User to run server with (make run.*) | ||
WWWUSER := www-data | ||
WWWGROUP := www-data | ||
|
||
# Port for running the server (make run.*) | ||
PORT := 80 | ||
|
||
# Port for testing (make test.*) | ||
TEST_PORT := 8080 | ||
|
||
# Root of installation (must end with /) | ||
PREFIX := /usr/local/ | ||
|
||
# Local folder for make test.* (must end with /) | ||
TEST_PREFIX := local/ | ||
|
||
## The installation tree (relative to $(PREFIX) when installing/running or | ||
## $(TEST_PREFIX) when testing). | ||
|
||
# Configuration file $(PROJECT_NAME).conf | ||
ETCDIR := etc/${PROJECT_NAME} | ||
|
||
# Project's library $(PROJECT_NAME).cma (cmxs) | ||
LIBDIR := lib/${PROJECT_NAME} | ||
|
||
# Command pipe, eg. $ echo restart > $(INSTALL_PREFIX)$(CMDPIPE) | ||
CMDPIPE := var/run/${PROJECT_NAME}-cmd | ||
|
||
# Ocsigenserver's logging files | ||
LOGDIR := var/log/${PROJECT_NAME} | ||
|
||
# Ocsigenserver's persistent data files | ||
DATADIR := var/data/${PROJECT_NAME} | ||
|
||
# Project's static files | ||
FILESDIR := var/www/${PROJECT_NAME} | ||
|
||
# Project's JavaScript file directory | ||
ELIOMSTATICDIR := var/www/${PROJECT_NAME} | ||
|
||
LOCAL_STATIC := static | ||
LOCAL_STATIC_CSS := $(LOCAL_STATIC)/css | ||
CSS_PREFIX := $(LOCAL_STATIC_CSS)/${PROJECT_NAME} | ||
##---------------------------------------------------------------------- | ||
|
||
|
||
##---------------------------------------------------------------------- | ||
## The following part contains the settings for debugging | ||
|
||
# Debug application (yes/no): Debugging info in compilation, | ||
# JavaScript, ocsigenserver | ||
DEBUG := yes | ||
|
||
##---------------------------------------------------------------------- |
Oops, something went wrong.