# ------------------------------
# macro
# ------------------------------
-ROOT :=$(PWD)
+ROOT ?= $(PWD)
SRC :=$(ROOT)/src
DEST :=$(ROOT)/dest
SUMMARY := $(ROOT)/summary.log
BUILD := $(ROOT)/build.log
-UNIT := $(ROOT)/unittent.log
-INTEGRATE := $(ROOT)/intergate.log
+UNIT := $(ROOT)/unittest.log
+INTEGRATE := $(ROOT)/integrate.log
+SWF := $(ROOT)/test
+INSTALL := $(ROOT)/install.log
define check_prog
@/bin/echo -n "checking $1 ... "
endef
define check_file
- /bin/echo -n "checking $1 ... "; \
+ (/bin/echo -n "$1 ... "; \
if test -e $1; then \
/bin/echo "ok"; \
else \
/bin/echo "not found"; \
- exit 1; \
- fi
+ fi)
endef
# ------------------------------
-.PHONY: check build unit integrate swf web all code clean
+.PHONY: check build build__ unit unit__ integrate integrate__ install install__ swf swf__ web all code clean
-all : web
+all : code build unittest integrate install swf web twitter
check:
$(call check_prog,git)
$(call check_prog,avmplus)
$(call check_prog,swfmill)
-code: $(SRC)
-
-$(SRC):
+code:
rm -rf $(SRC)
git clone --depth 1 git://github.com/mzp/scheme-abc.git $(SRC)
-build: check $(SRC)
- cd $(SRC) && \
- git clean -fx && \
- omake config PREFIX=$(DEST) && \
+build: check
+ $(MAKE) -f $(ROOT)/Makefile --directory=$(SRC) build__ ROOT=$(ROOT)
+
+build__:
+ git clean -fx
+ omake config PREFIX=$(DEST)
omake all | tee $(BUILD)
-unit: build
- cd $(SRC) && \
- omake check-detail && \
+unit__:
+ omake check-detail
mv unittest.log $(UNIT)
-integrate: build
- cd $(SRC) && \
- omake integrate && \
+unit:
+ $(MAKE) -f $(ROOT)/Makefile --directory=$(SRC) unit__ ROOT=$(ROOT)
+
+
+integrate:
+ $(MAKE) -f $(ROOT)/Makefile --directory=$(SRC) integrate__ ROOT=$(ROOT)
+integrate__:
+ omake integrate-detail
mv integrate.log $(INTEGRATE)
-swf: check
- cd $(SRC) && \
- omake install && \
- $(call check_file,$(DEST)/bin/habc) | tee swf.log ; \
- $(call check_file,$(DEST)/bin/habc-scm) | tee swf.log ; \
- $(call check_file,$(DEST)/bin/habc-xml) | tee swf.log ; \
- $(call check_file,$(DEST)/lib/habc/std.ho) | tee swf.log ; \
- $(call check_file,$(DEST)/lib/habc/stub.stub.ho) | tee swf.log ; \
- $(call check_file,$(DEST)/lib/habc/flash.stub.ho) | tee swf.log; \
- $(call check_file,$(DEST)/share/template.xml) | tee swf.log; \
- $(call check_file,$(DEST)/share/example) | tee swf.log
+install:
+ cd $(SRC) && omake install
+ $(MAKE) -f $(ROOT)/Makefile --directory=$(DEST) install__ ROOT=$(ROOT)
+
+install__:
+ $(call check_file,bin/habc) | tee $(INSTALL)
+ $(call check_file,bin/habc-scm) | tee -a $(INSTALL)
+ $(call check_file,bin/habc-xml) | tee -a $(INSTALL)
+ $(call check_file,lib/habc/std.ho) | tee -a $(INSTALL)
+ $(call check_file,lib/habc/stub.stub.ho) | tee -a $(INSTALL)
+ $(call check_file,lib/habc/flash.stub.ho) | tee -a $(INSTALL)
+ $(call check_file,share/habc/template.xml) | tee -a $(INSTALL)
+ $(call check_file,share/habc/example) | tee -a $(INSTALL)
+
+swf:
+ $(MAKE) -f $(ROOT)/Makefile --directory=$(DEST)/share/habc/example swf__ ROOT=$(ROOT)
+
+swf__:
+ $(DEST)/bin/habc binaryClock.scm -o $(SWF)
+
+web:
+ ruby makeweb.rb > /var/www/vhosts/happyabc/htdocs/snapshot.html
-web: unit integrate swf
+twitter:
+ grep -i 'fail\|error' *.log && twtr up -m '@mzp hey! Something wrong! see http://happyabc.org/snapshot.html'
clean:
rm -rf $(SRC)
rm -rf $(DEST)
- rm -f *.log
\ No newline at end of file
+ rm -f *.log *.swf
\ No newline at end of file
+++ /dev/null
-#!/bin/sh
-
-# ------------------------------
-# config
-# ------------------------------
-dest=$PWD/dest
-src=$PWD/src
-
-# ------------------------------
-# function
-# ------------------------------
-function check(){
- cmd=$1
- /bin/echo -n "cheking $1 ... "
- if which $1 > /dev/null; then
- /bin/echo "ok"
- else
- /bin/echo "not found"
- exit 1
- fi
-}
-
-function exists(){
- /bin/echo -n "check $1 ... "
- if [[ -e $1 ]]; then
- echo "ok"
- else
- echo "not found"
- exit 1
- fi
-}
-
-trap 'exit 1' 2
-
-echo ------------------------------
-echo cleanup
-echo ------------------------------
-rm -rf $dest
-rm -f summary.log
-rm -f unittest.log
-rm -f integrate.log
-rm -f build.log
-
-echo ------------------------------
-echo check
-echo ------------------------------
-check git
-check ocaml
-check ocamlfind
-check omake
-check avmplus
-check swfmill
-
-echo ------------------------------
-echo check out
-echo ------------------------------
-if [[ $SKIP -ne 1 ]]; then
- rm -rf $src
- git clone --depth 1 git://github.com/mzp/scheme-abc.git $src
- cd $src
-else
- cd $src
- echo "pull"
- git pull
-fi
-
-echo ------------------------------
-echo build
-echo ------------------------------
-git clean -fx
-omake config PREFIX=$dest
-omake all
-echo "build:$?" >> summary.log
-
-echo ------------------------------
-echo unit test
-echo ------------------------------
-omake check-detail
-echo "unittest:$?" >> summary.log
-mv unittest.log ..
-
-echo ------------------------------
-echo integrate test
-echo ------------------------------
-omake integrate
-echo "integrate:$?" >> summary.log
-mv integrate.log ..
-
-echo ------------------------------
-echo swf test
-echo ------------------------------
-omake install
-
-cd $dest
-exists bin/habc | tee swf.log
-exists bin/habc-scm | tee -a swf.log
-exists bin/habc-xml | tee -a swf.log
-exists bin/habc-xml | tee -a swf.log
-
-exists lib/habc/std.ho | tee -a swf.log
-exists lib/habc/stub.stub.ho | tee -a swf.log
-exists lib/habc/flash.stub.ho | tee -a swf.log
-
-echo ------------------------------
-echo make webpage
-echo ------------------------------
--- /dev/null
+#! /opt/local/bin/ruby -w
+# -*- mode:ruby; coding:utf-8 -*-
+require 'erb'
+require 'pp'
+
+Result = Struct.new 'Result',:entry,:ok
+
+def sep_by_dot(log)
+ File.open(log).map do|line|
+ entry,value=line.split '...',2
+ if entry != nil and value != nil
+ Result.new(entry.strip,value.strip.downcase == 'ok')
+ else
+ []
+ end
+ end.flatten
+end
+
+def summary(xs)
+ xs.all?{|x| x.ok}
+end
+
+def b(x)
+ if x then "OK" else "FAIL" end
+end
+
+def cell(entry,b)
+ %(<tr class="#{b ? 'ok' : 'fail'}">
+ <td>#{entry}</td>
+ <td>#{b ? 'OK' : 'FAIL'}</td>
+ </tr>)
+
+end
+
+content = File.open('template.erb').read
+@build = File.read('build.log')
+@unit_test = sep_by_dot('unittest.log')
+@integrate_test = sep_by_dot('integrate.log')
+@install_test = sep_by_dot('install.log')
+ERB.new(content).run
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC
+ "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
+<head>
+ <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
+ <link href="/style.css" type="text/css" rel="stylesheet" />
+ <title>DailyBuild - Happy ABC</title>
+ <style>
+ .ok{ background-color:green; }
+ .fail{ background-color:red; }
+ </style>
+</head>
+<body id="happyabc.org">
+ <h1>DailyBuild</h1>
+ <h2>Summary</h2>
+ <p><%= Time.now %></p>
+ <table>
+ <%= cell 'Unit Test', summary(@unit_test) %>
+ <%= cell 'Integrate Test', summary(@integrate_test) %>
+ <%= cell 'Install Test', summary(@install_test) %>
+ </table>
+
+ <h2>Build Test</h2>
+ <pre><%= @build %></pre>
+
+ <h2>Swf Test</h2>
+ <embed src="test.swf" width="200" play="true" loop="true" quality="high" pluginspage="http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" />
+
+ <h2>Unit Test</h2>
+ <table>
+ <% @unit_test.each do|t| %>
+ <%= cell t.entry,t.ok %>
+ <% end %>
+ </table>
+
+ <h2>Integrate Test</h2>
+ <table>
+ <% @integrate_test.each do|t| %>
+ <%= cell t.entry,t.ok %>
+ <% end %>
+ </table>
+
+ <h2>Install Test</h2>
+ <table>
+ <% @install_test.each do|t| %>
+ <%= cell t.entry,t.ok %>
+ <% end %>
+ </table>
+
+</body>
+</html>
+