diff --git a/src/invidious.cr b/src/invidious.cr index 94d92442d..cc65dde0e 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -58,13 +58,15 @@ require "./invidious/jobs/*" # or weird installations that lack the `shard.yml` file when compiling # Invidious. {% if !flag?(:skip_version_check) %} - {% shard_yml = read_file("shard.yml") %} - {% crystal_constraint = shard_yml.split('\n').find(&.starts_with?("crystal:")) %} - {% minimum_version = crystal_constraint.split('"')[1].split(",").first.split(">=").last.strip %} - {% if compare_versions(Crystal::VERSION, minimum_version) < 0 %} - {{ raise "Crystal version #{minimum_version} or newer is required to build Invidious. \ - You currently have Crystal version #{Crystal::VERSION} installed. \ - We recommend that you install it following the way that the team behind the Crystal compiler itself recommend for your OS, see: https://crystal-lang.org/install/" }} + {% if file_exists?("#{__DIR__}/../shard.yml") %} + {% shard_yml = read_file("#{__DIR__}/../shard.yml") %} + {% crystal_constraint = shard_yml.split('\n').find(&.starts_with?("crystal:")) %} + {% minimum_version = crystal_constraint.split('"')[1].split(",").first.split(">=").last.strip %} + {% if compare_versions(Crystal::VERSION, minimum_version) < 0 %} + {{ raise "Crystal version #{minimum_version} or newer is required to build Invidious. \ + You currently have Crystal version #{Crystal::VERSION} installed. \ + We recommend that you install it following the way that the team behind the Crystal compiler itself recommend for your OS, see: https://crystal-lang.org/install/" }} + {% end %} {% end %} {% end %} {% end %}