Comparing version 0.0.1-0 to 0.1.0
#!/usr/bin/env node | ||
var AppVeyor = require('./index.js'); | ||
var Configstore = require('configstore'); | ||
var AppVeyor = require('./index.js') | ||
var appveyor = new AppVeyor(new Configstore('appveyorjs')); | ||
var appveyor = new AppVeyor() | ||
@@ -37,2 +36,14 @@ appveyor.on('error', function (error) { | ||
program.command('yml') | ||
.help('create a appveyor.yml file in the current directory') | ||
.callback(function (opts) { | ||
appveyor.yml(process.stdout) | ||
}) | ||
program.command('badge') | ||
.help('print the text for the badge (shields.io)') | ||
.callback(function (opts) { | ||
appveyor.badge(process.stdout) | ||
}) | ||
program.parse() |
24
index.js
var request = require('request') | ||
var ghslug = require('github-slug') | ||
var Configstore = require('configstore'); | ||
var EventEmitter = require('events').EventEmitter | ||
var extend = require('util').inherits | ||
var fs = require('fs') | ||
var path = require('path') | ||
@@ -10,3 +13,3 @@ extend(AppVeyor, EventEmitter) | ||
function AppVeyor(configstore) { | ||
this.configstore = configstore | ||
this.configstore = configstore || new Configstore('appveyorjs') | ||
this.headers = { | ||
@@ -70,2 +73,21 @@ 'User-Agent': 'node-appveyor' | ||
AppVeyor.prototype.yml = function (stream) { | ||
var from = fs.createReadStream(path.join(__dirname, 'appveyor.yml')) | ||
from.pipe(fs.createWriteStream(path.join(process.cwd(), 'appveyor.yml'))) | ||
if(stream) | ||
from.pipe(stream) | ||
} | ||
AppVeyor.prototype.badge = function (stream) { | ||
var self = this | ||
ghslug(process.cwd(), function (err, slug) { | ||
if(err) { | ||
self.emit('error', err) | ||
return | ||
} | ||
stream.write('[![Windows Build status](http://img.shields.io/appveyor/ci/' + slug + '.svg)]') | ||
stream.write('(https://ci.appveyor.com/project/' + slug + '/branch/master)\n') | ||
}) | ||
} | ||
AppVeyor.prototype._getToken = function (cb) { | ||
@@ -72,0 +94,0 @@ var token = this.configstore.get('token') |
{ | ||
"name": "appveyor", | ||
"version": "0.0.1-0", | ||
"version": "0.1.0", | ||
"description": "A CLI for AppVeyor", | ||
@@ -10,3 +10,3 @@ "main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "node test.js" | ||
}, | ||
@@ -34,3 +34,7 @@ "repository": { | ||
"request": "^2.39.0" | ||
}, | ||
"devDependencies": { | ||
"nock": "^0.43.0", | ||
"tape": "^2.13.4" | ||
} | ||
} |
# AppVeyor | ||
Mac / Linux | Windows | ||
---- | ---- | ||
[![Build Status](https://travis-ci.org/finnp/node-appveyor.svg?branch=master)](https://travis-ci.org/finnp/node-appveyor) | [![Windows Build status](http://img.shields.io/appveyor/ci/finnp/node-appveyor.svg)](https://ci.appveyor.com/project/finnp/node-appveyor/branch/master) | ||
@@ -6,4 +9,21 @@ A javascriptable CLI for AppVeyor for node projects. It is basically the | ||
Install with `npm install appveyor -g` | ||
* Add projects / hooks | ||
* Create appveyor.yaml | ||
``` | ||
Usage: appveyor <command> | ||
command | ||
auth set the auth token for AppVeyor | ||
hook activate AppVeyor for the current project | ||
yml create a appveyor.yml file in the current directory | ||
badge print the text for the badge (shields.io) | ||
``` | ||
The commands map to the specific functions. For now look at | ||
the source code for details. | ||
```js | ||
var AppVeyor = require('appveyor') | ||
var appveyor = new AppVeyor() | ||
appveyor.auth('<your token>') // saved locally | ||
appveyor.badge(process.stdout) // prints the badge | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
6633
8
153
1
28
2
1