This repository has been archived by the owner on May 14, 2024. It is now read-only.
forked from ExLibrisGroup/primo-explore-devenv
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Revert "update gulp tasks to build code before package, as we…
…ll as slightly alter view selection options (ExLibrisGroup#77)"" This reverts commit c7d47fe.
- Loading branch information
Elliott Grieco
committed
Nov 30, 2018
1 parent
85c1483
commit 588e179
Showing
7 changed files
with
71 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,67 @@ | ||
'use strict'; | ||
var gulp = require('gulp'); | ||
let glob = require('glob'); | ||
let prompt = require('prompt'); | ||
let zip = require('gulp-zip'); | ||
let config = require('../config.js'); | ||
const gulp = require('gulp'); | ||
const glob = require('glob'); | ||
const prompt = require('prompt'); | ||
const zip = require('gulp-zip'); | ||
const config = require('../config.js'); | ||
|
||
let buildParams = config.buildParams; | ||
gulp.task('select-view', (cb) => { | ||
const basedir = 'primo-explore/custom/'; | ||
const customFolderExp = basedir + '*/'; | ||
const files = glob.sync(customFolderExp, {}); | ||
|
||
gulp.task('create-package', function () { | ||
var basedir = 'primo-explore/custom/'; | ||
var customFolderExp = basedir+'*/'; | ||
console.log('Please Choose a package to create:'); | ||
glob(customFolderExp, {}, function (er, files) { | ||
// Note elision, there is no member at 2 so it isn't visited | ||
console.log('\r\n'); | ||
files.forEach(function(element, index, array){ | ||
console.log(index+1 + ': '+ element.replace(basedir,'').replace('/','')); | ||
console.log('\r\n'); | ||
}); | ||
prompt.start(); | ||
var property = { | ||
name: 'package', | ||
message: 'Please Choose the level you want to create the package for' | ||
}; | ||
prompt.get(property, function (err, result) { | ||
return new Promise(resolve => { | ||
if (!config.view()) { | ||
console.log('Please Choose a view to use:\r\n'); | ||
files.forEach(function(element, index, array){ | ||
console.log(index+1 + ': '+ element.replace(basedir,'').replace('/','')); | ||
console.log('\r\n'); | ||
}); | ||
|
||
console.log('\r\n'); | ||
var code = result.package; | ||
prompt.start(); | ||
const property = { | ||
name: 'view', | ||
message: 'Please Choose view to use' | ||
}; | ||
prompt.get(property, function (err, result) { | ||
console.log('\r\n'); | ||
let code = result.view; | ||
|
||
if(files[result.package - 1]){ | ||
code = files[result.package - 1].replace(basedir,'').replace('/',''); | ||
if(files[result.view - 1]){ | ||
code = files[result.view - 1].replace(basedir,'').replace('/',''); | ||
} | ||
config.setView(code); | ||
resolve(); | ||
}); | ||
} else { | ||
let valid = false | ||
for (let index in files) { | ||
let dir = files[index].replace(basedir,'').replace('/','') | ||
|
||
if(dir === config.view()) { | ||
valid = true | ||
break; | ||
} | ||
} | ||
console.log('Creating package for : ('+code+'.zip)'); | ||
console.log(code); | ||
console.log(' in : /packages'); | ||
console.log('\r\n'); | ||
console.log('............................................................................................................................................'); | ||
return gulp.src(['./primo-explore/custom/'+code,'./primo-explore/custom/'+code+'/html/**','./primo-explore/custom/'+code+'/img/**','./primo-explore/custom/'+code+'/css/custom1.css','./primo-explore/custom/'+code+'/js/custom.js'], {base: './primo-explore/custom'}) | ||
.pipe(zip(code+'.zip')) | ||
.pipe(gulp.dest('./packages/')); | ||
}); | ||
|
||
if (!valid) { | ||
resolve() | ||
cb("--view must be a valid view") | ||
} else { | ||
resolve() | ||
} | ||
} | ||
}) | ||
}) | ||
|
||
gulp.task('create-package', ['select-view', 'custom-js','custom-scss','custom-css'], function () { | ||
const code = config.view(); | ||
console.log('Creating package for : ('+code+'.zip)'); | ||
console.log(code); | ||
console.log(' in : /packages'); | ||
console.log('\r\n'); | ||
console.log('............................................................................................................................................'); | ||
return gulp.src(['./primo-explore/custom/'+code,'./primo-explore/custom/'+code+'/html/**','./primo-explore/custom/'+code+'/img/**','./primo-explore/custom/'+code+'/css/custom1.css','./primo-explore/custom/'+code+'/js/custom.js'], {base: './primo-explore/custom'}) | ||
.pipe(zip(code+'.zip')) | ||
.pipe(gulp.dest('./packages/')); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters