Class: Cli::Commands::NewApp::Files::ConfigRu

Inherits:
Object
  • Object
show all
Defined in:
lib/cli/commands/new_app/files/config_ru.rb

Class Method Summary collapse

Class Method Details

.call(app_name) ⇒ Object



8
9
10
# File 'lib/cli/commands/new_app/files/config_ru.rb', line 8

def self.call(app_name)
  File.write("config.ru", content(app_name))
end

.content(app_name) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/cli/commands/new_app/files/config_ru.rb', line 12

def self.content(app_name)
  <<~RUBY
    # typed: false
    # frozen_string_literal: true

    require_relative("app")

    # Load middlewares here
    use(Rack::Reloader, 0) if #{app_name}.environment == "development"

    # Launch the app
    run(#{app_name}.new)

    # "use" all controllers
    # store all routes in a global variable to render (localhost only)
    # put "booted" statement
  RUBY
end