Fixes #1 Allow for multiple artifacts
This commit is contained in:
22
src/ArtifactGlobber.ts
Normal file
22
src/ArtifactGlobber.ts
Normal 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))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user