diff --git a/plugins/nf-quilt/src/main/nextflow/quilt/QuiltProduct.groovy b/plugins/nf-quilt/src/main/nextflow/quilt/QuiltProduct.groovy index dbdb7c17..98e61441 100644 --- a/plugins/nf-quilt/src/main/nextflow/quilt/QuiltProduct.groovy +++ b/plugins/nf-quilt/src/main/nextflow/quilt/QuiltProduct.groovy @@ -44,6 +44,8 @@ import groovy.json.JsonOutput @CompileStatic class QuiltProduct { public final static String README_FILE = 'README_NF_QUILT.md' + public final static String SUMMARY_FILE = 'quilt_summarize.json' + private final static String KEY_META = 'metadata' private final static String KEY_README = 'readme' @@ -64,7 +66,7 @@ class QuiltProduct { ## processes ${meta['workflow']['stats']['processes']} ''' - private final static String DEFAULT_SUMMARIZE = '**.md,**.html' + private final static String DEFAULT_SUMMARIZE = '*.md,*.html,*.?sv,*.pdf,multiqc/multiqc_report.html' private final static String[] BIG_KEYS = [ 'nextflow', 'commandLine', 'scriptFile', 'projectDir', @@ -276,7 +278,7 @@ ${meta['workflow']['stats']['processes']} } String qs_json = JsonOutput.toJson(quilt_summarize.keySet() as String[]) - writeString(qs_json, pkg, 'quilt_summarize.json') + writeString(qs_json, pkg, SUMMARY_FILE) return quilt_summarize } diff --git a/plugins/nf-quilt/src/test/nextflow/quilt/QuiltProductTest.groovy b/plugins/nf-quilt/src/test/nextflow/quilt/QuiltProductTest.groovy index 398b6ca1..2eb0e0ab 100644 --- a/plugins/nf-quilt/src/test/nextflow/quilt/QuiltProductTest.groovy +++ b/plugins/nf-quilt/src/test/nextflow/quilt/QuiltProductTest.groovy @@ -20,9 +20,14 @@ import nextflow.Session import nextflow.quilt.QuiltSpecification import nextflow.quilt.QuiltProduct import nextflow.quilt.jep.QuiltParser +import nextflow.quilt.jep.QuiltPackage +import java.nio.file.Files +import java.nio.file.Path +import java.nio.file.Paths import groovy.transform.CompileDynamic import spock.lang.IgnoreIf +import spock.lang.Unroll /** * @@ -145,4 +150,45 @@ class QuiltProductTest extends QuiltSpecification { makeWriteProduct(skip_meta).pubStatus == 1 // still fails on implicit metadata } + void writeFile(root, filename) { + Path outPath = Paths.get(root, filename) + outPath.getParent().toFile().mkdirs() + Files.writeString(outPath, "#Time, Filename\n${timestamp},${filename}") + println("writeFile: ${filename} -> ${outPath}") + } + + int writeFiles(dest) { + String root = dest.toString() + String[] filenames = [ + 'SUMMARIZE_ME.md', + 'SUMMARIZE_ME.csv', + 'SUMMARIZE_ME.tsv', + 'SUMMARIZE_ME.html', + 'SUMMARIZE_ME.pdf', + 'SUMMARIZE_ME.xml', + 'multiqc/multiqc_report.html' + ] + filenames.each { writeFile(root, it) } + return filenames.size() + } + + @Unroll + @IgnoreIf({ env.WRITE_BUCKET == 'quilt-example' || env.WRITE_BUCKET == null }) + void 'should summarize top-level readable files + multiqc '() { + given: + String sumURL = writeableURL('summarized') + QuiltPackage sumPkg = writeablePackage('summarized') + writeFiles(sumPkg.packageDest()) + + and: + Session session = Mock(Session) + QuiltPath path = QuiltPathFactory.parse(sumURL) + QuiltProduct product = new QuiltProduct(path, session) + + expect: + product.publish() == 0 + sumPkg.install() + Files.exists(Paths.get(sumPkg.packageDest().toString(), QuiltProduct.SUMMARY_FILE)) + } + }