New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hubot-appveyor

Package Overview
Dependencies
Maintainers
3
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hubot-appveyor - npm Package Compare versions

Comparing version 0.0.9 to 0.1.0

build/scripts/settings.js

4

build/index.js

@@ -9,6 +9,7 @@ "use strict";

const error_1 = require('./scripts/error');
const settings_1 = require('./scripts/settings');
const appveyor_1 = require('./lib/appveyor');
const config_1 = require('./lib/config');
module.exports = (robot) => {
const appveyor = new appveyor_1.AppVeyor(robot.http.bind(robot), config_1.Config.appveyor.token, config_1.Config.appveyor.account);
const appveyor = new appveyor_1.AppVeyor(robot.http.bind(robot), config_1.Config.appveyor.account);
error_1.default(robot);

@@ -19,3 +20,4 @@ hello_1.default(robot);

deploy_1.default(robot, appveyor);
settings_1.default(robot);
};
//# sourceMappingURL=index.js.map
"use strict";
class AppVeyor {
constructor(http, token, accountName) {
this.http = http;
this.token = token;
this.accountName = accountName;
constructor(_http, _accountName) {
this._http = _http;
this._accountName = _accountName;
}
build(projectSlug) {
build(projectSlug, token) {
const body = JSON.stringify({
accountName: this.accountName,
accountName: this._accountName,
projectSlug: projectSlug
});
return new Promise((resolve, reject) => {
this.post('https://ci.appveyor.com/api/builds', body, (err, resp, data) => {
this.post('https://ci.appveyor.com/api/builds', body, token, (err, resp, data) => {
if (err)

@@ -27,6 +26,6 @@ return reject(err);

body: {
accountName: this.accountName,
accountName: this._accountName,
projectSlug: projectSlug,
version: o.version,
link: `https://ci.appveyor.com/project/${this.accountName}/${projectSlug}/build/${o.version}`
link: `https://ci.appveyor.com/project/${this._accountName}/${projectSlug}/build/${o.version}`
}

@@ -37,5 +36,5 @@ });

}
builds(projectSlug, count) {
builds(projectSlug, count, token) {
return new Promise((resolve, reject) => {
this.get(`https://ci.appveyor.com/api/projects/${this.accountName}/${projectSlug}/history?recordsNumber=${count}`, (err, resp, data) => {
this.get(`https://ci.appveyor.com/api/projects/${this._accountName}/${projectSlug}/history?recordsNumber=${count}`, token, (err, resp, data) => {
if (err)

@@ -50,3 +49,3 @@ return reject(err);

body: {
accountName: this.accountName,
accountName: this._accountName,
projectSlug: projectSlug,

@@ -59,3 +58,3 @@ builds: o.builds.map((build) => ({

status: build.status,
link: `https://ci.appveyor.com/project/${this.accountName}/${projectSlug}/build/${build.version}`
link: `https://ci.appveyor.com/project/${this._accountName}/${projectSlug}/build/${build.version}`
}))

@@ -67,6 +66,6 @@ }

}
deploy(projectSlug, version, environment) {
deploy(projectSlug, version, environment, token) {
const body = JSON.stringify({
environmentName: environment,
accountName: this.accountName,
accountName: this._accountName,
projectSlug: projectSlug,

@@ -76,3 +75,3 @@ buildVersion: version

return new Promise((resolve, reject) => {
this.post('https://ci.appveyor.com/api/deployments', body, (err, resp, data) => {
this.post('https://ci.appveyor.com/api/deployments', body, token, (err, resp, data) => {
if (err)

@@ -90,3 +89,3 @@ return reject(err);

body: {
link: `https://ci.appveyor.com/project/${this.accountName}/${projectSlug}/deployment/${o.deploymentId}`
link: `https://ci.appveyor.com/project/${this._accountName}/${projectSlug}/deployment/${o.deploymentId}`
}

@@ -97,5 +96,5 @@ });

}
post(url, body, callback) {
this.http(url)
.header('Authorization', `Bearer ${this.token}`)
post(url, body, token, callback) {
this._http(url)
.header('Authorization', `Bearer ${token}`)
.header('Content-Type', 'application/json')

@@ -105,5 +104,5 @@ .header('Accept', 'application/json')

}
get(url, callback) {
this.http(url)
.header('Authorization', `Bearer ${this.token}`)
get(url, token, callback) {
this._http(url)
.header('Authorization', `Bearer ${token}`)
.header('Content-Type', 'application/json')

@@ -110,0 +109,0 @@ .header('Accept', 'application/json')

"use strict";
exports.Config = {
appveyor: {
token: process.env.APPVEYOR_TOKEN,
account: process.env.APPVEYOR_ACCOUNT,

@@ -6,0 +5,0 @@ webhook: {

@@ -8,3 +8,6 @@ "use strict";

res.reply('One moment please...');
appVeyor.build(projectSlug)
const userSettings = robot.brain.get(`appveyor.settings.${res.message.user.id}`);
if (userSettings == null)
return res.reply(`You must whisper me your AppVeyor API token with "/msg @${robot.name} set token <token>" first`);
appVeyor.build(projectSlug, userSettings.token)
.then((data) => {

@@ -28,3 +31,3 @@ if (!data.ok)

slackAdapter.customMessage(msgData);
robot.brain.set(`${projectSlug}/${data.body.version}`, JSON.stringify({ username: res.message.user.name }));
robot.brain.set(`appveyor.build.${projectSlug}-${data.body.version}`, { username: res.message.user.name });
})

@@ -40,6 +43,5 @@ .catch((reason) => robot.emit('error', reason, res));

let msg = `Build v${data.eventData.buildVersion} of '${data.eventData.projectName} ${outcome}.`;
const value = robot.brain.get(`${data.eventData.projectName}/${data.eventData.buildVersion}`);
const value = robot.brain.get(`appveyor.build.${data.eventData.projectName}-${data.eventData.buildVersion}`);
if (value) {
const o = JSON.parse(value);
msg += ` @${o.username}`;
msg += ` @${value.username}`;
}

@@ -46,0 +48,0 @@ robot.messageRoom(config_1.Config.announce_channel, msg);

@@ -15,3 +15,6 @@ "use strict";

res.reply('One moment please...');
appVeyor.builds(projectSlug, buildCount)
const userSettings = robot.brain.get(`appveyor.settings.${res.message.user.id}`);
if (userSettings == null)
return res.reply(`You must whisper me your AppVeyor API token with "/msg @${robot.name} set token <token>" first`);
appVeyor.builds(projectSlug, buildCount, userSettings.token)
.then((data) => {

@@ -18,0 +21,0 @@ let msgData = {

@@ -8,4 +8,7 @@ "use strict";

const environment = res.match[3];
const userSettings = robot.brain.get(`appveyor.settings.${res.message.user.id}`);
if (userSettings == null)
return res.reply(`You must whisper me your AppVeyor API token with "/msg @${robot.name} set token <token>" first`);
res.reply(`Starting deploy of '${project}' to '${environment}'...`);
appveyor.deploy(project, version, environment)
appveyor.deploy(project, version, environment, userSettings.token)
.then((data) => {

@@ -12,0 +15,0 @@ if (!data.ok)

{
"name": "hubot-appveyor",
"version": "0.0.9",
"version": "0.1.0",
"author": "David Wood <david.p.wood@gmail.com>",

@@ -5,0 +5,0 @@ "contributors": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc