Added UUIDs to timestamps, refactored the build process

* Added UUIDs to `ts_entry` records. Updated `ts_json:construct_record` to
  respond to `uuid` member properties if present. UUIDs are not required by the
  strict parsing functions in `ts_json` because the client will make a request
  with no UUID if it is a purely new timestamp. IN fact, this is the normal
  case. The UUID is only present when another tool is syncing its copy of this
  timeline wand adding entries that it has created and assigned UUIDs to.
* `ts_entry:new` will create a UUID for a new entry if it does not already have
  one.
* Restructured the build process to put all build artifacts into a dedicated
  `build` subdirectory, instead of mising them in an amongst the source code.
* Added the `uuid` module to the project. It can be found at

      https://gitorious.org/avtobiff/erlang-uuid

* Rewrote asset URLs to use relative paths instead of absolute paths. Relative
  paths are correct in this case, becuase assets always live alongside the HTML
  pages. This change was needed to accomodate the new organization of the JDB
  Labs dev environment, where all projects live under subdirectories of the
  same virtual server instead of subdomains.
* Tweaked the timestamp entry fields in the web UI to save when the field is
  blurred, not just when <Enter> or <Ctrl>-<Enter> is pressed (though those
  still work).
This commit is contained in:
Jonathan Bernard
2013-10-11 20:06:31 +00:00
parent 9b357359b6
commit 98032e2b89
8 changed files with 77 additions and 63 deletions

View File

@ -1,11 +1,11 @@
MODS = $(wildcard src/*.erl)
BEAMS = $(MODS:src/%.erl=ebin/%.beam)
BEAMS = $(MODS:src/%.erl=build/ebin/%.beam)
TEST_MODS = $(wildcard test/*.erl)
TEST_BEAMS = $(TEST_MODS:test/%.erl=test/%.beam)
TEST_BEAMS = $(TEST_MODS:test/%.erl=build/test/%.beam)
TS_ROOT=/usr/local/var/yaws/jdb-labs.com/timestamper
CWD = `pwd`
default: compile
default: build
all : compile test
@ -17,10 +17,10 @@ test : start-test-server run-test stop-test-server
test-shell : compile compile-test config-yaws-dev
@echo Starting an interactive YAWS shell with test paths loaded.
@yaws -i --pa test --id test_inst
@yaws -i --pa build/ebin --pa build/test --id test_inst
run-test : compile compile-test config-yaws-dev
@erl -pa ./ebin -pa ./test -run timestamper_api_tests test -run init stop -noshell
@erl -pa ./build/ebin -pa ./build/test -run timestamper_api_tests test -run init stop -noshell
start-test-server :
@yaws -D --id test_inst
@ -29,28 +29,30 @@ stop-test-server :
@yaws --stop --id test_inst
clean:
rm -rf ebin/* erl_crash.dump test/*.beam
rm -rf build
init:
-mkdir ebin
-mkdir -p build/ebin
ebin/%.beam : src/%.erl
erlc -W -o ebin $<
build/ebin/%.beam : src/%.erl
erlc -W -o build/ebin $<
test/%.beam : test/%.erl
build/test/%.beam : test/%.erl
@echo Compiling sources...
erlc -W -o test $<
erlc -W -o build/test $<
build: compile
-mkdir -p build/include
cp -r www build
cp lib/* build/ebin
cp src/ts_db_records.hrl build/include
cp yaws.prod.conf build/yaws.conf
deploy: compile
@service yaws stop
@echo Removing existing artifacts.
- @rm -r $(TS_ROOT)
@echo Copying current artifacts.
@mkdir -p $(TS_ROOT)
@cp -r www $(TS_ROOT)
@cp -r ebin $(TS_ROOT)
@mkdir $(TS_ROOT)/include
@cp -r src/ts_db_records.hrl $(TS_ROOT)/include/.
@cp yaws.prod.conf $(TS_ROOT)/yaws.conf
@cp -r build $(TS_ROOT)
@service yaws start
@echo Done.