From f5f29faf9a450512cca6d0110e5fe14a5cac7361 Mon Sep 17 00:00:00 2001 From: Julian Fell Date: Fri, 9 Feb 2018 15:34:27 +1000 Subject: [PATCH] add lav implementation --- src/glci-lav.js | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/glci-lav.js diff --git a/src/glci-lav.js b/src/glci-lav.js new file mode 100644 index 0000000..c94b098 --- /dev/null +++ b/src/glci-lav.js @@ -0,0 +1,40 @@ +#!/usr/bin/env node + +import program from 'commander'; +import { getConf } from './lib/utils'; +import { savePropertiesFile } from './lib/properties-file'; +import gitlabCI from './lib/gitlab-ci'; + +async function execute() { + const conf = await getConf(); + + const handler = gitlabCI(conf.url, conf.token); + const resp = await handler.listVariables(); + + console.log('Downloaded variables from Gitlab CI.'); + + savePropertiesFile(`${process.cwd()}/conf.out`, resp); + + console.log(`Saved variables to ${conf.out}`); + + return resp; +} + +program + .description('Read all key/value pairs from Gitlab API and saves them to the specified .yml file') + .option( + '--url ', + 'Your Gitlab project URL, e.g. https://gitlab.com/gitlab-org/gitlab-ce', + ) + .option( + '--token ', + 'Your Gitlab token.', + ) + .option( + '--out ', + 'The location to save CI values to.', + 'gitlab.env.yml', + ) + .parse(process.argv); + +execute(program);