diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..34a9d95 --- /dev/null +++ b/.gitignore @@ -0,0 +1,19 @@ +# generated by autotools +/aclocal.m4 +/autom4te.cache +/configure +/Makefile.in +/build-aux/ +!/build-aux/gen-index + +# generated by configure +/src/version.js +/config.* +/Makefile +/package.json + +# generated by gen-index +/src/**/index.js + +# npm +/node_modules diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..22219cf --- /dev/null +++ b/Makefile.am @@ -0,0 +1,37 @@ +## Automake script +# +# Copyright (C) 2015 Mike Gerwitz +# +# This file is part of LaserTank.js. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +## + +namespaces=$(shell find src -type d) +nsindex=$(addsuffix /index.js, $(namespaces)) + +.PHONY: FORCE + +all-am: modindex + +modindex: $(nsindex) +%/index.js: FORCE + ./build-aux/gen-index "$*" > "$@" + +test: check +check: + @PATH="$(PATH):$(CURDIR)/node_modules/mocha/bin" \ + mocha --recursive $(TESTARGS) + +FORCE: diff --git a/build-aux/gen-index b/build-aux/gen-index new file mode 100755 index 0000000..bbe166c --- /dev/null +++ b/build-aux/gen-index @@ -0,0 +1,45 @@ +#!/bin/bash +# Generates index.js from sources in destination directory +# +# Copyright (C) 2014 LoVullo Associates, Inc. +# Copyright (C) 2015 Mike Gerwitz +# +# This file is part of liza. It has been modified by Mike Gerwitz. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +## + +shopt -s extglob + +destpath="${1?Destination path required}" + +cat <. +## + +AC_INIT([lasertank-js], [0.0.0-dev], [mtg@gnu.org]) +AC_CONFIG_AUX_DIR([build-aux]) +AM_INIT_AUTOMAKE([foreign]) + +# provide more granular version numbers based on the above AC_INIT line +m4_define([ver_split], m4_split(m4_translit(AC_PACKAGE_VERSION, [-], [.]), [\.])) +AC_SUBST(MAJOR, m4_argn(1, ver_split)) +AC_SUBST(MINOR, m4_argn(2, ver_split)) +AC_SUBST(REV, m4_argn(3, ver_split)) +AC_SUBST(SUFFIX, m4_argn(4, ver_split)) + +# generate files from their *.in counterparts +AC_CONFIG_FILES([Makefile package.json src/version.js]) +AC_OUTPUT diff --git a/package.json.in b/package.json.in new file mode 100644 index 0000000..528f3ea --- /dev/null +++ b/package.json.in @@ -0,0 +1,37 @@ +{ + "name": "lasertank-js", + "description": "A faithful JavaScript clone of LaserTank", + "version": "@VERSION@", + "author": "Mike Gerwitz (https://mikegerwitz.com)", + "homepage": "https://mikegerwitz.com/", + + "repository": { + "type": "git", + "url": "https://gitlab.com/mikegerwitz/lasertank-js" + }, + + "engines": { + "node": ">0.0.0" + }, + + "dependencies": { + "easejs": ">=0.2.7" + }, + "devDependencies": { + "chai": ">=1.9.1", + "mocha": ">=1.18.2" + }, + + "licenses": [ + { + "type": "GPLv3+", + "url": "https://www.gnu.org/licenses/gpl.html" + } + ], + + "tags": [ + "game", + "lasertank", + "tile game" + ] +} diff --git a/src/version.js.in b/src/version.js.in new file mode 100644 index 0000000..94df6af --- /dev/null +++ b/src/version.js.in @@ -0,0 +1,41 @@ +/** + * Provides version information + * + * Copyright (C) 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc. + * + * This file is part of GNU ease.js. + * + * ease.js is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +var major = @MAJOR@, + minor = @MINOR@, + rev = @REV@, + suffix = '@SUFFIX@', + + version = [ major, minor, rev, suffix ]; + +version.major = major; +version.minor = minor; +version.rev = rev; +version.suffix = suffix; + +version.toString = function() +{ + return this.join( '.' ) + .replace( /\.([^.]+)$/, '-$1' ) + .replace( /-$/, '' ); +}; + +module.exports = version;