Skip to content

Commit

Permalink
add lav implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
jtfell committed Feb 9, 2018
1 parent 49895b1 commit f5f29fa
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/glci-lav.js
Original file line number Diff line number Diff line change
@@ -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 <url>',
'Your Gitlab project URL, e.g. https://gitlab.com/gitlab-org/gitlab-ce',
)
.option(
'--token <token>',
'Your Gitlab token.',
)
.option(
'--out <out>',
'The location to save CI values to.',
'gitlab.env.yml',
)
.parse(process.argv);

execute(program);

0 comments on commit f5f29fa

Please sign in to comment.