Class: Tapioca::Generators::Init

Inherits:
Base
  • Object
show all
Defined in:
lib/tapioca/generators/init.rb

Instance Method Summary collapse

Constructor Details

#initialize(sorbet_config:, default_postrequire:, default_command:, file_writer: FileWriter.new) ⇒ Init

Returns a new instance of Init.


15
16
17
18
19
20
21
22
23
# File 'lib/tapioca/generators/init.rb', line 15

def initialize(sorbet_config:, default_postrequire:, default_command:, file_writer: FileWriter.new)
  @sorbet_config = sorbet_config
  @default_postrequire = default_postrequire

  super(default_command: default_command, file_writer: file_writer)

  @installer = T.let(nil, T.nilable(Bundler::Installer))
  @spec = T.let(nil, T.nilable(Bundler::StubSpecification))
end

Instance Method Details

#generateObject


26
27
28
29
30
31
32
33
34
# File 'lib/tapioca/generators/init.rb', line 26

def generate
  create_config
  create_post_require
  if File.exist?(@default_command)
    generate_binstub!
  else
    generate_binstub
  end
end