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
1 change: 0 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ PATH
remote: .
specs:
tapioca (0.20.0)
benchmark
bundler (>= 2.2.25)
netrc (>= 0.11.0)
parallel (>= 1.21.0)
Expand Down
13 changes: 10 additions & 3 deletions lib/tapioca/helpers/rbi_files_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def index_rbi(index, kind, file)
return unless File.exist?(file)

say("Loading #{kind} RBIs from #{file}... ")
time = Benchmark.realtime do
time = realtime do
parse_and_index_files(index, [file], number_of_workers: 1)
end
say(" Done ", :green)
Expand All @@ -26,7 +26,7 @@ def index_rbis(index, kind, dir, number_of_workers:)
else
say("Loading #{kind} RBIs from #{dir}... ")
end
time = Benchmark.realtime do
time = realtime do
files = Dir.glob("#{dir}/**/*.rbi").sort
parse_and_index_files(index, files, number_of_workers: number_of_workers)
end
Expand All @@ -38,7 +38,7 @@ def index_rbis(index, kind, dir, number_of_workers:)
def duplicated_nodes_from_index(index, shim_rbi_dir:, todo_rbi_file:)
duplicates = {}
say("Looking for duplicates... ")
time = Benchmark.realtime do
time = realtime do
index.keys.each do |key|
nodes = index[key]
next unless shims_or_todos_have_duplicates?(nodes, shim_rbi_dir: shim_rbi_dir, todo_rbi_file: todo_rbi_file)
Expand Down Expand Up @@ -380,5 +380,12 @@ def update_gem_rbis_strictnesses(errors, gem_dir)
def gem_name_from_rbi_path(path)
T.must(File.basename(path, ".rbi").split("@").first)
end

#: ?{ (?) -> untyped } -> (Integer | Float)
def realtime(&block)
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
yield
Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
end
end
end
1 change: 0 additions & 1 deletion lib/tapioca/internal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
require "tapioca/rbs/rewriter"
# ^ Do not change the order of these requires

require "benchmark"
require "bundler"
require "erb"
require "etc"
Expand Down
4 changes: 2 additions & 2 deletions spec/tapioca/cli/gem_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ class Secret; end
end

it "must not include code from an ActiveSupport.on_load hook in ActiveRecord RBIs" do
@project.require_real_gem("rails", "7.1.0")
@project.require_real_gem("rails", "7.1.6")
# Flipper adds functionality to ActiveRecord via an ActiveSupport.on_load hook
@project.require_real_gem("flipper-active_record", "1.3.1")

Expand All @@ -698,7 +698,7 @@ class Secret; end
assert_success_status(result)

activerecord_rbi_file = T.must(
Dir.glob("#{@project.absolute_path}/sorbet/rbi/gems/activerecord@7.1.0.rbi").first,
Dir.glob("#{@project.absolute_path}/sorbet/rbi/gems/activerecord@7.1.6.rbi").first,
)
refute_includes(File.read(activerecord_rbi_file), "class Flipper")
end
Expand Down
1 change: 0 additions & 1 deletion tapioca.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ Gem::Specification.new do |spec|

spec.metadata["allowed_push_host"] = "https://rubygems.org"

spec.add_dependency("benchmark")
spec.add_dependency("bundler", ">= 2.2.25")
spec.add_dependency("netrc", ">= 0.11.0")
spec.add_dependency("parallel", ">= 1.21.0")
Expand Down
Loading