hudson.util.DirScanner Java Examples

The following examples show how to use hudson.util.DirScanner. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WorkSpaceZipper.java    From aws-lambda-jenkins-plugin with MIT License 6 votes vote down vote up
private File getArtifactZip(FilePath artifactLocation) throws IOException, InterruptedException {
    File resultFile = File.createTempFile("awslambda-", ".zip");

    if (!artifactLocation.isDirectory()) {
        if(artifactLocation.exists()) {
            logger.log("Copying zip file");
            artifactLocation.copyTo(new FileOutputStream(resultFile));
        } else {
            throw new LambdaDeployException("Could not find zipfile or folder.");
        }
    } else {
        logger.log("Zipping folder ..., copying zip file");
        artifactLocation.zip(new FileOutputStream(resultFile), new DirScanner.Glob("**", null, false));
    }

    logger.log("File Name: %s%nAbsolute Path: %s%nFile Size: %d", resultFile.getName(), resultFile.getAbsolutePath(), resultFile.length());
    return resultFile;
}
 
Example #2
Source File: BuildAndUploadArchive.java    From awseb-deployment-plugin with Apache License 2.0 6 votes vote down vote up
private File getLocalFileObject(FilePath rootFileObject) throws Exception {
    File resultFile = File.createTempFile("awseb-", ".zip");

    if (!rootFileObject.isDirectory()) {
        log("Root File Object is a file. We assume its a zip file, which is okay.");

        rootFileObject.copyTo(new FileOutputStream(resultFile));
    } else {
        log("Zipping contents of Root File Object (%s) into tmp file %s (includes=%s, excludes=%s)",
                rootFileObject.getName(), resultFile.getName(),
                getConfig().getIncludes(), getConfig().getExcludes());

        rootFileObject.zip(new FileOutputStream(resultFile),
                new DirScanner.Glob(getConfig().getIncludes(),
                        getConfig().getExcludes()));
    }

    return resultFile;
}
 
Example #3
Source File: S3UploadAllCallable.java    From jobcacher-plugin with MIT License 5 votes vote down vote up
public S3UploadAllCallable(ClientHelper clientHelper, String fileMask, String excludes, String bucketName, String pathPrefix, Map<String, String> userMetadata, String storageClass, boolean useServerSideEncryption) {
    super(clientHelper, userMetadata, storageClass, useServerSideEncryption);
    this.bucketName = bucketName;
    this.pathPrefix = pathPrefix;

    scanner = new DirScanner.Glob(fileMask, excludes);
}
 
Example #4
Source File: S3DownloadAllCallable.java    From jobcacher-plugin with MIT License 5 votes vote down vote up
public S3DownloadAllCallable(ClientHelper helper, String fileMask, String excludes, String bucketName, String pathPrefix) {
    super(helper);
    this.bucketName = bucketName;
    this.pathPrefix = pathPrefix;

    scanner = new DirScanner.Glob(fileMask, excludes);
}