Sha256: 0d22a1e7ee0584f6d9ac62c92503abc5b1a03baf8e4aecd4ed87c98a11ff7c66
Contents?: true
Size: 1.72 KB
Versions: 1
Compression:
Stored size: 1.72 KB
Contents
require "iruby/rails/version" require 'forwardable' module IRuby module Rails class << self def load(env = nil, sandbox = false, root = nil) root ||= Dir.pwd # RAILS_ENV needs to be set before config/application is required ENV['RAILS_ENV'] ||= env || 'development' require File.expand_path('config/boot', root) app_path = File.expand_path('config/application', root) require_application_and_environment!(app_path) setup_console(::Rails.application, sandbox) end private def require_application_and_environment!(app_path) require app_path ::Rails.application.require_environment! end def setup_console(app, sandbox) app.sandbox = sandbox app.load_console set_environment! if environment? if sandbox puts "Loading #{::Rails.env} environment in sandbox (Rails #{::Rails.version})" puts "Any modifications you make will be rolled back on exit" else puts "Loading #{::Rails.env} environment (Rails #{::Rails.version})" end console = if app.config.console app.config.console else require "irb" IRB end if defined?(console::ExtendCommandBundle) console::ExtendCommandBundle.include(::Rails::ConsoleMethods) end end def set_environment! ::Rails.env = environment end def environment ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development" end alias environment? environment end end def self.load_rails(env = nil, sandbox = false, root = nil) Rails.load(env, sandbox, root) ::Rails end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
iruby-rails-1.1.0 | lib/iruby/rails.rb |