Skip to content

Commit

Permalink
Merge pull request #40 from Fgerthoffert/develop
Browse files Browse the repository at this point in the history
Fixed missing parameter
  • Loading branch information
Fgerthoffert authored Jul 10, 2020
2 parents 28b3063 + 61e0e3c commit bbd2566
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 52 deletions.
116 changes: 65 additions & 51 deletions src/commands/modules/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,62 +10,76 @@ 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',
}),
gitpath: flags.string({
required: true,
default: '',
description: 'Path to the pom if not at the repository root',
}),
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.gitpath,
flags.repository,
);

if (JSON.parse(flags.deploy)) {
for (const jahiaModule of buildModules) {
// eslint-disable-next-line no-await-in-loop
await installModule(flags, jahiaModule, true);
}
}
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.',
);
}
}
2 changes: 1 addition & 1 deletion src/components/modules/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const buildModule = async (
console.log(status);

const pomXml =
gitPath === null
gitPath === null || gitPath === ''
? path.join(dstDir, 'pom.xml')
: path.join(dstDir, gitPath, 'pom.xml');
if (!fs.existsSync(pomXml)) {
Expand Down

0 comments on commit bbd2566

Please sign in to comment.