skip version checking if shard.yml file is missing

This commit is contained in:
Fijxu 2026-08-21 22:21:11 -04:00
parent 7e70ba2d74
commit 59dd9c9191
No known key found for this signature in database
GPG Key ID: 32C1DDF333EDA6A4

View File

@ -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 %}