Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Sherman <[email protected]>
  • Loading branch information
bentsherman committed Oct 18, 2023
1 parent 8fb0025 commit 44249bb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 69 deletions.
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,6 @@ prov {

List of file patterns to include in the provenance report, from the set of published files. By default, all published files are included.

## Examples

```bash
nextflow run https://github.com/ORGANIZATION/REPOSITORY_ID -profile docker
nextflow run https://bitbucket.org/ORGANIZATION/REPOSITORY_ID -profile docker
nextflow run https://gitlab.com/PROJECT/REPOSITORY_ID -profile docker
```

## Development

Run the following commands to build and test the nf-prov Nextflow plugin. Refer to the [nf-hello](https://github.com/nextflow-io/nf-hello) README for additional instructions (_e.g._ for publishing the plugin).
Expand Down
58 changes: 0 additions & 58 deletions plugins/nf-prov/src/main/nextflow/prov/BcoRenderer.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -39,58 +39,6 @@ class BcoRenderer implements Renderer {

private boolean overwrite

private URL repository

private String commitId

private String launchDir

private String projectDir

private String workDir

/**
* Normalize local paths to remove environment-specific directories.
*
* @param path
*/
private String normalizePath(Path path) {
normalizePath(path.toUriString())
}

private String normalizePath(String path) {
// replace work directory with relative path
if( path.startsWith(workDir) )
return path.replace(workDir, 'work')

// replace project directory with source URL (if applicable)
if( repository && path.startsWith(projectDir) )
return getProjectSourceUrl(path)

// replace launch directory with relative path
if( path.startsWith(launchDir) )
return path.replace(launchDir + '/', '')

return path
}

/**
* Get the source URL for a project asset.
*
* @param path
*/
private String getProjectSourceUrl(String path) {
// TODO: add other git providers
if( repository.host == 'github.com' )
return path.replace(projectDir, "${repository}/tree/${commitId}")
else if( repository.host == 'bitbucket.org' )
return path.replace(projectDir, "${repository}/src/${commitId}")
else if( repository.host == 'gitlab.com' )
return path.replace(projectDir, "${repository}/-/tree/${commitId}")
else
return path
}

@Delegate
private PathNormalizer normalizer

Expand All @@ -114,12 +62,6 @@ class BcoRenderer implements Renderer {
final manifest = metadata.manifest
final nextflowMeta = metadata.nextflow

this.repository = metadata.repository ? new URL(metadata.repository) : null
this.commitId = metadata.commitId
this.projectDir = metadata.projectDir.toUriString()
this.launchDir = metadata.launchDir.toUriString()
this.workDir = metadata.workDir.toUriString()

final dateCreated = DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(metadata.start)
final authors = (manifest.author ?: '').tokenize(',')*.trim()
final nextflowVersion = nextflowMeta.version.toString()
Expand Down
11 changes: 8 additions & 3 deletions plugins/nf-prov/src/main/nextflow/prov/PathNormalizer.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,16 @@ class PathNormalizer {
* @param path
*/
private String getProjectSourceUrl(String path) {
// TODO: add other git providers
if( repository.host == 'github.com' )
switch( repository.host ) {
case 'bitbucket.org':
return path.replace(projectDir, "${repository}/src/${commitId}")
case 'github.com':
return path.replace(projectDir, "${repository}/tree/${commitId}")
else
case 'gitlab.com':
return path.replace(projectDir, "${repository}/-/tree/${commitId}")
default:
return path
}
}

}

0 comments on commit 44249bb

Please sign in to comment.