woltlab-compiler
Version:
A compiler for WoltLab-Package Archives and WoltLab-Package Components
91 lines • 3 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const Path = require("path");
const SelfContainedPHPInstructionCompiler_1 = require("../../Compilation/PackageSystem/Instructions/SelfContainedPHPInstructionCompiler");
const ApplicationFileSystemInstruction_1 = require("./FileSystem/ApplicationFileSystemInstruction");
const InstructionSet_1 = require("./InstructionSet");
const PHPInstruction_1 = require("./PHPInstruction");
/**
* Represents an instruction which uploads and executes `php`-code.
*/
class SelfContainedPHPInstruction extends ApplicationFileSystemInstruction_1.ApplicationFileSystemInstruction {
/**
* Initializes a new instance of the `PHPInstruction` class.
*/
constructor(options) {
super(options);
this.Destination = options.Destination;
}
/**
* @inheritdoc
*/
get Compiler() {
return new SelfContainedPHPInstructionCompiler_1.SelfContainedPHPInstructionCompiler(this);
}
/**
* Gets or sets the path to load the `php`-file from.
*/
get Source() {
return super.Source;
}
set Source(value) {
super.Source = value;
}
/**
* @inheritdoc
*/
get FileName() {
return super.FileName;
}
/**
* @inheritdoc
*/
set FileName(value) {
super.FileName = value;
}
/**
* Gets or sets the path to save the `php`-file to.
*/
get Destination() {
return this.destination;
}
set Destination(value) {
this.destination = value;
}
/**
* Gets the file-instruction contained by this instruction.
*/
get FileInstruction() {
let collection = new InstructionSet_1.InstructionSet(this.Collection.Package);
collection.Directory = this.Collection.Directory;
let result = new ApplicationFileSystemInstruction_1.ApplicationFileSystemInstruction({
Application: this.Application,
Source: null,
FileName: this.FileName
});
collection.push(result);
return result;
}
/**
* Gets the php-instruction contained by this instruction.
*/
get PHPInstruction() {
let collection = new InstructionSet_1.InstructionSet(this.Collection.Package);
collection.Directory = this.Collection.Directory;
let result = new PHPInstruction_1.PHPInstruction({
Application: this.Application,
FileName: this.Destination,
Standalone: this.Standalone
});
collection.push(result);
return result;
}
/**
* @inheritdoc
*/
MakeDefaultFileName(source) {
return Path.join("scripts", "php", this.Application, super.MakeDefaultFileName(source));
}
}
exports.SelfContainedPHPInstruction = SelfContainedPHPInstruction;
//# sourceMappingURL=SelfContainedPHPInstruction.js.map