Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--configure.ac9
-rw-r--r--index.js7
-rw-r--r--src/version.js.in43
4 files changed, 56 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index 0a5fe12..85310f7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@ configure
Makefile.in
# generated by configure
+src/version.js
config.*
Makefile
package.json
diff --git a/configure.ac b/configure.ac
index 6b40a60..9024783 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,6 +22,13 @@ AC_INIT([liza], [0.0.1-dev], [dev@lovullo.com])
AC_CONFIG_AUX_DIR([tools])
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 doc/Makefile package.json])
+AC_CONFIG_FILES([Makefile doc/Makefile package.json src/version.js])
AC_OUTPUT
diff --git a/index.js b/index.js
index 58d93d7..184680a 100644
--- a/index.js
+++ b/index.js
@@ -19,8 +19,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-// as soon as we have something to export, this will be replaced with a
-// module.exports line containing an object that itself contains classes
+// as soon as we have something useful to export, this will contain classes
// that represent common, viable entry points for the framework (e.g.
// facades).
-throw Error( "You're too early! Check back soon." );
+module.exports = {
+ version: require( __dirname + '/src/version' )
+};
diff --git a/src/version.js.in b/src/version.js.in
new file mode 100644
index 0000000..1bd6487
--- /dev/null
+++ b/src/version.js.in
@@ -0,0 +1,43 @@
+/**
+ * Provides version information
+ *
+ * Copyright (C) 2014 LoVullo Associates, Inc.
+ *
+ * This file is part of liza.
+ *
+ * liza 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 <http://www.gnu.org/licenses/>.
+ *
+ * Taken from GNU ease.js.
+ */
+
+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;