-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from Fgerthoffert/develop
Added flag to force module installation
- Loading branch information
Showing
4 changed files
with
171 additions
and
189 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,70 +10,62 @@ import buildModule from '../../components/modules/build'; | |
import installModule from '../../components/modules/install'; | ||
|
||
export default class ModulesBuild extends Command { | ||
static description = 'Installs a module'; | ||
static description = 'Installs a module'; | ||
|
||
static flags = { | ||
...Command.flags, | ||
help: flags.help({ char: 'h' }), | ||
directory: flags.string({ | ||
required: true, | ||
description: 'Directory to use as a base for storing the build artifacts', | ||
}), | ||
file: flags.string({ | ||
// required: true, | ||
description: | ||
'Specify the filepath to the module to be installed (jar on filesystem)', | ||
}), | ||
repository: flags.string({ | ||
required: true, | ||
description: 'Repository to clone', | ||
default: '[email protected]:Jahia/LDAP-provider.git', | ||
}), | ||
id: flags.string({ | ||
required: true, | ||
default: 'ldap', | ||
description: 'Module Id', | ||
}), | ||
branch: flags.string({ | ||
required: true, | ||
default: 'master', | ||
description: 'Git repository branch', | ||
}), | ||
deploy: flags.string({ | ||
required: false, | ||
default: 'true', | ||
description: 'Trigger a deployment of the module', | ||
}), | ||
}; | ||
static flags = { | ||
...Command.flags, | ||
help: flags.help({ char: 'h' }), | ||
directory: flags.string({ | ||
required: true, | ||
description: 'Directory to use as a base for storing the build artifacts' | ||
}), | ||
file: flags.string({ | ||
// required: true, | ||
description: 'Specify the filepath to the module to be installed (jar on filesystem)' | ||
}), | ||
repository: flags.string({ | ||
required: true, | ||
description: 'Repository to clone', | ||
default: '[email protected]:Jahia/LDAP-provider.git' | ||
}), | ||
id: flags.string({ | ||
required: true, | ||
default: 'ldap', | ||
description: 'Module Id' | ||
}), | ||
branch: flags.string({ | ||
required: true, | ||
default: 'master', | ||
description: 'Git repository branch' | ||
}), | ||
deploy: flags.string({ | ||
required: false, | ||
default: 'true', | ||
description: 'Trigger a deployment of the module' | ||
}) | ||
}; | ||
|
||
static args = [{ name: 'file' }]; | ||
static args = [ { name: 'file' } ]; | ||
|
||
async run() { | ||
const { flags } = this.parse(ModulesBuild); | ||
const t0 = performance.now(); | ||
async run() { | ||
const { flags } = this.parse(ModulesBuild); | ||
const t0 = performance.now(); | ||
|
||
if (!fs.existsSync(flags.directory)) { | ||
console.log('ERROR: Unable to access directory: ' + flags.directory); | ||
exit(); | ||
} | ||
if (!fs.existsSync(flags.directory)) { | ||
console.log('ERROR: Unable to access directory: ' + flags.directory); | ||
exit(); | ||
} | ||
|
||
const buildModules = await buildModule( | ||
flags.directory, | ||
flags.id, | ||
flags.branch, | ||
flags.repository, | ||
); | ||
const buildModules = await buildModule(flags.directory, flags.id, flags.branch, flags.repository); | ||
|
||
if (JSON.parse(flags.deploy)) { | ||
for (const jahiaModule of buildModules) { | ||
// eslint-disable-next-line no-await-in-loop | ||
await installModule(flags, jahiaModule); | ||
} | ||
} | ||
if (JSON.parse(flags.deploy)) { | ||
for (const jahiaModule of buildModules) { | ||
// eslint-disable-next-line no-await-in-loop | ||
await installModule(flags, jahiaModule, true); | ||
} | ||
} | ||
|
||
const t1 = performance.now(); | ||
console.log( | ||
'Total Exceution time: ' + Math.round(t1 - t0) + ' milliseconds.', | ||
); | ||
} | ||
const t1 = performance.now(); | ||
console.log('Total Exceution time: ' + Math.round(t1 - t0) + ' milliseconds.'); | ||
} | ||
} |
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