th: update default repository/source metadata

lolsob-rspec
kouhai dev 2022-11-27 23:43:56 -06:00
parent d5ee2194be
commit 7e3f723320
2 changed files with 11 additions and 6 deletions

View File

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

View File

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