Skip to content

Commit

Permalink
Add funding links to sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
gjtorikian committed Oct 2, 2020
1 parent c3fb97c commit 7666826
Show file tree
Hide file tree
Showing 16 changed files with 35 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/models/concerns/rubygem_searchable.rb
Expand Up @@ -35,6 +35,7 @@ def as_indexed_json(_options = {}) # rubocop:disable Metrics/MethodLength
source_code_uri: versioned_links&.source_code_uri,
bug_tracker_uri: versioned_links&.bug_tracker_uri,
changelog_uri: versioned_links&.changelog_uri,
funding_uri: versioned_links&.funding_uri,
yanked: versions.none?(&:indexed?),
summary: latest_version&.summary,
description: latest_version&.description,
Expand Down
3 changes: 2 additions & 1 deletion app/models/links.rb
Expand Up @@ -8,7 +8,8 @@ class Links
"wiki" => "wiki_uri",
"mail" => "mailing_list_uri",
"bugs" => "bug_tracker_uri",
"download" => "download_uri"
"download" => "download_uri",
"funding" => "funding_uri"
}.freeze

# Links available for non-indexed gems
Expand Down
1 change: 1 addition & 0 deletions app/models/rubygem.rb
Expand Up @@ -187,6 +187,7 @@ def payload(version = versions.most_recent, protocol = Gemcutter::PROTOCOL, host
"source_code_uri" => versioned_links.source_code_uri,
"bug_tracker_uri" => versioned_links.bug_tracker_uri,
"changelog_uri" => versioned_links.changelog_uri,
"funding_uri" => versioned_links.funding_uri,
"dependencies" => {
"development" => deps.select { |r| r.rubygem && r.scope == "development" },
"runtime" => deps.select { |r| r.rubygem && r.scope == "runtime" }
Expand Down
1 change: 1 addition & 0 deletions config/locales/de.yml
Expand Up @@ -36,6 +36,7 @@ de:
docs: Dokumentation URL
mail: Mailingliste URL
wiki: Wiki URL
funding:
session:
password: Passwort
who: E-Mail oder Benutzername
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Expand Up @@ -44,6 +44,7 @@ en:
docs: Documentation URL
mail: Mailing List URL
wiki: Wiki URL
funding: Funding URL
session:
password: Password
who: Email or Username
Expand Down
1 change: 1 addition & 0 deletions config/locales/es.yml
Expand Up @@ -44,6 +44,7 @@ es:
docs: URL de la documentación
mail: URL de la lista de correo
wiki: URL de la Wiki
funding:
session:
password: Contraseña
who: Correo electrónico o usuario
Expand Down
1 change: 1 addition & 0 deletions config/locales/fr.yml
Expand Up @@ -36,6 +36,7 @@ fr:
docs: URL de la documentation
mail: URL de la liste de diffusion
wiki: URL du wiki
funding:
session:
password: Mot de passe
who: Email ou pseudonyme
Expand Down
1 change: 1 addition & 0 deletions config/locales/ja.yml
Expand Up @@ -36,6 +36,7 @@ ja:
docs: ドキュメントのURL
mail: メーリングリストのURL
wiki: WikiのURL
funding:
session:
password: パスワード
who: Email又はユーザー名
Expand Down
1 change: 1 addition & 0 deletions config/locales/nl.yml
Expand Up @@ -36,6 +36,7 @@ nl:
docs: Documentatie-URL
mail: Mailing-list-URL
wiki: Wiki URL
funding:
session:
password: Wachtwoord
who: E-mail of Gebruikersnaam
Expand Down
1 change: 1 addition & 0 deletions config/locales/pt-BR.yml
Expand Up @@ -36,6 +36,7 @@ pt-BR:
docs: URL da Documentação
mail: URL da Lista de Emails
wiki: URL da Wiki
funding:
session:
password: Senha
who: Email ou Usuário
Expand Down
1 change: 1 addition & 0 deletions config/locales/zh-CN.yml
Expand Up @@ -36,6 +36,7 @@ zh-CN:
docs: 文档 URL
mail: 邮件列表 URL
wiki: Wiki URL
funding:
session:
password: 密码
who: Email / 账号
Expand Down
1 change: 1 addition & 0 deletions config/locales/zh-TW.yml
Expand Up @@ -36,6 +36,7 @@ zh-TW:
docs: 文件 URL
mail: 郵件群組 URL
wiki: Wiki URL
funding:
session:
password: 密碼
who: Email / 帳號
Expand Down
1 change: 1 addition & 0 deletions lib/elastic_searcher.rb
Expand Up @@ -99,6 +99,7 @@ def api_source
wiki_uri
documentation_uri
mailing_list_uri
funding_uri
source_code_uri
bug_tracker_uri
changelog_uri]
Expand Down
1 change: 1 addition & 0 deletions test/unit/pusher_test.rb
Expand Up @@ -317,6 +317,7 @@ class PusherTest < ActiveSupport::TestCase
"source_code_uri" => "http://example.com",
"bug_tracker_uri" => "http://example.com",
"changelog_uri" => nil,
"funding_uri" => nil,
"yanked" => false,
"summary" => "old summary",
"description" => "Some awesome gem",
Expand Down
19 changes: 17 additions & 2 deletions test/unit/rubygem_searchable_test.rb
Expand Up @@ -15,7 +15,15 @@ class RubygemSearchableTest < ActiveSupport::TestCase
number: "1.0.1",
rubygem: @rubygem,
summary: "some summary",
description: "some description")
description: "some description",
metadata: {
"homepage_uri" => "http://example.com",
"source_code_uri" => "http://example.com",
"wiki_uri" => "http://example.com",
"mailing_list_uri" => "http://example.com",
"bug_tracker_uri" => "http://example.com",
"funding_uri" => "http://example.com"
})
end

should "return a hash" do
Expand All @@ -35,7 +43,14 @@ class RubygemSearchableTest < ActiveSupport::TestCase
authors: "Joe User",
info: "some description",
licenses: "MIT",
metadata: { "foo" => "bar" },
metadata: {
"homepage_uri" => "http://example.com",
"source_code_uri" => "http://example.com",
"wiki_uri" => "http://example.com",
"mailing_list_uri" => "http://example.com",
"bug_tracker_uri" => "http://example.com",
"funding_uri" => "http://example.com"
},
sha: "b5d4045c3f466fa91fe2cc6abe79232a1a57cdf104f7a26e716e0a1e2789df78",
project_uri: "http://localhost/gems/example_gem",
gem_uri: "http://localhost/gems/example_gem-1.0.1.gem",
Expand Down
4 changes: 3 additions & 1 deletion test/unit/rubygem_test.rb
Expand Up @@ -458,7 +458,8 @@ class RubygemTest < ActiveSupport::TestCase
"mailing_list_uri" => "http://example.com/mail",
"source_code_uri" => "http://example.com/code",
"bug_tracker_uri" => "http://example.com/bugs",
"changelog_uri" => "http://example.com/change"
"changelog_uri" => "http://example.com/change",
"funding_uri" => "http://example.com/funding"
}
)

Expand All @@ -471,6 +472,7 @@ class RubygemTest < ActiveSupport::TestCase
assert_equal "http://example.com/code", hash["source_code_uri"]
assert_equal "http://example.com/bugs", hash["bug_tracker_uri"]
assert_equal "http://example.com/change", hash["changelog_uri"]
assert_equal "http://example.com/funding", hash["funding_uri"]
end

should "return version documentation url if metadata and linkset docs is empty" do
Expand Down

0 comments on commit 7666826

Please sign in to comment.