diff --git a/modules/nextflow/src/main/groovy/nextflow/cli/CmdRun.groovy b/modules/nextflow/src/main/groovy/nextflow/cli/CmdRun.groovy index daa686b878..213319c02f 100644 --- a/modules/nextflow/src/main/groovy/nextflow/cli/CmdRun.groovy +++ b/modules/nextflow/src/main/groovy/nextflow/cli/CmdRun.groovy @@ -630,7 +630,7 @@ class CmdRun extends CmdBase implements HubOptions { /* * try to look for a pipeline in the repository */ - def manager = new AssetManager(pipelineName, this) + def manager = new AssetManager(pipelineName, mainScript, this) def repo = manager.getProject() boolean checkForUpdate = true diff --git a/modules/nextflow/src/main/groovy/nextflow/scm/AssetManager.groovy b/modules/nextflow/src/main/groovy/nextflow/scm/AssetManager.groovy index b35f1a06d2..75fc112aab 100644 --- a/modules/nextflow/src/main/groovy/nextflow/scm/AssetManager.groovy +++ b/modules/nextflow/src/main/groovy/nextflow/scm/AssetManager.groovy @@ -106,6 +106,14 @@ class AssetManager { build(pipelineName, config, cliOpts) } + AssetManager( String pipelineName, String scriptFile, HubOptions cliOpts = null) { + assert pipelineName + // read the default config file (if available) + def config = ProviderConfig.getDefault() + // build the object + build(pipelineName, config, cliOpts, scriptFile) + } + AssetManager( String pipelineName, Map config ) { assert pipelineName // build the object @@ -121,10 +129,11 @@ class AssetManager { * @return The {@link AssetManager} object itself */ @PackageScope - AssetManager build( String pipelineName, Map config = null, HubOptions cliOpts = null ) { + AssetManager build( String pipelineName, Map config = null, HubOptions cliOpts = null, String scriptFile = null) { this.providerConfigs = ProviderConfig.createFromMap(config) - + if( scriptFile ) + this.mainScript = scriptFile this.project = resolveName(pipelineName) this.localPath = checkProjectDir(project) this.hub = checkHubProvider(cliOpts) @@ -311,6 +320,9 @@ class AssetManager { if( !isUrl ) return null + if( repository.endsWith('.nf') || repository.endsWith('.nxf') ) + throw new AbortOperationException("Repository URL can end as a script file (.nf|.nxf) - Use -main-script option.") + try { def url = new GitUrl(repository)