catstodon/lib/mastodon/version.rb
Jeremy Kescher c0382b1446
Some checks failed
CodeQL / Analyze (javascript) (push) Has been cancelled
Check formatting / lint (push) Has been cancelled
CSS Linting / lint (push) Has been cancelled
Bundler Audit / security (push) Has been cancelled
Check i18n / check-i18n (push) Has been cancelled
JavaScript Linting / lint (push) Has been cancelled
JavaScript Testing / test (push) Has been cancelled
Ruby Testing / build (production) (push) Has been cancelled
Ruby Testing / build (test) (push) Has been cancelled
CodeQL / Analyze (ruby) (push) Has been cancelled
Haml Linting / lint (push) Has been cancelled
Ruby Linting / lint (push) Has been cancelled
Historical data migration test / test (14-alpine) (push) Has been cancelled
Historical data migration test / test (15-alpine) (push) Has been cancelled
Ruby Testing / test (.ruby-version) (push) Has been cancelled
Ruby Testing / test (3.1) (push) Has been cancelled
Ruby Testing / test (3.2) (push) Has been cancelled
Ruby Testing / Libvips tests (.ruby-version) (push) Has been cancelled
Ruby Testing / Libvips tests (3.1) (push) Has been cancelled
Ruby Testing / Libvips tests (3.2) (push) Has been cancelled
Ruby Testing / End to End testing (.ruby-version) (push) Has been cancelled
Ruby Testing / End to End testing (3.1) (push) Has been cancelled
Ruby Testing / End to End testing (3.2) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:8.10.2) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (.ruby-version, opensearchproject/opensearch:2) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (3.1, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (3.2, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Has been cancelled
Mark nightly version
2024-08-31 13:12:03 +02:00

75 lines
1.5 KiB
Ruby

# frozen_string_literal: true
module Mastodon
module Version
module_function
def major
4
end
def minor
3
end
def patch
0
end
def default_prerelease
'beta.1'
end
def prerelease
ENV['MASTODON_VERSION_PRERELEASE'].presence || default_prerelease
end
def catstodon_revision
'1.0.0+nightly'
end
def build_metadata
["cat.#{catstodon_revision}", ENV.fetch('MASTODON_VERSION_METADATA', nil)].compact_blank.join('.')
end
def to_a
[major, minor, patch].compact
end
def to_s
components = [to_a.join('.')]
components << "-#{prerelease}" if prerelease.present?
components << "+#{build_metadata}" if build_metadata.present?
components.join
end
def gem_version
@gem_version ||= Gem::Version.new(to_s.split('+')[0])
end
def repository
ENV.fetch('GITHUB_REPOSITORY', 'CatCatNya/catstodon')
end
def source_base_url
ENV.fetch('SOURCE_BASE_URL', "https://github.com/#{repository}")
end
# specify git tag or commit hash here
def source_tag
ENV.fetch('SOURCE_TAG', nil)
end
def source_url
if source_tag
"#{source_base_url}/tree/#{source_tag}"
else
source_base_url
end
end
def user_agent
@user_agent ||= "Mastodon/#{Version} (#{HTTP::Request::USER_AGENT}; +http#{Rails.configuration.x.use_https ? 's' : ''}://#{Rails.configuration.x.web_domain}/)"
end
end
end