Skip to content

Commit

Permalink
Correct the way compats are created and saved
Browse files Browse the repository at this point in the history
Also, stop using Baseline::Service so much
  • Loading branch information
etagwerker committed Sep 24, 2024
1 parent 2d9db3f commit 44d3d3b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/services/external/github.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ module External
class Github < Baseline::ExternalService
REPO = "railsbump/checker"

add_method :list_branches do |page = 1|
def list_branches(page = 1)
client.branches \
REPO,
per_page: 100,
page: page
end

add_method :delete_branch do |name|
def delete_branch(name)
client.delete_branch \
REPO,
name
Expand Down
12 changes: 7 additions & 5 deletions app/services/gemmies/update_compats.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ def call(gemmy)

RailsRelease.find_each do |rails_release|
gemmy.dependencies.each do |dependencies|
rails_release
.compats
.where("dependencies::jsonb = ?", dependencies.to_json)
.first_or_create!
unless rails_release.compats.where("dependencies::jsonb = ?", dependencies.to_json).exists?
rails_release.compats.create! dependencies: dependencies
end
end
end

compats = Compat.where("dependencies::jsonb = ?", gemmy.dependencies.to_json)
compats = gemmy.dependencies.flat_map do |dependencies|
Compat.where("dependencies::jsonb = ?", dependencies.to_json).to_a
end

gemmy.update! compat_ids: compats.pluck(:id).sort
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/services/maintenance/hourly.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def call
check_uniqueness

call_all_private_methods_without_args \
raise_errors: false
raise_errors: true

[
CheckGitBranches,
Expand Down

0 comments on commit 44d3d3b

Please sign in to comment.