crystal-lang / shards

Dependency manager for the Crystal language
Other
763 stars 100 forks source link

Error when using SHARDS_OVERRIDE #432

Closed jwoertink closed 3 years ago

jwoertink commented 4 years ago

If you have an override file that you want to commit to your repo, but you don't always need it to contain info, you might just comment out stuff to start. This causes this error:

❯ SHARDS_OVERRIDE=shard.override.yml shards install
Resolving dependencies
Error in shard.override.yml: Expected DOCUMENT_START but was STREAM_END at line 7, column 1

  5. #     github: luckyframework/lucky
  6. #     branch: master
  7.
     ^

Where my file is formatted like this:

# Uncomment if you need to override
# dependencies:
#   lucky:
#     github: luckyframework/lucky
#     branch: master

oh... actually just to double check, I tested with a blank file, and that doesn't work either

❯ SHARDS_OVERRIDE=shard.override.yml shards install
Resolving dependencies
Error in shard.override.yml: Expected DOCUMENT_START but was STREAM_END at line 1, column 1

  1.
     ^
bcardiff commented 4 years ago

Yup, agree. It's a side effect of how empty documents are interpreted.

A workaround that should work is to have dependencies key always present. Or use another filename shard.override-template.yml (?) .

jwoertink commented 4 years ago

Yeah, if I just make it contain the same version the main one does, it works as a workaround. I might try to see if I can get github actions to not export SHARDS_OVERRIDE if the file is empty or missing or something 😅

bcardiff commented 4 years ago

You can use the following as a placeholder. Not great, though.

dependencies: {}
# Uncomment if you need to override
# dependencies:
#   lucky:
#     github: luckyframework/lucky
#     branch: master
jwoertink commented 4 years ago

Ah, ok. Yeah, I was trying a few different combos that weren't working, but that's good to know. Thanks!