lib/tapioca/gemfile.rb in tapioca-0.4.25 vs lib/tapioca/gemfile.rb in tapioca-0.4.26
- old
+ new
@@ -18,11 +18,11 @@
end
sig { returns(Bundler::Definition) }
attr_reader(:definition)
- sig { returns(T::Array[Gem]) }
+ sig { returns(T::Array[GemSpec]) }
attr_reader(:dependencies)
sig { returns(T::Array[String]) }
attr_reader(:missing_specs)
@@ -30,34 +30,34 @@
def initialize
@gemfile = T.let(File.new(Bundler.default_gemfile), File)
@lockfile = T.let(File.new(Bundler.default_lockfile), File)
@definition = T.let(Bundler::Dsl.evaluate(gemfile, lockfile, {}), Bundler::Definition)
dependencies, missing_specs = load_dependencies
- @dependencies = T.let(dependencies, T::Array[Gem])
+ @dependencies = T.let(dependencies, T::Array[GemSpec])
@missing_specs = T.let(missing_specs, T::Array[String])
end
- sig { params(gem_name: String).returns(T.nilable(Gem)) }
+ sig { params(gem_name: String).returns(T.nilable(GemSpec)) }
def gem(gem_name)
dependencies.detect { |dep| dep.name == gem_name }
end
sig { void }
- def require
- T.unsafe(runtime).setup(*groups).require(*groups)
+ def require_bundle
+ T.unsafe(runtime).require(*groups)
end
private
sig { returns(File) }
attr_reader(:gemfile, :lockfile)
- sig { returns([T::Array[Gem], T::Array[String]]) }
+ sig { returns([T::Array[GemSpec], T::Array[String]]) }
def load_dependencies
materialized_dependencies, missing_specs = materialize_deps
dependencies = materialized_dependencies
- .map { |spec| Gem.new(spec) }
+ .map { |spec| GemSpec.new(spec) }
.reject { |gem| gem.ignore?(dir) }
.uniq(&:rbi_file_name)
.sort_by(&:rbi_file_name)
[dependencies, missing_specs]
end
@@ -90,10 +90,10 @@
sig { returns(String) }
def dir
File.expand_path(gemfile.path + "/..")
end
- class Gem
+ class GemSpec
extend(T::Sig)
IGNORED_GEMS = T.let(%w{
sorbet sorbet-static sorbet-runtime
}.freeze, T::Array[String])