Code Duplication    Length = 22-30 lines in 2 locations

gulpfile.js 2 locations

@@ 471-500 (lines=30) @@
468
		require('rimraf').sync(dist + 'rainloop/v/' + versionFull + '/app/libraries/RainLoop/Providers/Prem.php');
469
	}
470
471
	cfg.destPath = cfg.releasesPath + '/webmail/' + versionFull + '/';
472
	cfg.cleanPath = dist;
473
	cfg.zipSrcPath = dist;
474
	cfg.zipFile = 'rainloop-' + (cfg.community ? 'community-' : '') + versionFull + '.zip';
475
	cfg.zipFileShort = 'rainloop-' + (cfg.community ? 'community-' : '') + 'latest.zip';
476
477
	cfg.rainloopBuilded = true;
478
});
479
480
gulp.task('rainloop:zip', ['rainloop:copy', 'rainloop:setup'], function() {
481
	return (cfg.destPath && cfg.zipSrcPath && cfg.zipFile) ?
482
		zipDir(cfg.zipSrcPath, cfg.destPath, cfg.zipFile) : false;
483
});
484
485
gulp.task('rainloop:clean', ['rainloop:copy', 'rainloop:setup', 'rainloop:zip'], function() {
486
	return (cfg.cleanPath) ? cleanDir(cfg.cleanPath) : false;
487
});
488
489
gulp.task('rainloop:shortname', ['rainloop:zip'], function(callback) {
490
	copyFile(cfg.destPath + cfg.zipFile, cfg.destPath + cfg.zipFileShort, callback);
491
});
492
493
gulp.task('rainloop:copy-dist', ['rainloop:shortname'], function(callback) {
494
	var newPath = cfg.destPath.replace('build/dist/releases', 'dist/releases');
495
	fs.mkdirSync(newPath, '0777', true);
496
	copyFile(cfg.destPath + cfg.zipFile, newPath + cfg.zipFile, function() {
497
		copyFile(cfg.destPath + cfg.zipFileShort, newPath + cfg.zipFileShort, callback);
498
	});
499
});
500
501
// build (OwnCloud)
502
gulp.task('rainloop:owncloud:copy', function() {
503
@@ 552-573 (lines=22) @@
549
	fs.writeFileSync(dist + 'rainloop/appinfo/version', versionFull);
550
	fs.writeFileSync(dist + 'rainloop/VERSION', versionFull);
551
552
	cfg.destPath = cfg.releasesPath + '/owncloud/' + versionFull + '/';
553
	cfg.cleanPath = dist;
554
	cfg.zipSrcPath = dist;
555
	cfg.zipFile = 'rainloop-owncloud-app-' + (cfg.community ? '' : 'standard-') + versionFull + '.zip';
556
	cfg.zipFileShort = 'rainloop' + (cfg.community ? '' : '-standard') + '.zip';
557
});
558
559
gulp.task('rainloop:owncloud:zip', ['rainloop:owncloud:copy', 'rainloop:owncloud:setup'], function() {
560
	return (cfg.destPath && cfg.zipSrcPath && cfg.zipFile) ?
561
		zipDir(cfg.zipSrcPath, cfg.destPath, cfg.zipFile) : false;
562
});
563
564
gulp.task('rainloop:owncloud:clean', ['rainloop:owncloud:copy', 'rainloop:owncloud:setup', 'rainloop:owncloud:zip'], function() {
565
	return (cfg.cleanPath) ? cleanDir(cfg.cleanPath) : false;
566
});
567
568
gulp.task('rainloop:owncloud:shortname', ['rainloop:owncloud:zip'], function(callback) {
569
	copyFile(cfg.destPath + cfg.zipFile, cfg.destPath + cfg.zipFileShort, callback);
570
});
571
572
gulp.task('rainloop:owncloud:copy-dist', ['rainloop:owncloud:shortname'], function(callback) {
573
	var newPath = cfg.destPath.replace('build/dist/releases', 'dist/releases');
574
	fs.mkdirSync(newPath, '0777', true);
575
	copyFile(cfg.destPath + cfg.zipFile, newPath + cfg.zipFile, function() {
576
		copyFile(cfg.destPath + cfg.zipFileShort, newPath + cfg.zipFileShort, callback);