update default repository/source metadata
parent
31a8e0eff5
commit
0180179a72
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue