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,7 +58,8 @@ require "./invidious/jobs/*"
# or weird installations that lack the `shard.yml` file when compiling # or weird installations that lack the `shard.yml` file when compiling
# Invidious. # Invidious.
{% if !flag?(:skip_version_check) %} {% if !flag?(:skip_version_check) %}
{% shard_yml = read_file("shard.yml") %} {% if file_exists?("#{__DIR__}/../shard.yml") %}
{% shard_yml = read_file("#{__DIR__}/../shard.yml") %}
{% crystal_constraint = shard_yml.split('\n').find(&.starts_with?("crystal:")) %} {% crystal_constraint = shard_yml.split('\n').find(&.starts_with?("crystal:")) %}
{% minimum_version = crystal_constraint.split('"')[1].split(",").first.split(">=").last.strip %} {% minimum_version = crystal_constraint.split('"')[1].split(",").first.split(">=").last.strip %}
{% if compare_versions(Crystal::VERSION, minimum_version) < 0 %} {% if compare_versions(Crystal::VERSION, minimum_version) < 0 %}
@ -68,6 +69,7 @@ require "./invidious/jobs/*"
{% end %} {% end %}
{% end %} {% end %}
{% end %} {% end %}
{% end %}
# Declare the base namespace for invidious # Declare the base namespace for invidious
module Invidious module Invidious