Class: Bootstrap::Generators::LayoutGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
CdnTags
Defined in:
lib/generators/bootstrap/layout/layout_generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CdnTags

#bundle_tag, #css_tag, #js_tag, #popper_tag, #separate_popper_tags

Instance Attribute Details

#app_nameObject (readonly)

Returns the value of attribute app_name.



21
22
23
# File 'lib/generators/bootstrap/layout/layout_generator.rb', line 21

def app_name
  @app_name
end

Instance Method Details

#generate_layoutObject



31
32
33
34
35
36
# File 'lib/generators/bootstrap/layout/layout_generator.rb', line 31

def generate_layout
  app = ::Rails.application
  @app_name = app.class.to_s.split("::").first
  ext = app.config.generators.options[:rails][:template_engine] || :erb
  template "layout.html.#{ext}", "app/views/layouts/#{layout_name}.html.#{ext}"
end

#warn_about_ignored_optionsObject



23
24
25
26
27
28
29
# File 'lib/generators/bootstrap/layout/layout_generator.rb', line 23

def warn_about_ignored_options
  return unless options[:'separate-popper'] && !cdn?

  say_status :warn,
    "--separate-popper only applies with --cdn; the vendored asset pipeline ships the bundle. Ignoring.",
    :yellow
end