Skip to content

Commit

Permalink
Port the publish target to Gulp
Browse files Browse the repository at this point in the history
  • Loading branch information
timvandermeij committed Apr 27, 2016
1 parent 97b3a70 commit 5166b46
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
22 changes: 22 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var rimraf = require('rimraf');
var stream = require('stream');
var exec = require('child_process').exec;
var streamqueue = require('streamqueue');
var zip = require('gulp-zip');

var BUILD_DIR = 'build/';
var L10N_DIR = 'l10n/';
Expand Down Expand Up @@ -337,6 +338,27 @@ gulp.task('bundle', ['buildnumber'], function () {
return createBundle(DEFINES).pipe(gulp.dest(BUILD_DIR));
});

gulp.task('publish', ['generic'], function (done) {
var version = JSON.parse(
fs.readFileSync(BUILD_DIR + 'version.json').toString()).version;

config.stableVersion = config.betaVersion;
config.betaVersion = version;

createStringSource(CONFIG_FILE, JSON.stringify(config, null, 2))
.pipe(gulp.dest('.'))
.on('end', function () {
var targetName = 'pdfjs-' + version + '-dist.zip';
gulp.src(BUILD_DIR + 'generic/**')
.pipe(zip(targetName))
.pipe(gulp.dest(BUILD_DIR))
.on('end', function () {
console.log('Built distribution file: ' + targetName);
done();
});
});
});

gulp.task('server', function (done) {
console.log();
console.log('### Starting local server');
Expand Down
11 changes: 1 addition & 10 deletions make.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,16 +385,7 @@ target.dist = function() {
};

target.publish = function() {
target.generic();
var VERSION = getCurrentVersion();
config.stableVersion = config.betaVersion;
config.betaVersion = VERSION;
fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2));
cd(GENERIC_DIR);
var distFilename = 'pdfjs-' + VERSION + '-dist.zip';
exec('zip -r ' + ROOT_DIR + BUILD_DIR + distFilename + ' *');
echo('Built distribution file: ' + distFilename);
cd(ROOT_DIR);
exec('gulp publish');
};

//
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"devDependencies": {
"gulp": "^3.9.1",
"gulp-util": "^3.0.7",
"gulp-zip": "^3.2.0",
"jasmine-core": "^2.4.1",
"jsdoc": "^3.3.0-alpha9",
"jshint": "~2.8.0",
Expand Down

0 comments on commit 5166b46

Please sign in to comment.