Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Created version module to provide additional version information

  • Loading branch information...
commit 958521f67302b1673c42dbbea78efff54df5878d 1 parent 4627958
@mikegerwitz authored
View
2  index.js
@@ -25,5 +25,5 @@ exports.Class = require( __dirname + '/lib/class' );
exports.AbstractClass = require( __dirname + '/lib/class_abstract' );
exports.FinalClass = require( __dirname + '/lib/class_final' );
exports.Interface = require( __dirname + '/lib/interface' );
-exports.version = '0.1.0';
+exports.version = require( __dirname + '/lib/version' );
View
39 lib/version.js
@@ -0,0 +1,39 @@
+/**
+ * Provides version information
+ *
+ * Copyright (C) 2010,2011 Mike Gerwitz
+ *
+ * This file is part of ease.js.
+ *
+ * ease.js is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser 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 Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @author Mike Gerwitz
+ */
+
+var major = 0,
+ minor = 1,
+ rev = 0,
+
+ version = [ major, minor, rev ];
+
+version.major = major;
+version.minor = minor;
+version.rev = rev;
+
+version.toString = function()
+{
+ return this.join( '.' );
+};
+
+module.exports = version;
View
70 test/VersionTest.js
@@ -0,0 +1,70 @@
+/**
+ * Tests version.js
+ *
+ * Copyright (C) 2010,2011 Mike Gerwitz
+ *
+ * This file is part of ease.js.
+ *
+ * ease.js is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser 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 Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @author Mike Gerwitz
+ */
+
+require( 'common' ).testCase(
+{
+ caseSetUp: function()
+ {
+ this.version = this.require( 'version' );
+ },
+
+
+ 'Can retrieve major version number': function()
+ {
+ this.assertOk( typeof this.version.major === 'number',
+ 'Major version number should be available'
+ );
+ },
+
+
+ 'Can retrieve minor version number': function()
+ {
+ this.assertOk( typeof this.version.minor === 'number',
+ 'Minor version number should be available'
+ );
+ },
+
+
+ 'Can retrieve revision version number': function()
+ {
+ this.assertOk( typeof this.version.rev === 'number',
+ 'Revision version number should be available'
+ );
+ },
+
+
+ 'Array of version numbers is available': function()
+ {
+ this.assertEqual( this.version.major, this.version[ 0 ] );
+ this.assertEqual( this.version.minor, this.version[ 1 ] );
+ this.assertEqual( this.version.rev, this.version[ 2 ] );
+ },
+
+
+ 'Version string is available': function()
+ {
+ this.assertEqual( this.version.join( '.' ), this.version.toString(),
+ 'Version string should be made available'
+ );
+ },
+} );
View
4 test/test-index.js
@@ -28,6 +28,7 @@ var common = require( './common' ),
AbstractClass = common.require( 'class_abstract' ),
FinalClass = common.require( 'class_final' ),
Interface = common.require( 'interface' ),
+ version = common.require( 'version' ),
index = require( '../' );
@@ -52,8 +53,7 @@ assert.ok(
"Interface should be made available"
);
-assert.ok(
- ( typeof index.version === 'string' ),
+assert.ok( ( index.version === version ),
"Version information should be exported"
);
View
2  tools/combine.tpl
@@ -63,6 +63,6 @@ var easejs = {};
ns_exports.AbstractClass = module['class_abstract'].exports;
ns_exports.FinalClass = module['class_final'].exports;
ns_exports.Interface = module['interface'].exports;
- ns_exports.version = '0.1.0';
+ ns_exports.version = module['version'].exports;
} )( easejs );
Please sign in to comment.
Something went wrong with that request. Please try again.