mirror of
https://github.com/iv-org/invidious.git
synced 2026-10-25 06:02:55 +00:00
feat: show message for unsupported Crystal versions at compile time (#5909)
Show a nice message for unsupported versions of the Crystal compiler, encouraging the user compiling Invidious, to update it's Crystal compiler version.
This commit is contained in:
@@ -50,6 +50,27 @@ require "./invidious/routes/**"
|
||||
require "./invidious/jobs/base_job"
|
||||
require "./invidious/jobs/*"
|
||||
|
||||
# Show a nice message in case the current Crystal compiler version is unsupoported```
|
||||
# encouraging the user compiling Invidious to update it```
|
||||
# version.
|
||||
{% begin %}
|
||||
# `-Dskip_version_check` compile-time flag, for development purposes
|
||||
# or weird installations that lack the `shard.yml` file when compiling
|
||||
# Invidious.
|
||||
{% if !flag?(:skip_version_check) %}
|
||||
{% 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 %}
|
||||
|
||||
# Declare the base namespace for invidious
|
||||
module Invidious
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user