Skip to content

Commit

Permalink
Merge pull request #23 from barracksiot/BO-1276
Browse files Browse the repository at this point in the history
Refactor with management commands
  • Loading branch information
Greg committed Apr 12, 2017
2 parents f7ee8ed + d46759e commit bb16ba1
Show file tree
Hide file tree
Showing 46 changed files with 307 additions and 82 deletions.
28 changes: 28 additions & 0 deletions bin/barracks
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env node

const program = require('commander');
const config = require('../config.js');
const pjson = require('../package.json');

program
.version(pjson.version)
.command('login', 'Authenticate to Barracks')
.command('account', 'Get account information')
.command('update [cmd]', 'Manage updates')
.command('device [cmd]', 'Manage devices')
.command('segment [cmd]', 'Manage segments')
.command('check-update', 'Check for an update the same way a device would');

if (config.experimental) {
program
.command('package [cmd]', 'Manage packages')
.command('filter [cmd]', 'Manage filters')
.command('token [cmd]', 'Manage tokens')
.command('integration [cmd]', 'Manage third-party integrations');
}

program.parse(process.argv);

process.on('SIGINT', () => {
process.exit();
});
2 changes: 2 additions & 0 deletions bin/barracks-account.js → bin/barracks-account
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env node

const AccountCommand = require('../commands/AccountCommand');
new AccountCommand().render();
2 changes: 2 additions & 0 deletions bin/barracks-check-update.js → bin/barracks-check-update
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env node

const CheckUpdateCommand = require('../commands/CheckUpdateCommand');
new CheckUpdateCommand().render();
16 changes: 16 additions & 0 deletions bin/barracks-device
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env node

const program = require('commander');
const config = require('../config.js');
const pjson = require('../package.json');

const barracks = program
.version(pjson.version)
.command('ls', 'List devices')
.command('get', 'Display detailed information on a device');

barracks.parse(process.argv);

process.on('SIGINT', () => {
process.exit();
});
2 changes: 2 additions & 0 deletions bin/barracks-device.js → bin/barracks-device-get
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env node

const DeviceCommand = require('../commands/DeviceCommand');
new DeviceCommand().render();
2 changes: 2 additions & 0 deletions bin/barracks-devices.js → bin/barracks-device-ls
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env node

const DevicesCommand = require('../commands/DevicesCommand');
new DevicesCommand().render();
16 changes: 16 additions & 0 deletions bin/barracks-filter
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env node

const program = require('commander');
const config = require('../config.js');
const pjson = require('../package.json');

const barracks = program
.command('ls', 'List filters')
.command('create', 'Create a filter')
.command('rm', 'Remove a filter');

barracks.parse(process.argv);

process.on('SIGINT', () => {
process.exit();
});
2 changes: 2 additions & 0 deletions bin/barracks-create-filter.js → bin/barracks-filter-create
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env node

const CreateFilterCommand = require('../commands/CreateFilterCommand');
new CreateFilterCommand().render();
2 changes: 2 additions & 0 deletions bin/barracks-filters.js → bin/barracks-filter-ls
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env node

const FiltersCommand = require('../commands/FiltersCommand');
new FiltersCommand().render();
2 changes: 2 additions & 0 deletions bin/barracks-delete-filter.js → bin/barracks-filter-rm
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env node

const DeleteFilterCommand = require('../commands/DeleteFilterCommand');
new DeleteFilterCommand().render();
15 changes: 15 additions & 0 deletions bin/barracks-integration
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env node

const program = require('commander');
const config = require('../config.js');
const pjson = require('../package.json');

const barracks = program
.version(pjson.version)
.command('ganalytics [cmd]', 'Manage Google Analytics integration');

barracks.parse(process.argv);

process.on('SIGINT', () => {
process.exit();
});
15 changes: 15 additions & 0 deletions bin/barracks-integration-ganalytics
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env node

const program = require('commander');
const config = require('../config.js');
const pjson = require('../package.json');

const barracks = program
.version(pjson.version)
.command('init', 'Setup Google Analytics integration');

barracks.parse(process.argv);

process.on('SIGINT', () => {
process.exit();
});
2 changes: 2 additions & 0 deletions bin/barracks-set-ga-tracking-id.js → bin/barracks-integration-ganalytics-init
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env node

const SetGoogleAnalyticsTrackingIdCommand = require('../commands/SetGoogleAnalyticsTrackingIdCommand');
new SetGoogleAnalyticsTrackingIdCommand().render();
2 changes: 2 additions & 0 deletions bin/barracks-login.js → bin/barracks-login
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env node

const LoginCommand = require('../commands/LoginCommand');
new LoginCommand().render();
17 changes: 17 additions & 0 deletions bin/barracks-package
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env node

const program = require('commander');
const config = require('../config.js');
const pjson = require('../package.json');

const barracks = program
.command('ls', 'List packages')
.command('create', 'Create a package')
.command('version [cmd]', 'Manage versions')
.command('plan [cmd]', 'Manage deployment plans');

barracks.parse(process.argv);

process.on('SIGINT', () => {
process.exit();
});
2 changes: 2 additions & 0 deletions bin/barracks-create-package.js → bin/barracks-package-create
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env node

const CreatePackageCommand = require('../commands/CreatePackageCommand');
new CreatePackageCommand().render();
2 changes: 2 additions & 0 deletions bin/barracks-packages.js → bin/barracks-package-ls
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env node

const PackagesCommand = require('../commands/PackagesCommand');
new PackagesCommand().render();
14 changes: 14 additions & 0 deletions bin/barracks-package-plan
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env node

const program = require('commander');
const config = require('../config.js');
const pjson = require('../package.json');

const barracks = program
.command('deploy', 'Deploy a deployment plan');

barracks.parse(process.argv);

process.on('SIGINT', () => {
process.exit();
});
2 changes: 2 additions & 0 deletions bin/barracks-create-deployment-plan.js → bin/barracks-package-plan-deploy
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env node

const CreateDeploymentPlanCommand = require('../commands/CreateDeploymentPlanCommand');
new CreateDeploymentPlanCommand().render();
15 changes: 15 additions & 0 deletions bin/barracks-package-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env node

const program = require('commander');
const config = require('../config.js');
const pjson = require('../package.json');

const barracks = program
.command('ls', 'List versions')
.command('create', 'Create a version');

barracks.parse(process.argv);

process.on('SIGINT', () => {
process.exit();
});
2 changes: 2 additions & 0 deletions bin/barracks-create-package-version.js → bin/barracks-package-version-create
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env node

const CreatePackageVersionCommand = require('../commands/CreatePackageVersionCommand');
new CreatePackageVersionCommand().render();
2 changes: 2 additions & 0 deletions bin/barracks-package-versions.js → bin/barracks-package-version-ls
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env node

const PackageVersionsCommand = require('../commands/PackageVersionsCommand');
new PackageVersionsCommand().render();
18 changes: 18 additions & 0 deletions bin/barracks-segment
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env node

const program = require('commander');
const config = require('../config.js');
const pjson = require('../package.json');

program
.version(pjson.version)
.command('ls', 'List segments')
.command('create', 'Create a segment')
.command('edit', 'Edit a segment')
.command('set-active', 'Set active segments');

program.parse(process.argv);

process.on('SIGINT', () => {
process.exit();
});
2 changes: 2 additions & 0 deletions bin/barracks-create-segment.js → bin/barracks-segment-create
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env node

const CreateSegmentCommand = require('../commands/CreateSegmentCommand');
new CreateSegmentCommand().render();
2 changes: 2 additions & 0 deletions bin/barracks-edit-segment.js → bin/barracks-segment-edit
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env node

const EditSegmentCommand = require('../commands/EditSegmentCommand');
new EditSegmentCommand().render();
2 changes: 2 additions & 0 deletions bin/barracks-segments.js → bin/barracks-segment-ls
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env node

const SegmentsCommand = require('../commands/SegmentsCommand');
new SegmentsCommand().render();
2 changes: 2 additions & 0 deletions bin/barracks-set-active-segments.js → bin/barracks-segment-set-active
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env node

const SetActiveSegmentsCommand = require('../commands/SetActiveSegmentsCommand');
new SetActiveSegmentsCommand().render();
16 changes: 16 additions & 0 deletions bin/barracks-token
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env node

const program = require('commander');
const config = require('../config.js');
const pjson = require('../package.json');

const barracks = program
.command('ls', 'List tokens')
.command('create', 'Create a token')
.command('revoke', 'Revoke a filter');

barracks.parse(process.argv);

process.on('SIGINT', () => {
process.exit();
});
2 changes: 2 additions & 0 deletions bin/barracks-create-token.js → bin/barracks-token-create
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env node

const CreateTokenCommand = require('../commands/CreateTokenCommand');
new CreateTokenCommand().render();
2 changes: 2 additions & 0 deletions bin/barracks-tokens.js → bin/barracks-token-ls
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env node

const TokensCommand = require('../commands/TokensCommand');
new TokensCommand().render();
2 changes: 2 additions & 0 deletions bin/barracks-revoke-token.js → bin/barracks-token-revoke
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env node

const RevokeTokenCommand = require('../commands/RevokeTokenCommand');
new RevokeTokenCommand().render();
20 changes: 20 additions & 0 deletions bin/barracks-update
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const program = require('commander');
const config = require('../config.js');
const pjson = require('../package.json');

const barracks = program
.version(pjson.version)
.command('ls', 'List updates')
.command('create', 'Create an update')
.command('edit', 'Edit an update')
.command('publish', 'Publish an update')
.command('schedule', 'Schedule an update publication')
.command('archive', 'Archive an update');

barracks.parse(process.argv);

process.on('SIGINT', () => {
process.exit();
});
2 changes: 2 additions & 0 deletions bin/barracks-archive.js → bin/barracks-update-archive
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env node

const ArchiveCommand = require('../commands/ArchiveCommand');
new ArchiveCommand().render();
2 changes: 2 additions & 0 deletions bin/barracks-create-update.js → bin/barracks-update-create
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env node

const CreateUpdateCommand = require('../commands/CreateUpdateCommand');
new CreateUpdateCommand().render();
2 changes: 2 additions & 0 deletions bin/barracks-edit-update.js → bin/barracks-update-edit
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env node

const EditUpdateCommand = require('../commands/EditUpdateCommand');
new EditUpdateCommand().render();
2 changes: 2 additions & 0 deletions bin/barracks-updates.js → bin/barracks-update-ls
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env node

const UpdatesCommand = require('../commands/UpdatesCommand');
new UpdatesCommand().render();
2 changes: 2 additions & 0 deletions bin/barracks-publish.js → bin/barracks-update-publish
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env node

const PublishCommand = require('../commands/PublishCommand');
new PublishCommand().render();
2 changes: 2 additions & 0 deletions bin/barracks-schedule.js → bin/barracks-update-schedule
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env node

const ScheduleCommand = require('../commands/ScheduleCommand');
new ScheduleCommand().render();

0 comments on commit bb16ba1

Please sign in to comment.