Skip to content

Commit

Permalink
Tidy up and pass tests
Browse files Browse the repository at this point in the history
  • Loading branch information
colby-swandale committed Aug 15, 2024
1 parent 2faf872 commit 65e9fd0
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/controllers/api/v1/archive_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Api::V1::ArchiveController < Api::BaseController
class Api::V1::ArchiveController < Api::BaseController
before_action :authenticate_with_api_key
before_action :verify_with_otp
before_action :find_rubygem
Expand Down
3 changes: 2 additions & 1 deletion app/models/api_key.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ class ScopeError < RuntimeError; end

API_SCOPES = %i[show_dashboard index_rubygems push_rubygem yank_rubygem archive_rubygem unarchive_rubygem add_owner remove_owner access_webhooks
configure_trusted_publishers].freeze
APPLICABLE_GEM_API_SCOPES = %i[push_rubygem yank_rubygem archive_rubygem unarchive_rubygem add_owner remove_owner configure_trusted_publishers].freeze
APPLICABLE_GEM_API_SCOPES = %i[push_rubygem yank_rubygem archive_rubygem unarchive_rubygem add_owner remove_owner
configure_trusted_publishers].freeze
EXCLUSIVE_SCOPES = %i[show_dashboard].freeze

self.ignored_columns += API_SCOPES
Expand Down
6 changes: 6 additions & 0 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,7 @@ de:
show_all_versions: Zeige alle Versionen (%{count} total)
versions_header: Versionen
yanked_notice:
archived_notice:
show_yanked:
not_hosted_notice: Dieses Gem wird aktuell nicht auf RubyGems.org gehostet.
reserved_namespace_html:
Expand Down Expand Up @@ -1055,3 +1056,8 @@ de:
api_key_gem_html:
api_key_mfa:
not_required:
archive:
create:
success:
destroy:
success:
6 changes: 6 additions & 0 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,7 @@ es:
versions_header: Versiones
yanked_notice: Esta versión fue borrada, y no está disponible para su descarga
directa ni por otras gemas que puedan haber dependido de la misma.
archived_notice:
show_yanked:
not_hosted_notice: Esta gema no está alojada actualmente en RubyGems.org. Es
posible que ya exista alguna versión borrada de esta gema.
Expand Down Expand Up @@ -1110,3 +1111,8 @@ es:
api_key_gem_html:
api_key_mfa:
not_required:
archive:
create:
success:
destroy:
success:
6 changes: 6 additions & 0 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,7 @@ fr:
versions_header: Versions
yanked_notice: 'Retrait de Gem : disponible ni directement, ni pour les gems
qui en dépendraient.'
archived_notice:
show_yanked:
not_hosted_notice: Gem non hébergé sur Rubygems pour le moment.
reserved_namespace_html:
Expand Down Expand Up @@ -1005,3 +1006,8 @@ fr:
api_key_gem_html:
api_key_mfa:
not_required:
archive:
create:
success:
destroy:
success:
6 changes: 6 additions & 0 deletions config/locales/ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,7 @@ ja:
show_all_versions: 全てのバージョンを表示(全%{count}件)
versions_header: バージョン履歴
yanked_notice: このバージョンはヤンクされ、直接のダウンロードや依存関係になっている可能性がある他のgemは利用できません。
archived_notice:
show_yanked:
not_hosted_notice: このgemは現在RubyGems.org上ではホストされていません。このgemのヤンクされたバージョンはまだ存在する可能性があります。
reserved_namespace_html:
Expand Down Expand Up @@ -981,3 +982,8 @@ ja:
api_key_gem_html: 'gem: %{gem}'
api_key_mfa: 'MFA: %{mfa}'
not_required: 必要ではありません
archive:
create:
success:
destroy:
success:
6 changes: 6 additions & 0 deletions config/locales/nl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,7 @@ nl:
show_all_versions: Toon alle versies (%{count} totaal)
versions_header: Versies
yanked_notice:
archived_notice:
show_yanked:
not_hosted_notice: Deze gem wordt momenteel niet gehost op rubygems.org.
reserved_namespace_html:
Expand Down Expand Up @@ -960,3 +961,8 @@ nl:
api_key_gem_html:
api_key_mfa:
not_required:
archive:
create:
success:
destroy:
success:
6 changes: 6 additions & 0 deletions config/locales/pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,7 @@ pt-BR:
show_all_versions: Mostrar todas as versões (%{count})
versions_header: Versões
yanked_notice: Esta gem foi removida, e não está mais disponível para download.
archived_notice:
show_yanked:
not_hosted_notice: Esta gem não está hospedada no Gemcutter.
reserved_namespace_html:
Expand Down Expand Up @@ -983,3 +984,8 @@ pt-BR:
api_key_gem_html:
api_key_mfa:
not_required:
archive:
create:
success:
destroy:
success:
6 changes: 6 additions & 0 deletions config/locales/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,7 @@ zh-CN:
show_all_versions: 显示所有版本 (共 %{count} 个)
versions_header: 版本列表
yanked_notice: 这个 Gem 版本已经撤回了,无法直接下载,也无法被其他 Gem 依赖。
archived_notice:
show_yanked:
not_hosted_notice: 这个 Gem 目前没有被托管在 RubyGems.org 中。这个 Gem 撤回的版本可能已经存在了。
reserved_namespace_html:
Expand Down Expand Up @@ -974,3 +975,8 @@ zh-CN:
api_key_gem_html:
api_key_mfa:
not_required:
archive:
create:
success:
destroy:
success:
6 changes: 6 additions & 0 deletions config/locales/zh-TW.yml
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,7 @@ zh-TW:
show_all_versions: 顯示所有版本(共 %{count})
versions_header: 版本列表
yanked_notice: 這個 Gem 版本已被移除,因此無法提供下載,也無法被其他的 Gem 相依。
archived_notice:
show_yanked:
not_hosted_notice: 這個 Gem 目前沒有在 RubyGems.org 上
reserved_namespace_html:
Expand Down Expand Up @@ -965,3 +966,8 @@ zh-TW:
api_key_gem_html:
api_key_mfa:
not_required:
archive:
create:
success:
destroy:
success:
4 changes: 2 additions & 2 deletions test/integration/api/v1/archive_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Api::V1::ArchiveTest < ActionDispatch::IntegrationTest
end

should "not archive the gem" do
refute @rubygem.archived?
refute_predicate @rubygem, :archived?
end
end

Expand Down Expand Up @@ -66,7 +66,7 @@ class Api::V1::ArchiveTest < ActionDispatch::IntegrationTest
end

should "unarchive the gem" do
refute @rubygem.archived?
refute_predicate @rubygem, :archived?
end

should "render a success message" do
Expand Down

0 comments on commit 65e9fd0

Please sign in to comment.