class CspReport::InstallGenerator

Public Instance Methods

install() click to toggle source
# File lib/generators/csp_report/install_generator.rb, line 12
def install

  puts "Running the install procedure with mount point #{mount_point}"
  puts "\n"

  # If it's not the first run, the generator will ask to overwrite the
  # existing initializer
  generate "csp_report:initializer_install" , "#{mount_point}"
  # If it is not the first run but the mount point was not change, nothing
  # happens
  generate "csp_report:mount"               , "#{mount_point}"
  # Adds the JS include
  generate "csp_report:highcharts_include"
  # If this is not the first run, only the delta is copied.
  generate "csp_report:migration"

  if options.add_declaration?
    generate "csp_report:csp_declaration"
  end
end

Private Instance Methods

mount_point() click to toggle source

Proxy to get the override text displayed only once

# File lib/generators/csp_report/install_generator.rb, line 36
def mount_point
  @mount_point ||= mount_point_value
end
mount_point_value() click to toggle source
# File lib/generators/csp_report/install_generator.rb, line 40
def mount_point_value
  if defined? CspReport::MOUNT_POINT
    puts "\nThe CspReport engine has already been installed.".yellow
    puts "  Overriding the mount point to #{CspReport::MOUNT_POINT}.".yellow
    CspReport::MOUNT_POINT
  else
    namespace
  end
end