update default repository/source metadata

pull/44/head
kouhai dev 2022-11-27 23:43:56 -06:00
parent 051f883fbf
commit 8a10baa676
2 changed files with 11 additions and 6 deletions

View File

@ -33,11 +33,11 @@ module Mastodon
end end
def repository def repository
ENV.fetch('GITHUB_REPOSITORY', 'glitch-soc/mastodon') ENV.fetch('GIT_REPOSITORY', false) || ENV.fetch('GITHUB_REPOSITORY', false) || 'treehouse/mastodon'
end end
def source_base_url def source_base_url
ENV.fetch('SOURCE_BASE_URL', "https://github.com/#{repository}") ENV.fetch('SOURCE_BASE_URL', "https://gitea.treehouse.systems/#{repository}")
end end
# specify git tag or commit hash here # specify git tag or commit hash here
@ -46,8 +46,13 @@ module Mastodon
end end
def source_url def source_url
if source_tag if source_tag && source_base_url =~ /gitea/
"#{source_base_url}/tree/#{source_tag}" suffix = if !str[/\H/]
"commit/#{source_tag}"
else
"branch/#{source_tag}"
end
"#{source_base_url}/#{suffix}"
else else
source_base_url source_base_url
end end

View File

@ -87,8 +87,8 @@ describe InstancePresenter do
end end
describe '#source_url' do describe '#source_url' do
it 'returns "https://github.com/glitch-soc/mastodon"' do it 'returns the default URL' do
expect(instance_presenter.source_url).to eq('https://github.com/glitch-soc/mastodon') expect(instance_presenter.source_url).to eq('https://gitea.treehouse.systems/treehouse/mastodon')
end end
end end