Sha256: dbe8ff5421bc45c8961623ab1f8cac7ee9fc11fc933c419b1d925f311020c114

Contents?: true

Size: 619 Bytes

Versions: 2

Compression:

Stored size: 619 Bytes

Contents

include SaferRailsConsole::Colors

app_name = ::Rails.application.class.parent.to_s.underscore.dasherize
env_name = SaferRailsConsole.environment_name
status = ::Rails.application.sandbox ? 'read-only' : 'writable'
color = SaferRailsConsole.prompt_color

prompt = "#{app_name}(#{env_name})(#{status}):%03n:%i"

IRB.conf[:PROMPT][:RAILS_ENV] = {
  PROMPT_I: color_text("#{prompt}> ", color),
  PROMPT_N: color_text("#{prompt}> ", color),
  PROMPT_S: color_text("#{prompt}%l ", color),
  PROMPT_C: color_text("#{prompt}* ", color),
  RETURN: color_text('=> ', color).concat("%s\n")
}

IRB.conf[:PROMPT_MODE] = :RAILS_ENV

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
safer_rails_console-0.3.0 lib/safer_rails_console/consoles/irb.rb
safer_rails_console-0.2.0 lib/safer_rails_console/consoles/irb.rb