class TraceView::InstallGenerator

Public Instance Methods

copy_initializer() click to toggle source
# File lib/rails/generators/traceview/install_generator.rb, line 11
def copy_initializer
  # Set defaults
  @tracing_mode = 'through'
  @verbose = 'false'

  print_header

  while true do
    print_body

    user_tracing_mode = ask shell.set_color "* Tracing Mode? [through]:", :yellow
    user_tracing_mode.downcase!

    break if user_tracing_mode.blank?
    valid = ['always', 'through', 'never'].include?(user_tracing_mode)

    say shell.set_color "Valid values are 'always', 'through' or 'never'", :red, :bold unless valid
    if valid
      @tracing_mode = user_tracing_mode
      break
    end
  end

  print_footer

  template "traceview_initializer.rb", "config/initializers/traceview.rb"
end

Private Instance Methods

print_body() click to toggle source
print_header() click to toggle source