UNPKG

@cavai/adonis-queue

Version:
44 lines (43 loc) 1.89 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); }; Object.defineProperty(exports, "__esModule", { value: true }); const path_1 = require("path"); const ace_1 = require("@adonisjs/ace"); class StartQueue extends ace_1.BaseCommand { async run() { const stub = (0, path_1.join)(__dirname, '..', 'templates', 'ExampleJob.txt'); const path = this.application.rcFile.directories.jobs; this.generator .addFile(this.name, { pattern: 'pascalcase', form: 'singular' }) .stub(stub) .destinationDir(path || 'app/Jobs') .useMustache() .appRoot(this.application.cliCwd || this.application.appRoot); await this.generator.run(); } } StartQueue.settings = { stayAlive: false, loadApp: false, }; /** * Command Name is used to run the command */ StartQueue.commandName = 'make:job'; /** * Command Name is displayed in the "help" output */ StartQueue.description = 'Make a new job file for queue'; __decorate([ ace_1.args.string({ description: 'Name of the job class' }), __metadata("design:type", String) ], StartQueue.prototype, "name", void 0); exports.default = StartQueue;