update git module

This commit is contained in:
2017-09-08 14:58:44 +02:00
parent 55014fbdb2
commit 46c9df32d8
16 changed files with 134 additions and 93 deletions

View File

@ -1,4 +1,6 @@
import * as plugins from './mod.plugins'
import { bash } from '../npmci.bash'
import { repo } from '../npmci.env'
/**
* handle cli input
@ -20,5 +22,14 @@ export let handleCli = async (argvArg) => {
}
export let mirror = async () => {
let githubToken = process.env.NPMCI_GIT_GITHUBTOKEN
let githubUser = process.env.NPMCI_GIT_GITHUBGROUP || repo.user
let githubRepo = process.env.NPMCI_GIT_GITHUB || repo.repo
if (githubToken) {
plugins.beautylog.info('found github token.')
plugins.beautylog.log('attempting the mirror the repository to GitHub')
// add the mirror
bash(`git remote add mirror https://${githubToken}@github.com/${githubUser}/${githubRepo}.git`)
bash(`git push mirror`)
}
}

View File

@ -1,5 +1,7 @@
import * as plugins from './npmci.plugins'
import * as paths from './npmci.paths'
// Get Info about npmci itself
let npmciInfo = new plugins.projectinfo.ProjectinfoNpm(paths.NpmciPackageRoot)
plugins.beautylog.log('npmci version: ' + npmciInfo.version)
@ -39,6 +41,16 @@ smartcli.addCommand('command')
process.exit(1)
})
// command
smartcli.addCommand('git')
.then(async (argvArg) => {
let modGit = await npmciMods.modGit.load()
await modGit.handleCli(argvArg)
}).catch(err => {
console.log(err)
process.exit(1)
})
// build
smartcli.addCommand('docker')
.then(async argvArg => {

View File

@ -1,6 +1,7 @@
import * as plugins from './npmci.plugins'
import * as paths from './npmci.paths'
import { GitRepo } from 'smartstring'
import { ProjectInfo } from 'projectinfo'
import { Dockerfile } from './mod_docker/index'
/**
@ -10,3 +11,8 @@ export let repo: GitRepo
if (process.env.CI_REPOSITORY_URL) {
repo = new GitRepo(process.env.CI_REPOSITORY_URL)
}
/**
* Info about the project at cwd
*/
export let cwdProjectInfo = new ProjectInfo(paths.cwd)

View File

@ -1,20 +1,16 @@
import * as plugins from './npmci.plugins'
import * as env from './npmci.env'
import { Smartmonitor } from 'smartmonitor'
import { Analytics } from 'smartanalytics'
export let npmciMonitor = new Smartmonitor()
export let npmciAnalytics = new Analytics({
apiEndPoint: 'https://pubapi-1.lossless.one/analytics',
projectId: 'gitzone',
appName: 'npmci'
})
let monitorEnvString: string = process.env.NPMCI_MONITOR
if (monitorEnvString) {
let npmciMonitorKeys: string[] = monitorEnvString.split('|')
npmciMonitor.addInstrumental({
apiKey: process.env.NPMCI_MONITOR
})
plugins.beautylog.info('Monitoring activated')
} else {
plugins.beautylog.warn('Monitoring could not be enabled due to missing API-KEY')
}
npmciMonitor.increment('lossless-ci.builds', 1)
npmciAnalytics.recordEvent('npmToolExecution', {
}).catch(err => {
plugins.beautylog.warn('Lossless Analytics API not available...')
})

View File

@ -12,7 +12,6 @@ export import smartcli = require('smartcli')
export import smartdelay = require('smartdelay')
export import smartfile = require('smartfile')
export import shelljs = require('shelljs')
export import smartmonitor = require('smartmonitor')
export import smartparam = require('smartparam')
export import smartq = require('smartq')
export import smartshell = require('smartshell')