Skip to content

Commit

Permalink
Update JSON->YAML
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Amstutz committed Jul 16, 2019
1 parent 6a2dada commit 178c8b4
Show file tree
Hide file tree
Showing 25 changed files with 1,172 additions and 1,936 deletions.
41 changes: 41 additions & 0 deletions cwlex.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env cwl-runner
arguments:
- cwlex
- '$(inputs.inp ? inputs.inp.path : inputs.inpdir.path+''/''+inputs.inpfile)'
class: CommandLineTool
cwlVersion: v1.0
id: '#main'
inputs:
- id: inp
type:
- 'null'
- File
- id: inpdir
type:
- 'null'
- Directory
- id: inpfile
type:
- 'null'
- string
- id: outname
type:
- 'null'
- string
outputs:
- id: converted
outputBinding:
glob: $(outname(inputs))
type: File
requirements:
- class: DockerRequirement
dockerPull: commonworkflowlanguage/cwlex
- class: InlineJavascriptRequirement
expressionLib:
- |

function outname(inputs) {
return inputs.outname ? inputs.outname : (inputs.inp ? inputs.inp.nameroot+'.cwl' : inputs.inpfile.replace(/(.*).cwlex/, '$1.cwl'));
}
stdout: $(outname(inputs))

2 changes: 1 addition & 1 deletion src/cwlex-convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ CwlExListener.prototype.exitCall = function(ctx) {
if (find !== undefined && ctx.stepinputs().stepinput().length == 1
&& find.id != inkeys[0]) {
stepin[find.id] = stepin[inkeys[0]];
stepin[inkeys[0]] = undefined;
delete stepin[inkeys[0]];
}
}

Expand Down
63 changes: 25 additions & 38 deletions tests/antlr/antlr.cwl
Original file line number Diff line number Diff line change
@@ -1,39 +1,26 @@
#!/usr/bin/env cwl-runner
{
"arguments": [
"antlr4",
"-Dlanguage=JavaScript",
"-o",
".",
"$(inputs.file)"
],
"class": "CommandLineTool",
"cwlVersion": "v1.0",
"id": "#antlr",
"inputs": [
{
"default": {
"class": "File",
"location": "cwlex.g4"
},
"id": "file",
"type": "File"
}
],
"outputs": [
{
"id": "parser",
"outputBinding": {
"glob": "*.js"
},
"type": {
"items": "File",
"type": "array"
}
}
],
"requirements": {
"InlineJavascriptRequirement": {
}
}
}
arguments:
- antlr4
- '-Dlanguage=JavaScript'
- '-o'
- .
- $(inputs.file)
class: CommandLineTool
cwlVersion: v1.0
id: '#antlr'
inputs:
- default:
class: File
location: cwlex.g4
id: file
type: File
outputs:
- id: parser
outputBinding:
glob: '*.js'
type:
items: File
type: array
requirements:
InlineJavascriptRequirement: {}

112 changes: 40 additions & 72 deletions tests/assign/assign.cwl
Original file line number Diff line number Diff line change
@@ -1,73 +1,41 @@
#!/usr/bin/env cwl-runner
{
"$graph": [
{
"arguments": [
"echo",
"$(inputs.msg)"
],
"class": "CommandLineTool",
"id": "#echo",
"inputs": [
{
"id": "msg",
"type": "string"
}
],
"outputs": [
{
"id": "out",
"outputBinding": {
"glob": "blub.txt"
},
"type": "File"
}
],
"requirements": {
"InlineJavascriptRequirement": {
}
},
"stdout": "blub.txt"
},
{
"class": "Workflow",
"id": "#main",
"inputs": [
],
"outputs": [
{
"id": "e",
"outputSource": "echo_1/out",
"type": "File"
}
],
"requirements": {
"InlineJavascriptRequirement": {
},
"MultipleInputFeatureRequirement": {
},
"ScatterFeatureRequirement": {
},
"StepInputExpressionRequirement": {
},
"SubworkflowFeatureRequirement": {
}
},
"steps": [
{
"id": "echo_1",
"in": {
"msg": {
"default": "hello world"
}
},
"out": [
"out"
],
"run": "#echo"
}
]
}
],
"cwlVersion": "v1.0"
}
$graph:
- arguments:
- echo
- $(inputs.msg)
class: CommandLineTool
id: '#echo'
inputs:
- id: msg
type: string
outputs:
- id: out
outputBinding:
glob: blub.txt
type: File
requirements:
InlineJavascriptRequirement: {}
stdout: blub.txt
- class: Workflow
id: '#main'
inputs: []
outputs:
- id: e
outputSource: echo_1/out
type: File
requirements:
InlineJavascriptRequirement: {}
MultipleInputFeatureRequirement: {}
ScatterFeatureRequirement: {}
StepInputExpressionRequirement: {}
SubworkflowFeatureRequirement: {}
steps:
- id: echo_1
in:
msg:
default: hello world
out:
- out
run: '#echo'
cwlVersion: v1.0

134 changes: 50 additions & 84 deletions tests/const/const_values.cwl
Original file line number Diff line number Diff line change
@@ -1,85 +1,51 @@
#!/usr/bin/env cwl-runner
{
"class": "Workflow",
"cwlVersion": "v1.0",
"id": "#main",
"inputs": [
{
"default": 12,
"id": "intval",
"type": "int"
},
{
"default": 1.2,
"id": "floatval",
"type": "float"
},
{
"default": "foobar",
"id": "strval",
"type": "string"
},
{
"default": {
"class": "File",
"location": "hello.txt"
},
"id": "fileval",
"type": "File"
},
{
"default": [
"a",
"b",
{
"c": [
13,
"d"
]
}
],
"id": "listval",
"type": "Any"
},
{
"default": {
"a": "b",
"c": {
"d": "e"
},
"f": [
"g",
12
]
},
"id": "structval",
"type": "Any"
}
],
"outputs": [
{
"id": "iv",
"outputSource": "intval",
"type": "int"
},
{
"id": "fv",
"outputSource": "floatval",
"type": "float"
}
],
"requirements": {
"InlineJavascriptRequirement": {
},
"MultipleInputFeatureRequirement": {
},
"ScatterFeatureRequirement": {
},
"StepInputExpressionRequirement": {
},
"SubworkflowFeatureRequirement": {
}
},
"steps": [
]
}
class: Workflow
cwlVersion: v1.0
id: '#main'
inputs:
- default: 12
id: intval
type: int
- default: 1.2
id: floatval
type: float
- default: foobar
id: strval
type: string
- default:
class: File
location: hello.txt
id: fileval
type: File
- default:
- a
- b
- c:
- 13
- d
id: listval
type: Any
- default:
a: b
c:
d: e
f:
- g
- 12
id: structval
type: Any
outputs:
- id: iv
outputSource: intval
type: int
- id: fv
outputSource: floatval
type: float
requirements:
InlineJavascriptRequirement: {}
MultipleInputFeatureRequirement: {}
ScatterFeatureRequirement: {}
StepInputExpressionRequirement: {}
SubworkflowFeatureRequirement: {}
steps: []

Loading

0 comments on commit 178c8b4

Please sign in to comment.