Skip to content
Snippets Groups Projects
Commit a18de9e0 authored by Mike Lynch's avatar Mike Lynch
Browse files

Picked up a bug in the licenses part of catalog.json

parent f66b8587
No related merge requests found
...@@ -18,22 +18,22 @@ const APPROVER = 'Sharyn.Wise@uts.edu.au'; ...@@ -18,22 +18,22 @@ const APPROVER = 'Sharyn.Wise@uts.edu.au';
async function makedatacrate(dest, datapub) { async function makedatacrate(doi, datapub, dest) {
await fs.ensureDir(dest); await fs.ensureDir(dest);
const catalog = await datacrate.datapub2catalog({ const catalog = await datacrate.datapub2catalog({
id: id, id: doi,
datapub: datapub, datapub: datapub,
organisation: ORGANISATION, organisation: ORGANISATION,
owner: OWNER, owner: OWNER,
approver: APPROVER approver: APPROVER
}); });
const catfile = path.join(dest, id, 'CATALOG.json'); const catfile = path.join(dest, 'CATALOG.json');
await fs.writeFile(catfile, JSON.stringify(catalog, null, 2)); await fs.writeFile(catfile, JSON.stringify(catalog, null, 2));
} }
async function convertdatapub(jsonfile, dest) { async function convertdatapub(pid, jsonfile, dest) {
const datapub = await fs.readJSON(jsonfile); const datapub = await fs.readJSON(jsonfile);
await makedatacrate(dest, datapub); await makedatacrate(pid, datapub, dest);
} }
...@@ -47,9 +47,18 @@ var parser = new ArgumentParser({ ...@@ -47,9 +47,18 @@ var parser = new ArgumentParser({
parser.addArgument( parser.addArgument(
['-i', '--input'], ['-i', '--input'],
{ {
help: "The input data publication" help: "The input data publication",
required: true
}); });
parser.addArgument(
['-p', '--persistentid'],
{
help: "The persistent ID for the datacrate (a DOI, say)",
required: true
});
parser.addArgument( parser.addArgument(
['-d', '--directory'], ['-d', '--directory'],
{ {
...@@ -62,5 +71,5 @@ parser.addArgument( ...@@ -62,5 +71,5 @@ parser.addArgument(
var args = parser.parseArgs(); var args = parser.parseArgs();
convertdatapub(args['input'], args['directory']); convertdatapub(args['persistentid'], args['input'], args['directory']);
...@@ -535,7 +535,7 @@ function make_temporal(datapub) { ...@@ -535,7 +535,7 @@ function make_temporal(datapub) {
function make_license(datapub, prefix) { function make_license(datapub, prefix) {
const license = []; const licenses = [];
if( datapub['license_other_url'] || datapub['license_notes'] ) { if( datapub['license_other_url'] || datapub['license_notes'] ) {
if( datapub['license_other_url'] ) { if( datapub['license_other_url'] ) {
licenses.push({ licenses.push({
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment