Fixes #1 Allow for multiple artifacts

This commit is contained in:
Nick Cipollo
2019-09-02 17:20:04 -04:00
parent 261c1fc08b
commit a698287254
24 changed files with 462 additions and 167 deletions

22
src/ArtifactGlobber.ts Normal file
View File

@@ -0,0 +1,22 @@
import { Globber, FileGlobber } from "./Globber";
import { Artifact } from "./Artifact";
export interface ArtifactGlobber {
globArtifactString(artifact: string, contentType: string): Artifact[]
}
export class FileArtifactGlobber implements ArtifactGlobber {
private globber: Globber
constructor(globber: Globber = new FileGlobber()) {
this.globber = globber
}
globArtifactString(artifact: string, contentType: string): Artifact[] {
return artifact.split(',')
.map((path) => this.globber.glob(path))
.reduce((accumulated, current) => accumulated.concat(current))
.map((path) => new Artifact(path, contentType))
}
}