Skip to content

Commit

Permalink
changed naming approach for prerelease versions
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed Sep 3, 2016
1 parent 3883981 commit 83ae546
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
17 changes: 12 additions & 5 deletions Gulpfile.js
Expand Up @@ -87,11 +87,11 @@ gulp.task('release:push:docs', function(callback) {
});

gulp.task('build:dev', function() {
return build(extend(extend({}, pkg), { version: 'dev' }));
return build(extend(extend({}, pkg), { version: pkg.version + '-dev' }));
});

gulp.task('build:edge', function() {
return build(extend(extend({}, pkg), { version: 'master' }));
return build(extend(extend({}, pkg), { version: pkg.version + '-alpha' }));
});

gulp.task('build:release', function() {
Expand All @@ -113,7 +113,14 @@ gulp.task('watch', function() {

var bundle = function() {
gutil.log('Updated bundle build/matter-dev.js');
b.bundle().pipe(fs.createWriteStream('build/matter-dev.js'));
b.bundle()
.pipe(through2({ objectMode: true }, function(chunk, encoding, callback) {
return callback(
null,
chunk.toString().replace(/@@VERSION@@/g, pkg.version + '-dev')
);
}))
.pipe(fs.createWriteStream('build/matter-dev.js'));
};

b.on('update', bundle);
Expand Down Expand Up @@ -243,7 +250,7 @@ var build = function(options) {
gutil.log('Building', filename, options.date);

var compiled = gulp.src(['src/module/main.js'])
.pipe(replace("version = 'master'", "version = '" + options.version + "'"))
.pipe(replace('@@VERSION@@', options.version))
.pipe(through2.obj(function(file, enc, next){
browserify(file.path, { standalone: 'Matter' })
.bundle(function(err, res){
Expand All @@ -252,7 +259,7 @@ var build = function(options) {
});
}));

if (options.version !== 'dev') {
if (!options.version.includes('-')) {
compiled.pipe(preprocess({ context: { DEBUG: false } }));
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/Matter.js
Expand Up @@ -26,7 +26,7 @@ var Plugin = require('./Plugin');
* @readOnly
* @type {String}
*/
Matter.version = 'master';
Matter.version = '@@VERSION@@';

/**
* A list of plugin dependencies to be installed. These are normally set and installed through `Matter.use`.
Expand Down

0 comments on commit 83ae546

Please sign in to comment.