Reputation: 141
Hello Crystal priests,
I have built an app, snob, on my development vm running crystal 0.23.1 on fedora26. It runs fine locally. This is a release build. I copy the app to my host machine, fedora27, and attempt to run it, I get an error complaining about shard.yml. The same happens on any of my centos machines. The error:
Error opening file
'/vagrant/Projects/crystal/snob/src/snob/../../shard.yml' with mode 'r': No such file or directory (Errno)
Failed to raise an exception: END_OF_STACK
[0x40e807] __crystal_raise +375
[0x411f05] ???
[0x41f595] ???
[0x417291] ???
[0x41611a] ???
[0x42d37a] main +7914
[0x7f8783b5100a] __libc_start_main +234
[0x40e2da] _start +42
[0x0] ???
What am I missing? I was under the impression that this is a stand-alone executable. No amount of head scratching or googling is turning up anything.
Thanks in advance to anyone who can help me. Meanwhile, I'm still looking.
Upvotes: 1
Views: 284
Reputation: 141
With Crystal v0.24.1 and Shards v0.7.2 I can now keep versions in one place using:
VERSION = {{ `shards version #{__DIR__}`.chomp.stringify }}
This fixes the problem I created above.
Upvotes: 0
Reputation: 141
My source code in version.cr:
VERSION = begin
YAML.parse(File.join(__DIR__, "../..", "shard.yml")))["version"].as_s
end
I was trying to keep the version in one place for updating during developing and inadvertently introduced an unwanted error. My app now depended on having shard.yml located in my path somewhere. Ouch! Changing the VERSION constant to a literal string, "x.x.x" and rebuilding fixed the issue. My source is located at https://github.com/lebogan/snob.git.
Thanks @Eric Platon for the posting suggestion.
Upvotes: 1