Class: Jets::Generators::EngineGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/jets/engine/engine_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_engine_to_gemfile_as_componentObject



25
26
27
# File 'lib/generators/jets/engine/engine_generator.rb', line 25

def add_engine_to_gemfile_as_component
  append_to_file "Gemfile", "component \"#{name}\""
end

#create_engine_fileObject



14
15
16
17
18
19
# File 'lib/generators/jets/engine/engine_generator.rb', line 14

def create_engine_file
  directory(".", "engines/#{name}")

  chmod "engines/#{name}/bin/console", 0o755, verbose: false
  chmod "engines/#{name}/bin/rails", 0o755, verbose: false
end

#mount_engine_to_routesObject



21
22
23
# File 'lib/generators/jets/engine/engine_generator.rb', line 21

def mount_engine_to_routes
  route "mount #{class_name}::Engine, at: \"/\", as: :#{name}_root"
end