@@ -55,7 +55,7 @@ function promisedSpawn( args, options ) {
5555 let ret = '' ;
5656 let err = '' ;
5757 if ( opts . verbose ) {
58- console . log ( `# RUNNING: ${ args . join ( ' ' ) } \n (in ${ process . cwd ( ) } )` ) ;
58+ console . log ( `# RUNNING: ${ args . join ( ' ' ) } \n (in ${ process . cwd ( ) } )` ) ;
5959 }
6060 child = spawn ( '/usr/bin/env' , args , argOpts ) ;
6161 if ( options . capture ) {
@@ -87,11 +87,11 @@ function promisedSpawn( args, options ) {
8787 if ( options . useErrHandler || options . errMessage ) {
8888 promise = promise . catch ( ( err ) => {
8989 if ( options . errMessage ) {
90- console . error ( `ERROR: ${ options . errMessage . split ( '\n' ) . join ( '\nERROR: ' ) } ` ) ;
90+ console . error ( `ERROR: ${ options . errMessage . split ( '\n' ) . join ( '\nERROR: ' ) } ` ) ;
9191 }
92- let msg = `ERROR: ${ args . slice ( 0 , 2 ) . join ( ' ' ) } exited with code ${ err . code } ` ;
92+ let msg = `ERROR: ${ args . slice ( 0 , 2 ) . join ( ' ' ) } exited with code ${ err . code } ` ;
9393 if ( err . message ) {
94- msg += ` and message ${ err . message } ` ;
94+ msg += ` and message ${ err . message } ` ;
9595 }
9696 console . error ( msg ) ;
9797 process . exit ( err . code ) ;
@@ -153,7 +153,7 @@ function createDockerFile() {
153153 // set the deploy target
154154 // allow the user to specify the exact target to use, like "debian:sid"
155155 const baseImg = / ^ .+ : .+ $ / . test ( pkg . deploy . target ) ? pkg . deploy . target : targets [ pkg . deploy . target ] ;
156- let contents = `FROM ${ baseImg } \n` ;
156+ let contents = `FROM ${ baseImg } \n` ;
157157
158158 if ( ! baseImg || baseImg === '' ) {
159159 console . error ( 'ERROR: You must specify a valid target!' ) ;
@@ -172,13 +172,13 @@ function createDockerFile() {
172172 if ( pkg . uri ) {
173173 debPkgs . push ( pkg . uri ) ;
174174 } else if ( ! pkg . repo_url || ! pkg . pool || ! pkg . packages || ! pkg . release ) {
175- console . error ( `ERROR: Incorrect dependency spec: ${ JSON . stringify ( pkg ) } ` ) ;
175+ console . error ( `ERROR: Incorrect dependency spec: ${ JSON . stringify ( pkg ) } ` ) ;
176176 process . exit ( 1 ) ;
177177 } else {
178178 customSourcePkgs . push ( pkg ) ;
179179 }
180180 } else {
181- console . error ( `ERROR: Incorrect dependency spec: ${ pkg } ` ) ;
181+ console . error ( `ERROR: Incorrect dependency spec: ${ pkg } ` ) ;
182182 process . exit ( 1 ) ;
183183 }
184184 } ) ;
@@ -189,67 +189,67 @@ function createDockerFile() {
189189 extraPkgs . push ( 'apt-transport-https' ) ;
190190 }
191191
192- contents += `RUN apt-get update && apt-get install -y ${ extraPkgs . join ( ' ' ) } && rm -rf /var/lib/apt/lists/*\n` ; /**/
192+ contents += `RUN apt-get update && apt-get install -y ${ extraPkgs . join ( ' ' ) } && rm -rf /var/lib/apt/lists/*\n` ; /**/
193193
194194 if ( customSourcePkgs . length ) {
195- contents += `RUN echo > /etc/apt/sources.list && ${ customSourcePkgs . map ( ( customSourcePkgSpec ) =>
196- `echo deb "${ customSourcePkgSpec . repo_url } ${ customSourcePkgSpec . release } ${ customSourcePkgSpec . pool } " >> /etc/apt/sources.list` ) . join ( ' && ' ) } \n`;
197- contents += `RUN apt-get update && ${ customSourcePkgs . map ( ( customSourcePkgSpec ) => `apt-get install -y --force-yes -t ${ customSourcePkgSpec . release } ${ customSourcePkgSpec . packages . join ( ' ' ) } ` ) . join ( ' && ' ) } && rm -rf /var/lib/apt/lists/*\n` ; /**/
195+ contents += `RUN echo > /etc/apt/sources.list && ${ customSourcePkgs . map ( ( customSourcePkgSpec ) =>
196+ `echo deb "${ customSourcePkgSpec . repo_url } ${ customSourcePkgSpec . release } ${ customSourcePkgSpec . pool } " >> /etc/apt/sources.list` ) . join ( ' && ' ) } \n`;
197+ contents += `RUN apt-get update && ${ customSourcePkgs . map ( ( customSourcePkgSpec ) => `apt-get install -y --force-yes -t ${ customSourcePkgSpec . release } ${ customSourcePkgSpec . packages . join ( ' ' ) } ` ) . join ( ' && ' ) } && rm -rf /var/lib/apt/lists/*\n` ; /**/
198198 }
199199
200200 if ( debPkgs . length ) {
201- contents += `RUN ${ debPkgs . map ( ( uri ) => `wget ${ uri } -O package.deb && dpkg -i package.deb && rm package.deb` ) . join ( ' && ' ) } \n` ;
201+ contents += `RUN ${ debPkgs . map ( ( uri ) => `wget ${ uri } -O package.deb && dpkg -i package.deb && rm package.deb` ) . join ( ' && ' ) } \n` ;
202202 }
203203
204204 let npmCommand = 'npm' ;
205205 if ( nodeVersion !== 'system' ) {
206206 const nvmDownloadURI = 'https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh' ;
207207 contents += 'RUN mkdir -p /usr/local/nvm\n' ;
208208 contents += 'ENV NVM_DIR /usr/local/nvm\n' ;
209- contents += `RUN wget -qO- ${ nvmDownloadURI } | bash && . $NVM_DIR/nvm.sh && nvm install ${ nodeVersion } \n` ;
210- npmCommand = `. $NVM_DIR/nvm.sh && nvm use ${ nodeVersion } && npm` ;
209+ contents += `RUN wget -qO- ${ nvmDownloadURI } | bash && . $NVM_DIR/nvm.sh && nvm install ${ nodeVersion } \n` ;
210+ npmCommand = `. $NVM_DIR/nvm.sh && nvm use ${ nodeVersion } && npm` ;
211211 }
212212
213213 if ( ! opts . deploy ) {
214- contents += `RUN mkdir /opt/service\nADD . /opt/service\nWORKDIR /opt/service\nRUN ${ npmCommand } install && npm dedupe\n` ;
214+ contents += `RUN mkdir /opt/service\nADD . /opt/service\nWORKDIR /opt/service\nRUN ${ npmCommand } install && npm dedupe\n` ;
215215 }
216216
217217 if ( opts . uid !== 0 &&
218218 // In 'Docker for Mac' the mapping between users/groups
219219 // is done internally by docker, so we can run as root
220220 os . type ( ) !== 'Darwin' ) {
221- contents += `RUN groupadd -o -g ${ opts . gid } -r rungroup && useradd -o -m -r -g rungroup -u ${ opts . uid } runuser\nUSER runuser\nENV HOME=/home/runuser LINK=g++\n` ;
221+ contents += `RUN groupadd -o -g ${ opts . gid } -r rungroup && useradd -o -m -r -g rungroup -u ${ opts . uid } runuser\nUSER runuser\nENV HOME=/home/runuser LINK=g++\n` ;
222222 } else {
223223 contents += 'ENV HOME=/root/ LINK=g++\n' ;
224224 }
225225
226226 let envCommand = 'ENV IN_DOCKER=1' ;
227227 if ( pkg . deploy . env && Object . keys ( pkg . deploy . env ) ) {
228228 Object . keys ( pkg . deploy . env ) . forEach ( ( envVar ) => {
229- envCommand += ` ${ envVar } ="${ pkg . deploy . env [ envVar ] } "` ;
229+ envCommand += ` ${ envVar } ="${ pkg . deploy . env [ envVar ] } "` ;
230230 } ) ;
231231 }
232- contents += `${ envCommand } \n` ;
232+ contents += `${ envCommand } \n` ;
233233
234234 if ( opts . deploy ) {
235235 let beforeInstall = '' ;
236236 let afterInstall = '' ;
237237 if ( npmVersion ) {
238- beforeInstall += `${ npmCommand } install npm@${ npmVersion } &&` ;
238+ beforeInstall += `${ npmCommand } install npm@${ npmVersion } &&` ;
239239 npmCommand = './node_modules/.bin/npm' ;
240240 afterInstall = '&& rm -rf ./node_modules/npm ./node_modules/.bin/npm' ;
241241 }
242242 let installOpts = ' --production ' ;
243243 if ( pkg . deploy . install_opts ) {
244- installOpts += `${ pkg . deploy . install_opts . join ( ' ' ) } ` ;
244+ installOpts += `${ pkg . deploy . install_opts . join ( ' ' ) } ` ;
245245 }
246- contents += `CMD ${ beforeInstall } ${ npmCommand } install${ installOpts } ${ afterInstall } ` ;
246+ contents += `CMD ${ beforeInstall } ${ npmCommand } install${ installOpts } ${ afterInstall } ` ;
247247 } else if ( opts . tests ) {
248- contents += `CMD ${ npmCommand } test` ;
248+ contents += `CMD ${ npmCommand } test` ;
249249 } else if ( opts . coverage ) {
250- contents += `CMD ${ npmCommand } run-script coverage` ;
250+ contents += `CMD ${ npmCommand } run-script coverage` ;
251251 } else {
252- contents += `CMD ${ npmCommand } start` ;
252+ contents += `CMD ${ npmCommand } start` ;
253253 }
254254
255255 return fs . writeFileAsync ( 'Dockerfile' , contents ) ;
@@ -289,7 +289,7 @@ function startContainer( args, hidePorts ) {
289289 config . services . forEach ( ( srv ) => {
290290 srv . conf = srv . conf || { } ;
291291 srv . conf . port = srv . conf . port || 8888 ;
292- cmd . push ( '-p' , `${ srv . conf . port } :${ srv . conf . port } ` ) ;
292+ cmd . push ( '-p' , `${ srv . conf . port } :${ srv . conf . port } ` ) ;
293293 } ) ;
294294 }
295295
@@ -321,7 +321,7 @@ function ensureDockerVersion() {
321321 const minimumDockerVersion = os . type ( ) === 'Darwin' ? '1.12.0' : '1.8.0' ;
322322 dockerVersion = dockerVersion . replace ( / \. 0 + ( 0 | [ 1 - 9 ] + ) / g, '.$1' ) ;
323323 if ( semver . lt ( dockerVersion , minimumDockerVersion ) ) {
324- console . error ( `Building the deploy repo on ${ os . type ( ) } supported only with docker ${ minimumDockerVersion } +` ) ;
324+ console . error ( `Building the deploy repo on ${ os . type ( ) } supported only with docker ${ minimumDockerVersion } +` ) ;
325325 process . exit ( 1 ) ;
326326 }
327327 } ) ;
@@ -368,10 +368,10 @@ function updateDeploy() {
368368 opts . name = props . name || pkg . name ;
369369 opts . remote_name = props . remote || 'origin' ;
370370 opts . submodule_ref = props . submodule_ref ||
371- `https://gerrit.wikimedia.org/r/mediawiki/services/${ opts . name } ` ;
371+ `https://gerrit.wikimedia.org/r/mediawiki/services/${ opts . name } ` ;
372372 opts . src_branch = props . src_branch || 'master' ;
373373 opts . deploy_branch = props . deploy_branch || 'master' ;
374- opts . remote_branch = `${ opts . remote_name } /${ opts . deploy_branch } ` ;
374+ opts . remote_branch = `${ opts . remote_name } /${ opts . deploy_branch } ` ;
375375 // we need to CHDIR into the deploy dir for subsequent operations
376376 process . chdir ( opts . dir ) ;
377377 return chainedPgit ( [
@@ -392,25 +392,25 @@ function updateDeploy() {
392392 // update it fully
393393 return promisedGit ( [ 'submodule' , 'update' , '--init' ] )
394394 . then ( ( ) => {
395- process . chdir ( `${ opts . dir } /${ opts . submodule } ` ) ;
395+ process . chdir ( `${ opts . dir } /${ opts . submodule } ` ) ;
396396 return chainedPgit ( [
397397 // fetch new commits
398398 [ 'fetch' , 'origin' ] ,
399399 // inspect what has changed
400- [ 'diff' , '--name-only' , `origin/${ opts . src_branch } ` ]
400+ [ 'diff' , '--name-only' , `origin/${ opts . src_branch } ` ]
401401 ] ) . then ( ( changes ) => {
402402 if ( / p a c k a g e \. j s o n / . test ( changes ) ) {
403403 // package.json has changed, so we need
404404 // to rebuild the node_modules directory
405405 opts . need_build = true ;
406406 }
407407 // get the SHA1 of the latest commit on the src branch
408- return promisedGit ( [ 'rev-parse' , '--short' , `origin/${ opts . src_branch } ` ] ) ;
408+ return promisedGit ( [ 'rev-parse' , '--short' , `origin/${ opts . src_branch } ` ] ) ;
409409 } ) . then ( ( shortSha1 ) => {
410- opts . commit_msg = `Update ${ opts . name } to ${ shortSha1 } \n\n` ;
410+ opts . commit_msg = `Update ${ opts . name } to ${ shortSha1 } \n\n` ;
411411 // get a nice list of commits included in the change
412412 return promisedGit ( [ 'log' ,
413- `..origin/${ opts . src_branch } ` ,
413+ `..origin/${ opts . src_branch } ` ,
414414 '--oneline' ,
415415 '--no-merges' ,
416416 '--reverse' ,
@@ -431,8 +431,8 @@ function updateDeploy() {
431431 } else if ( ! logs ) {
432432 logs = '' ;
433433 }
434- opts . commit_msg += `List of changes:\n${ logs } ` ;
435- return promisedGit ( [ 'checkout' , `origin/${ opts . src_branch } ` ] ) ;
434+ opts . commit_msg += `List of changes:\n${ logs } ` ;
435+ return promisedGit ( [ 'checkout' , `origin/${ opts . src_branch } ` ] ) ;
436436 } ) . then ( ( ) => {
437437 // go back to the root dir
438438 process . chdir ( opts . dir ) ;
@@ -444,14 +444,14 @@ function updateDeploy() {
444444 // no submodule, need to add it
445445 opts . submodule = 'src' ;
446446 opts . need_build = true ;
447- opts . commit_msg = `Initial import of ${ opts . name } ` ;
447+ opts . commit_msg = `Initial import of ${ opts . name } ` ;
448448 return promisedGit ( [ 'submodule' ,
449449 'add' ,
450450 opts . submodule_ref ,
451451 opts . submodule ] ) ;
452452 }
453453 } ) . then ( ( ) => // make sure the package.json symlink is in place
454- fs . symlinkAsync ( `${ opts . submodule } /package.json` , 'package.json' )
454+ fs . symlinkAsync ( `${ opts . submodule } /package.json` , 'package.json' )
455455 . catch ( ( ) => { } ) . then ( ( ) => promisedGit ( [ 'add' , 'package.json' ] ) ) ) . then ( ( ) => {
456456 if ( ! opts . need_build ) {
457457 return ;
@@ -465,7 +465,7 @@ function updateDeploy() {
465465 . then ( ( ) => promisedSpawn ( [ 'rm' , '-rf' , 'node_modules' ] ,
466466 { capture : true , ignoreErr : true } ) )
467467 // start the container which builds the modules
468- . then ( ( ) => startContainer ( [ '-v' , `${ opts . dir } :/opt/service` , '-w' , '/opt/service' ] , true ) )
468+ . then ( ( ) => startContainer ( [ '-v' , `${ opts . dir } :/opt/service` , '-w' , '/opt/service' ] , true ) )
469469 . then ( ( ) => {
470470 // remove unnecessary files
471471 let findAttr ;
@@ -497,7 +497,7 @@ function updateDeploy() {
497497 . then ( ( ) => {
498498 if ( ! opts . review ) {
499499 console . log ( '\n\nChanges are sitting in the sync-repo branch in' ) ;
500- console . log ( `${ opts . dir } with the commit:` ) ;
500+ console . log ( `${ opts . dir } with the commit:` ) ;
501501 console . log ( opts . commit_msg ) ;
502502 return ;
503503 }
@@ -532,12 +532,12 @@ function getUid() {
532532 ) . then ( ( dir ) => {
533533 opts . dir = dir ;
534534 // make sure that the dir exists and it is a git repo
535- return fs . statAsync ( `${ dir } /.git` ) ;
535+ return fs . statAsync ( `${ dir } /.git` ) ;
536536 } ) . then ( ( stat ) => {
537537 opts . uid = stat . uid ;
538538 opts . gid = stat . gid ;
539539 } ) . catch ( ( ) => {
540- console . error ( `ERROR: The deploy repo dir ${ opts . dir } does not exist or is not a git repo!` ) ;
540+ console . error ( `ERROR: The deploy repo dir ${ opts . dir } does not exist or is not a git repo!` ) ;
541541 process . exit ( 3 ) ;
542542 } ) ;
543543 }
@@ -604,7 +604,7 @@ function main( options, configuration ) {
604604 imgName += '-deploy' ;
605605 }
606606 // the container's name
607- name = `${ pkg . name } -${ Date . now ( ) } -${ Math . floor ( Math . random ( ) * 1000 ) } ` ;
607+ name = `${ pkg . name } -${ Date . now ( ) } -${ Math . floor ( Math . random ( ) * 1000 ) } ` ;
608608
609609 // trap exit signals
610610 process . on ( 'SIGINT' , sigHandle ) ;
0 commit comments