Sha256: 93c904d3ab78747589273f11cd393194835786aff00afa3f9f12e736d999e02b

Contents?: true

Size: 919 Bytes

Versions: 1

Compression:

Stored size: 919 Bytes

Contents

module SaferRailsConsole
  module Console
    class << self
      include SaferRailsConsole::Colors

      def initialize_sandbox
        require 'safer_rails_console/patches/sandbox'
      end

      def print_warning
        puts color_text(SaferRailsConsole.warn_text, SaferRailsConsole.prompt_color) # rubocop:disable Rails/Output
      end

      def load_config
        gem = Gem::Specification.find_by_name('safer_rails_console') # rubocop:disable Rails/DynamicFindBy
        gem_root = gem.gem_dir
        ARGV.push '-r', File.join(gem_root, 'lib', 'safer_rails_console', 'consoles', "#{SaferRailsConsole.config.console}.rb")
      end

      def sandbox_user_prompt
        puts "Defaulting the console into sandbox mode.\nType 'disable' to disable. Anything else will begin a sandboxed session:" # rubocop:disable Rails/Output
        input = gets.strip
        input != 'disable'
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
safer_rails_console-0.4.1 lib/safer_rails_console/console.rb