only decode the first block of yaml
aloisio31 opened this issue · comments
yaml:
---
hooks:
AfterInstall:
- location: /Users/derekmorgan/src/deploy-plugin/afterinstall.sh
timeout: 2
- location: /Users/derekmorgan/src/deploy-plugin/afterinstall.sh
timeout: 2
files:
- source: ./my-file.txt
destination: /temp
lua:
tprint(require('yaml').eval(s), 1)
hooks:
AfterInstall:
1:
location: /Users/derekmorgan/src/deploy-plugin/afterinstall.sh
timeout: 2
2:
location: /Users/derekmorgan/src/deploy-plugin/afterinstall.sh
timeout: 2
Sounds like it should be parsed, other implementations do:
irb(main):035:0> str="---\nhooks:\n AfterInstall:\n - location: /Users/derekmorgan/src/deploy-plugin/afterinstall.sh\n timeout: 2\n - location: /Users/derekmorgan/src/deploy-plugin/afterinstall.sh\
n timeout: 2\nfiles:\n - source: ./my-file.txt\n destination: /temp\n"
=> "---\nhooks:\n AfterInstall:\n - location: /Users/derekmorgan/src/deploy-plugin/afterinstall.sh\n timeout: 2\n - location: /Users/derekmorgan/src/deploy-plugin/afterinstall.sh\n timeou...
irb(main):036:0> puts str
---
hooks:
AfterInstall:
- location: /Users/derekmorgan/src/deploy-plugin/afterinstall.sh
timeout: 2
- location: /Users/derekmorgan/src/deploy-plugin/afterinstall.sh
timeout: 2
files:
- source: ./my-file.txt
destination: /temp
=> nil
irb(main):037:0> YAML.load_stream str
=>
[{"hooks"=>{"AfterInstall"=>[{"location"=>"/Users/derekmorgan/src/deploy-plugin/afterinstall.sh", "timeout"=>2}, {"location"=>"/Users/derekmorgan/src/deploy-plugin/afterinstall.sh", "timeout"=>2}]},
"files"=>[{"source"=>"./my-file.txt", "destination"=>"/temp"}]}]