Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion spec/catalog/duplication_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require "spec"
require "../../src/catalog"
require "file_utils"

private def with_tempdir(name)
private def with_tempdir(name, &)
path = File.join(Dir.tempdir, name)
FileUtils.mkdir_p(path)

Expand Down
2 changes: 1 addition & 1 deletion spec/catalog_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require "spec"
require "../src/catalog"
require "file_utils"

private def with_tempdir(name)
private def with_tempdir(name, &)
path = File.join(Dir.tempdir, name)
FileUtils.mkdir_p(path)

Expand Down
2 changes: 1 addition & 1 deletion spec/support/db.cr
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ require "../../src/db"

ShardsDB.database_url = ENV["TEST_DATABASE_URL"]

def transaction
def transaction(&)
ShardsDB.transaction do |db, transaction|
db.connection.on_notice do |notice|
puts
Expand Down
2 changes: 1 addition & 1 deletion spec/support/tempdir.cr
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "file_utils"

def with_tempdir(name)
def with_tempdir(name, &)
path = File.join(Dir.tempdir, name)
FileUtils.mkdir_p(path)

Expand Down
4 changes: 2 additions & 2 deletions src/catalog.cr
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ class Catalog
end
end

def each_category
def each_category(&)
local_path = check_out

each_category(local_path) do |category|
yield category
end
end

def each_category(path : Path)
def each_category(path : Path, &)
unless File.directory?(path)
raise Error.new "Can't read catalog at #{path}, directory does not exist."
end
Expand Down
2 changes: 1 addition & 1 deletion src/category.cr
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Category
@name : String,
@description : String? = nil,
@entries_count : Int32 = 0,
@id : Int64? = nil
@id : Int64? = nil,
)
end
end
4 changes: 2 additions & 2 deletions src/db.cr
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ class ShardsDB
@@db
end

def self.connect
def self.connect(&)
db.using_connection do |connection|
yield ShardsDB.new(connection)
end
end

def self.transaction
def self.transaction(&)
db.transaction do |transaction|
yield ShardsDB.new(transaction.connection), transaction
end
Expand Down
2 changes: 1 addition & 1 deletion src/fetchers/github_api.cr
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ struct Shardbox::GitHubAPI
data
end

def parse_github_graphql(content, expected_key)
def parse_github_graphql(content, expected_key, &)
pull = JSON::PullParser.new(content)

pull.read_object do |key|
Expand Down
4 changes: 2 additions & 2 deletions src/release.cr
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Release
revision_info : RevisionInfo,
spec : Hash(String, JSON::Any) = {} of String => JSON::Any,
yanked_at : Time? = nil,
latest : Bool = false
latest : Bool = false,
)
new(
version: version,
Expand All @@ -50,7 +50,7 @@ class Release
@spec : Hash(String, JSON::Any) = {} of String => JSON::Any,
@yanked_at : Time? = nil,
@latest : Bool = false,
@id : Int64? = nil
@id : Int64? = nil,
)
end

Expand Down
4 changes: 2 additions & 2 deletions src/repo.cr
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ class Repo
@ref : Ref, @shard_id : Int64?,
@role : Role = :canonical, @metadata = Metadata.new,
@synced_at : Time? = nil, @sync_failed_at : Time? = nil,
@id : Int64? = nil
@id : Int64? = nil,
)
end

def self.new(
resolver : String, url : String, shard_id : Int64?,
role : String = "canonical", metadata = Metadata.new,
synced_at : Time? = nil, sync_failed_at : Time? = nil,
id : Int64? = nil
id : Int64? = nil,
)
new(Ref.new(resolver, url), shard_id, Role.parse(role), metadata, synced_at, sync_failed_at, id)
end
Expand Down
2 changes: 1 addition & 1 deletion src/service/create_shard.cr
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ struct Service::CreateShard
end

# This method yields qualifiers for this shard in order of preference
private def possible_qualifiers
private def possible_qualifiers(&)
# 1. No qualifier
yield ""

Expand Down
2 changes: 1 addition & 1 deletion src/service/worker_loop.cr
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct Service::WorkerLoop
end
end

def scheduled(scheduled_time : Time)
def scheduled(scheduled_time : Time, &)
@running = true

while running?
Expand Down