Class: Tapioca::Gemfile
- Inherits:
-
Object
- Object
- Tapioca::Gemfile
- Extended by:
- T::Sig
- Defined in:
- lib/tapioca/gemfile.rb
Defined Under Namespace
Classes: GemSpec
Constant Summary collapse
Instance Attribute Summary collapse
-
#definition ⇒ Object
readonly
Returns the value of attribute definition.
-
#dependencies ⇒ Object
readonly
Returns the value of attribute dependencies.
-
#missing_specs ⇒ Object
readonly
Returns the value of attribute missing_specs.
Instance Method Summary collapse
- #gem(gem_name) ⇒ Object
-
#initialize(excluded_gems) ⇒ Gemfile
constructor
A new instance of Gemfile.
- #require_bundle ⇒ Object
Constructor Details
#initialize(excluded_gems) ⇒ Gemfile
Returns a new instance of Gemfile.
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/tapioca/gemfile.rb', line 27 def initialize(excluded_gems) @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) @excluded_gems = excluded_gems dependencies, missing_specs = load_dependencies @dependencies = T.let(dependencies, T::Array[GemSpec]) @missing_specs = T.let(missing_specs, T::Array[String]) end |
Instance Attribute Details
#definition ⇒ Object (readonly)
Returns the value of attribute definition.
18 19 20 |
# File 'lib/tapioca/gemfile.rb', line 18 def definition @definition end |
#dependencies ⇒ Object (readonly)
Returns the value of attribute dependencies.
21 22 23 |
# File 'lib/tapioca/gemfile.rb', line 21 def dependencies @dependencies end |
#missing_specs ⇒ Object (readonly)
Returns the value of attribute missing_specs.
24 25 26 |
# File 'lib/tapioca/gemfile.rb', line 24 def missing_specs @missing_specs end |
Instance Method Details
#gem(gem_name) ⇒ Object
40 41 42 |
# File 'lib/tapioca/gemfile.rb', line 40 def gem(gem_name) dependencies.detect { |dep| dep.name == gem_name } end |
#require_bundle ⇒ Object
45 46 47 48 49 |
# File 'lib/tapioca/gemfile.rb', line 45 def require_bundle BundlerExt::AutoRequireHook.override_require_false(exclude: @excluded_gems) do T.unsafe(runtime).require(*groups) end end |