Skip to content

Instantly share code, notes, and snippets.

@travisofthenorth
Last active June 3, 2016 23:44
Show Gist options
  • Save travisofthenorth/437daa1149496bd1c2196b4b3f1d3f8f to your computer and use it in GitHub Desktop.
Save travisofthenorth/437daa1149496bd1c2196b4b3f1d3f8f to your computer and use it in GitHub Desktop.
Module to sandbox the rails console more
module JailedConsole
extend ActiveSupport::Concern
included do
require 'colorize'
def sandbox_console
require 'webmock'
require 'sidekiq/testing' if defined?(Sidekiq)
end
def user_input
prompt("Defaulting the console into sandbox mode. "\
"Type 'production' to disable this")
gets.strip != 'production'
end
def warn(message)
puts message.black.on_red.blink
end
def prompt(message)
puts message.black.on_yellow
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment