Last active
June 3, 2016 23:44
-
-
Save travisofthenorth/437daa1149496bd1c2196b4b3f1d3f8f to your computer and use it in GitHub Desktop.
Module to sandbox the rails console more
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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