Comparing version 0.0.6 to 0.0.7
@@ -10,3 +10,3 @@ #!/usr/bin/env node | ||
const namespace = require('@rdfjs/namespace') | ||
const TextLogStream = require('../lib/TextLogStream') | ||
const runner = require('../lib/runner') | ||
@@ -69,3 +69,7 @@ const ns = { | ||
.option('-v, --verbose', 'enable diagnostic console output') | ||
.action((filename, { format, output, pipeline, variable, verbose } = {}) => { | ||
.action((filename, options = {}) => { | ||
let { format, output, pipeline, verbose } = options | ||
runner.log.enabled = verbose | ||
p.fileToDataset(format, filename) | ||
@@ -77,36 +81,12 @@ .then(dataset => { | ||
if (verbose) { | ||
process.stdout.write('variables via CLI:\n') | ||
for (const [key, value] of variable) { | ||
process.stdout.write(` ${key}: ${value}\n`) | ||
} | ||
} | ||
const stream = p.pipeline(dataset, pipeline, { | ||
basePath: path.resolve(path.dirname(filename)), | ||
variables: variable | ||
const run = runner.create({ | ||
...options, | ||
pipeline, | ||
outputStream: createOutputStream(output), | ||
basePath: path.resolve(path.dirname(filename)) | ||
}) | ||
if (verbose) { | ||
process.stdout.write('variables in pipeline instance:\n') | ||
for (const [key, value] of stream.variables) { | ||
process.stdout.write(` ${key}: ${value}\n`) | ||
} | ||
} | ||
stream.on('error', err => { | ||
console.error(err) | ||
process.exit(1) | ||
}) | ||
stream.pipe(createOutputStream(output)) | ||
if (verbose) { | ||
stream.context.log.pipe(new TextLogStream()).pipe(process.stdout) | ||
} | ||
return p.run(stream) | ||
}).catch(err => { | ||
return run(dataset) | ||
}) | ||
.catch(err => { | ||
console.error(err) | ||
@@ -113,0 +93,0 @@ process.exit(1) |
@@ -0,4 +1,7 @@ | ||
const debug = require('debug') | ||
const base = require('barnard59-base') | ||
const core = require('barnard59-core') | ||
module.exports = Object.assign({}, core, base) | ||
const log = debug('barnard59') | ||
module.exports = Object.assign({ log }, core, base) |
@@ -9,3 +9,3 @@ const Transform = require('readable-stream').Transform | ||
_transform (chunk, e, next) { | ||
this.push(`${chunk.level} ${chunk.stack[0]} ${chunk.message}\r\n`) | ||
this.push(`${chunk.level} ${chunk.stack[0]} ${chunk.message}`) | ||
next() | ||
@@ -12,0 +12,0 @@ } |
{ | ||
"name": "barnard59", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Barnard59 Linked Data pipelines", | ||
@@ -26,2 +26,3 @@ "main": "index.js", | ||
"commander": "^2.19.0", | ||
"debug": "^4.1.1", | ||
"rdf-ext": "^1.1.2", | ||
@@ -31,2 +32,4 @@ "readable-stream": "^3.1.1" | ||
"devDependencies": { | ||
"@types/debug": "^4.1.5", | ||
"@types/rdf-js": "^2.0.9", | ||
"barnard59-formats": "0.0.4", | ||
@@ -33,0 +36,0 @@ "jest": "^24.9.0", |
@@ -152,2 +152,8 @@ # barnard59 | ||
In a [CI/CD environment](https://github.com/zazuko/barnard59/wiki/automation) you might want to pass sensitive arguments like usernames and passwords via environment-variables. This can be done by referencing it like this: | ||
`barnard59 run pipeline.json --pipeline http://example.org/#pipeline --variable password=$PASSWORD` | ||
where `$PASSWORD`is a valid environment-variable. | ||
#### Using Variables via Datatype | ||
@@ -154,0 +160,0 @@ |
27830
19
270
277
8
6
+ Addeddebug@^4.1.1
+ Addeddebug@4.4.0(transitive)
+ Addedms@2.1.3(transitive)