UNPKG

firmament-docker

Version:

Typescript classes for performing Docker operations

90 lines 3.81 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var __param = (this && this.__param) || function (paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } }; Object.defineProperty(exports, "__esModule", { value: true }); var MakeCommandImpl_1; const inversify_1 = require("inversify"); const inversify_config_1 = require("../../inversify.config"); const fs = require('fs'); let MakeCommandImpl = MakeCommandImpl_1 = class MakeCommandImpl { constructor(dockerMake) { this.dockerMake = dockerMake; this.aliases = []; this.command = ''; this.commandDesc = ''; this.handler = (argv) => { }; this.options = {}; this.subCommands = []; this.buildCommandTree(); } buildCommandTree() { this.aliases = ['make', 'm']; this.command = '<subCommand>'; this.commandDesc = 'Support for building Docker container clusters'; this.pushBuildCommand(); this.pushTemplateCommand(); } ; pushTemplateCommand() { let templateCommand = inversify_config_1.default.get('CommandImpl'); templateCommand.aliases = ['template', 't']; templateCommand.commandDesc = 'Create a template JSON spec for a container cluster'; templateCommand.options = { get: { alias: 'g', type: 'string', desc: '.. get [templateName]. If no templateName is specified then lists available templates' }, output: { alias: 'o', default: MakeCommandImpl_1.defaultConfigFilename, type: 'string', desc: 'Name the output JSON file' }, full: { alias: 'f', type: 'boolean', default: false, desc: 'Create a full JSON template with all Docker options set to reasonable defaults' } }; templateCommand.handler = this.dockerMake.makeTemplate.bind(this.dockerMake); this.subCommands.push(templateCommand); } ; pushBuildCommand() { let buildCommand = inversify_config_1.default.get('CommandImpl'); buildCommand.aliases = ['build', 'b']; buildCommand.commandDesc = 'Build Docker containers based on JSON spec'; buildCommand.options = { input: { alias: 'i', default: MakeCommandImpl_1.defaultConfigFilename, type: 'string', desc: 'Name the config JSON file' } }; buildCommand.handler = this.dockerMake.buildTemplate.bind(this.dockerMake); this.subCommands.push(buildCommand); } ; }; MakeCommandImpl.defaultConfigFilename = 'firmament.json'; MakeCommandImpl = MakeCommandImpl_1 = __decorate([ inversify_1.injectable(), __param(0, inversify_1.inject('DockerMake')), __metadata("design:paramtypes", [Object]) ], MakeCommandImpl); exports.MakeCommandImpl = MakeCommandImpl; //# sourceMappingURL=make-command-impl.js.map