Skip to content
Browse files

Initial commit

  • Loading branch information...
0 parents commit 823f1cbcf8581329af60eabd6f50ce1c8f6aaa0c @cedricss committed
21 Makefile
@@ -0,0 +1,21 @@
+########################################
+# USER VARIABLES
+
+EXE = election.exe
+PACKNAME =
+SRC =
+MAINSRC = src/main.opa
+PCKDIR = ./pck/
+PCK = bootstrap.tabs.opx
+PLUGIN =
+PLUGINDIR =
+
+# Build exe
+default: exe
+
+# Run Server
+run: exe
+ ./$(EXE) $(RUN_OPT) || exit 0 ## prevent ugly make error 130 :) ##
+
+
+include Makefile.common
89 Makefile.common
@@ -0,0 +1,89 @@
+########################################
+# MAKEFILE VARIABLES
+OPACOMPILER ?= opa
+OPA = $(OPACOMPILER) $(FLAG) $(OPAOPT)
+PWD ?= $(shell pwd)
+BUILDDIR ?= $(PWD)/_build
+export BUILDDIR
+BUILDDOCDIR ?=$(PWD)/doc/
+export BUILDDOCDIR
+PACKDOC = $(BUILDDOCDIR)/$(PACKNAME:%.opx=%.doc)/
+BUILDDOC = $(PACKDOC)
+OPAGENAPI ?= $(OPACOMPILER) --api-only
+OPADOC ?= opadoc-gen.exe
+DEPENDS = $(SRC) $(PCK:%=$(BUILDDIR)/%) $(PLUGIN:%=$(BUILDDIR)/%)
+
+ifdef CONF_FILE
+ CONFIG = --conf $(CONF_FILE) --conf-opa-files
+else
+ CONFIG =
+endif
+
+_ = $(shell mkdir -p $(BUILDDIR))
+
+########################################
+# MAIN RULE
+exe : $(EXE)
+pack : $(PACKNAME)
+doc : $(PACKDOC) doc.sub
+
+########################################
+# MAIN PACKAGE BUILDING
+$(PACKNAME) : $(BUILDDIR)/$(PACKNAME)
+
+$(BUILDDIR)/$(PACKNAME) : $(DEPENDS)
+ @echo "### Building package $(PACKNAME)"
+ mkdir -p $(BUILDDIR)
+ $(OPA) --autocompile $(SRC) $(PLUGIN:%=$(BUILDDIR)/%) --build-dir $(BUILDDIR) -I $(BUILDDIR) $(OPAOPT)
+ @rm -rf $(BUILDDIR)/$(PACKNAME)
+ @mv $(PACKNAME) $(BUILDDIR)/
+
+########################################
+# SUBS PACKAGE/PLUGIN BUILDING
+$(BUILDDIR)/%.opx :
+ make $(@:$(BUILDDIR)/%.opx=-C $(PCKDIR)/%) pack
+
+$(BUILDDIR)/%.opp :
+ make $(@:$(BUILDDIR)/%.opp=-C $(PLUGINDIR)/%)
+
+########################################
+# EXECUTABLE BUILDING
+$(EXE) : pack $(SRC) $(MAINSRC) $(DEPENDS) $(OTHER_DEPENDS)
+ @echo "### Building executable $(EXE) "
+ mkdir -p $(BUILDDIR)
+ $(OPA) $(COMPILOPT) $(MAINSRC) $(CONFIG) $(PLUGIN:%=$(BUILDDIR)/%) -o $@ -I $(BUILDDIR) --build-dir $(BUILDDIR)/$(EXE)
+
+$(EXE:%.exe=%.run) : $(EXE)
+ ./$(EXE) -p $(PORT)
+
+########################################
+# DOCUMENTATION BUILDING - Dirty...
+$(PACKDOC) :
+ @echo "### Building documentation $(PACKNAME:%.opx=%.doc)"
+ @mkdir -p $(BUILDDOC)
+ @$(OPACOMPILER) $(SRC) $(PLUGIN:%=$(BUILDDIR)/%) --api-only -I $(BUILDDIR)
+ @mv $(SRC:%=%.api) $(SRC:%=%.api-txt) $(BUILDDOC)
+ @cp $(SRC) $(BUILDDOC)
+ @cd $(BUILDDOC) && $(OPADOC) .
+ @mkdir -p $(PACKDOC)
+ @mv doc/*.html doc/*.css $(PACKDOC)
+
+doc.sub :
+ @if [ -n "$(PCK)" ]; then make $(PCK:%.opx=-C $(PCKDIR)/%) doc; fi
+
+########################################
+# Used by recursives makefile
+pack.depends :
+ @echo $(PCK) $(PLUGIN)
+
+########################################
+# CLEANING
+clean ::
+ @$(PCK:%.opx=make -C $(PCKDIR)/% clean &&) $(PLUGIN:%.opp=make -C $(PLUGINDIR)/% clean &&) echo "### Cleaning $(BUILDDIR)";
+ @rm -rf $(BUILDDIR)/* _tracks/*;
+ @if [ -n "$(EXE)" ]; then rm -rf $(EXE); fi
+ @if [ -n "$(PACKDOC)" ]; then rm -rf $(PACKDOC); fi
+
+deep-clean: clean
+ @rm -rf opa-debug/*
+
10 pck/bootstrap.tabs/Makefile
@@ -0,0 +1,10 @@
+########################################
+# USER VARIABLES
+PACKNAME = bootstrap.tabs.opx
+SRC = tabs.opa
+PLUGIN = tabs.opp
+PLUGINDIR = ./
+
+all: pack
+
+include Makefile.common
89 pck/bootstrap.tabs/Makefile.common
@@ -0,0 +1,89 @@
+########################################
+# MAKEFILE VARIABLES
+OPACOMPILER ?= opa
+OPA = $(OPACOMPILER) --parser classic $(FLAG) $(OPAOPT)
+PWD ?= $(shell pwd)
+BUILDDIR ?= $(PWD)/_build
+export BUILDDIR
+BUILDDOCDIR ?=$(PWD)/doc/
+export BUILDDOCDIR
+PACKDOC = $(BUILDDOCDIR)/$(PACKNAME:%.opx=%.doc)/
+BUILDDOC = $(PACKDOC)
+OPAGENAPI ?= $(OPACOMPILER) --api-only
+OPADOC ?= opadoc-gen.exe
+DEPENDS = $(SRC) $(PCK:%=$(BUILDDIR)/%) $(PLUGIN:%=$(BUILDDIR)/%)
+
+ifdef CONF_FILE
+ CONFIG = --conf $(CONF_FILE) --conf-opa-files
+else
+ CONFIG =
+endif
+
+_ = $(shell mkdir -p $(BUILDDIR))
+
+########################################
+# MAIN RULE
+exe : $(EXE)
+pack : $(PACKNAME)
+doc : $(PACKDOC) doc.sub
+
+########################################
+# MAIN PACKAGE BUILDING
+$(PACKNAME) : $(BUILDDIR)/$(PACKNAME)
+
+$(BUILDDIR)/$(PACKNAME) : $(DEPENDS)
+ @echo "### Building package $(PACKNAME)"
+ mkdir -p $(BUILDDIR)
+ $(OPA) --autocompile $(SRC) $(PLUGIN:%=$(BUILDDIR)/%) --build-dir $(BUILDDIR) -I $(BUILDDIR) $(OPAOPT)
+ @rm -rf $(BUILDDIR)/$(PACKNAME)
+ @mv $(PACKNAME) $(BUILDDIR)/
+
+########################################
+# SUBS PACKAGE/PLUGIN BUILDING
+$(BUILDDIR)/%.opx :
+ make $(@:$(BUILDDIR)/%.opx=-C $(PCKDIR)/%) pack
+
+$(BUILDDIR)/%.opp :
+ make $(@:$(BUILDDIR)/%.opp=-C $(PLUGINDIR)/%)
+
+########################################
+# EXECUTABLE BUILDING
+$(EXE) : pack $(SRC) $(MAINSRC) $(DEPENDS) $(OTHER_DEPENDS)
+ @echo "### Building executable $(EXE) "
+ mkdir -p $(BUILDDIR)
+ $(OPA) $(COMPILOPT) $(MAINSRC) $(CONFIG) $(PLUGIN:%=$(BUILDDIR)/%) -o $@ -I $(BUILDDIR) --build-dir $(BUILDDIR)/$(EXE)
+
+$(EXE:%.exe=%.run) : $(EXE)
+ ./$(EXE) -p $(PORT)
+
+########################################
+# DOCUMENTATION BUILDING - Dirty...
+$(PACKDOC) :
+ @echo "### Building documentation $(PACKNAME:%.opx=%.doc)"
+ @mkdir -p $(BUILDDOC)
+ @$(OPACOMPILER) $(SRC) $(PLUGIN:%=$(BUILDDIR)/%) --api-only -I $(BUILDDIR)
+ @mv $(SRC:%=%.api) $(SRC:%=%.api-txt) $(BUILDDOC)
+ @cp $(SRC) $(BUILDDOC)
+ @cd $(BUILDDOC) && $(OPADOC) .
+ @mkdir -p $(PACKDOC)
+ @mv doc/*.html doc/*.css $(PACKDOC)
+
+doc.sub :
+ @if [ -n "$(PCK)" ]; then make $(PCK:%.opx=-C $(PCKDIR)/%) doc; fi
+
+########################################
+# Used by recursives makefile
+pack.depends :
+ @echo $(PCK) $(PLUGIN)
+
+########################################
+# CLEANING
+clean ::
+ @$(PCK:%.opx=make -C $(PCKDIR)/% clean &&) $(PLUGIN:%.opp=make -C $(PLUGINDIR)/% clean &&) echo "### Cleaning $(BUILDDIR)";
+ @rm -rf $(BUILDDIR)/* _tracks/*;
+ @if [ -n "$(EXE)" ]; then rm -rf $(EXE); fi
+ @if [ -n "$(PACKDOC)" ]; then rm -rf $(PACKDOC); fi
+
+deep-clean: clean
+ @rm -rf opa-debug/*
+
9 pck/bootstrap.tabs/tabs.opa
@@ -0,0 +1,9 @@
+package bootstrap.tabs
+
+@client
+Tabs = {{
+
+ tab(dom:dom) =
+ (%%tabs.tab%%)(Dom.to_string(dom))
+
+}}
26 pck/bootstrap.tabs/tabs/Makefile
@@ -0,0 +1,26 @@
+########################################
+# USER VARIABLES
+MKLIB = opa-plugin-builder
+PLUGNAME = tabs.opp
+SRC = tabs.js bootstrap-tabs.js
+CONF = conf.jsconf
+
+########################################
+# MAKEFILE VARIABLES
+ifeq ($(origin BUILDDIR), undefined)
+ PWD := $(shell pwd)
+ BUILDDIR := $(PWD)/_build/
+ export BUILDDIR
+endif
+
+########################################
+# PLUGIN BUILDING
+$(PLUGNAME) : $(SRC)
+ @echo "### Building plugin $(PLUGNAME)"
+ @$(MKLIB) --js-validator-off -o $(@:%.opp=%) $? $(CONF) --build-dir $(BUILDDIR)
+
+########################################
+# CLEANING
+clean :
+ @echo "### Cleaning plugin $(PLUGNAME)"
+ @rm -rf $(BUILDDIR)/$(PLUGNAME)
130 pck/bootstrap.tabs/tabs/bootstrap-tabs.js
@@ -0,0 +1,130 @@
+/* ========================================================
+ * bootstrap-tab.js v2.0.2
+ * http://twitter.github.com/bootstrap/javascript.html#tabs
+ * ========================================================
+ * Copyright 2012 Twitter, Inc.
+ *
+ * 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.
+ * ======================================================== */
+
+
+!function( $ ){
+
+ "use strict"
+
+ /* TAB CLASS DEFINITION
+ * ==================== */
+
+ var Tab = function ( element ) {
+ this.element = $(element)
+ }
+
+ Tab.prototype = {
+
+ constructor: Tab
+
+ , show: function () {
+ var $this = this.element
+ , $ul = $this.closest('ul:not(.dropdown-menu)')
+ , selector = $this.attr('data-target')
+ , previous
+ , $target
+
+ if (!selector) {
+ selector = $this.attr('href')
+ selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
+ }
+
+ if ( $this.parent('li').hasClass('active') ) return
+
+ previous = $ul.find('.active a').last()[0]
+
+ $this.trigger({
+ type: 'show'
+ , relatedTarget: previous
+ })
+
+ $target = $(selector)
+
+ this.activate($this.parent('li'), $ul)
+ this.activate($target, $target.parent(), function () {
+ $this.trigger({
+ type: 'shown'
+ , relatedTarget: previous
+ })
+ })
+ }
+
+ , activate: function ( element, container, callback) {
+ var $active = container.find('> .active')
+ , transition = callback
+ && $.support.transition
+ && $active.hasClass('fade')
+
+ function next() {
+ $active
+ .removeClass('active')
+ .find('> .dropdown-menu > .active')
+ .removeClass('active')
+
+ element.addClass('active')
+
+ if (transition) {
+ element[0].offsetWidth // reflow for transition
+ element.addClass('in')
+ } else {
+ element.removeClass('fade')
+ }
+
+ if ( element.parent('.dropdown-menu') ) {
+ element.closest('li.dropdown').addClass('active')
+ }
+
+ callback && callback()
+ }
+
+ transition ?
+ $active.one($.support.transition.end, next) :
+ next()
+
+ $active.removeClass('in')
+ }
+ }
+
+
+ /* TAB PLUGIN DEFINITION
+ * ===================== */
+
+ $.fn.tab = function ( option ) {
+ return this.each(function () {
+ var $this = $(this)
+ , data = $this.data('tab')
+ if (!data) $this.data('tab', (data = new Tab(this)))
+ if (typeof option == 'string') data[option]()
+ })
+ }
+
+ $.fn.tab.Constructor = Tab
+
+
+ /* TAB DATA-API
+ * ============ */
+
+ $(function () {
+ $('body').on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
+ e.preventDefault()
+ $(this).tab('show')
+ })
+ })
+
+}( window.jQuery );
2 pck/bootstrap.tabs/tabs/conf.jsconf
@@ -0,0 +1,2 @@
+[bootstrap-tabs.js]
+verbatim: true
6 pck/bootstrap.tabs/tabs/tabs.js
@@ -0,0 +1,6 @@
+##register tab : string -> void
+##args(sel)
+{
+ $(sel).tab('show');
+ return js_void;
+}
0 src/main.opa
No changes.

0 comments on commit 823f1cb

Please sign in to comment.
Something went wrong with that request. Please try again.