Skip to content

Commit

Permalink
Fix command create hook and add chmod
Browse files Browse the repository at this point in the history
  • Loading branch information
Rémi committed Jul 17, 2017
1 parent c8bfd53 commit eab3f73
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
Empty file modified src/bin/barracks-filter-update
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions src/bin/barracks-hook
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const pjson = require('../../package.json');

const barracks = program
.version(pjson.version)
.command('create [cmd]', 'Manage hooks creation');

.command('create', 'Manage hooks creation');
barracks.parse(process.argv);

process.on('SIGINT', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/bin/barracks-hook-create
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env node

const CreateHook = require('../commands/hook/CreateHook');
const CreateHook = require('../commands/hook/CreateHookCommand');
new CreateHook().render();
7 changes: 4 additions & 3 deletions src/clients/HookClient.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const HTTPClient = require('./HTTPClient');
const logger = require('../utils/logger');
//const logger = require('../utils/logger');

const endpoints = {
createHook: {
Expand All @@ -14,10 +14,10 @@ class HookClient {
this.httpClient = new HTTPClient();
}

createSegment(token, hook) {
createHook(token, hook) {
return new Promise((resolve, reject) => {
this.httpClient.sendEndpointRequest(
endpoints.createSegment,
endpoints.createHook,
{
headers: {
'x-auth-token': token
Expand All @@ -31,5 +31,6 @@ class HookClient {
});
});
}
}

module.exports = HookClient;
11 changes: 8 additions & 3 deletions src/commands/hook/CreateHookCommand.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
const BarracksCommand = require('../BarracksCommand');

function getType(program) {
if (program.web) {
return 'web';
}
}

class CreateHookCommand extends BarracksCommand {

configureCommand(program) {
Expand All @@ -13,15 +19,14 @@ class CreateHookCommand extends BarracksCommand {
return !!(
program.web &&
program.url && program.url !== true &&
program.name && program.name !== true &&
(!program.description || (program.description && program.description !== true))
program.name && program.name !== true
);
}

execute(program) {
return this.getAuthenticationToken().then(token => {
return this.barracks.createHook(token, {
type: program.web,
type: getType(program),
name: program.name,
url: program.url
});
Expand Down
1 change: 1 addition & 0 deletions src/commands/integration/SetGoogleClientSecretCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ function getObject(program) {
return ObjectReader.readObjectFromStdin();
}
}

class SetGoogleClientSecretCommand extends BarracksCommand {

configureCommand(program) {
Expand Down

0 comments on commit eab3f73

Please sign in to comment.