Skip to content

Commit f04da9c

Browse files
authored
Merge pull request #2721 from tilemill-project/dev
Update to how the unique version is created and tested
2 parents 37701a4 + 9708642 commit f04da9c

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

commands/core.bones

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ command.prototype.bootstrap = function(plugin, callback) {
101101
cartoRef.setVersion(mapnik.versions.mapnik);
102102

103103
Bones.plugin.abilities = {
104+
// Get the unique version (from the VERSION file) that will be used in the parens in the heading
105+
// of the project settings page.
104106
version: (function() {
105107
try {
106108
return _(fs.readFileSync(path.resolve(__dirname + '/../VERSION'),'utf8').split('\n')).compact();

lib/gitutil.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Create the VERSION file which will be read by commands/core.bones to populate the unique version
2+
// in the heading of the project settings page.
13
var exec = require('child_process').exec;
24
var fs = require('fs');
35
var package_json = require('../package.json');
@@ -9,8 +11,8 @@ var child = exec('git describe --tags --always',
911
} else {
1012
var hash = stdout;
1113
if (hash[0] == 'v') {
12-
// git describe actually found a tag
13-
var version_file = hash + hash.slice(1, -10).replace('-', '.') + '\n';
14+
//var version_file = hash + hash.slice(1, -10).replace('-', '.') + '\n';
15+
var version_file = hash;
1416
fs.writeFileSync('VERSION', version_file);
1517
} else {
1618
// no tag found likely due to shallow clone (--depth=N)

test/abilities.test.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ it('GET should return JSON', function(done) {
2525
function(res) {
2626
var body = res.body.replace(/^\s*var\s+abilities\s*=\s*(.+?);?$/, '$1');
2727
var abilities = JSON.parse(body);
28-
// travis does a shallow clone so the git version and hash will
29-
// not be known, which is harmless
28+
// travis does a shallow clone so the git version and hash will not be known, which is harmless
3029
if (!process.env.TRAVIS && !process.env.APPVEYOR) {
31-
assert.ok(/v\d+.\d+.\d+-\d+-[a-z0-9]+/.test(abilities.version[0]),abilities.version[0]);
32-
assert.ok(/\d+.\d+.\d+.\d+/.test(abilities.version[1]),abilities.version[1]);
30+
// Checking to see if the unique version from the VERSION file is there. It is used
31+
// to put the unique version (in parens) into the header of the project settings page.
32+
assert.ok(/v\d+.\d+.\d+.*/.test(abilities.version[0]),abilities.version[0]);
33+
// Removed the second version from gitutils.js since it is never used.
34+
//assert.ok(/\d+.\d+.\d+.\d+/.test(abilities.version[1]),abilities.version[1]);
3335
}
3436
assert.ok(abilities.fonts.indexOf('Arial Regular') >= 0 ||
3537
abilities.fonts.indexOf('DejaVu Sans Book') >= 0);

0 commit comments

Comments
 (0)