Allow to set custom console type with Rails.application.config.console=
This patch adds ability to set custom console if you want to use something other than IRB. Previously the hack that people used was: silence_warnings do require 'pry' IRB = Pry end which is not the best way to customize things.
This commit is contained in:
parent
e09ac7086b
commit
951b582062
@ -1,5 +1,17 @@
|
||||
## Rails 4.0.0 (unreleased) ##
|
||||
|
||||
* Allow to set class that will be used to run as a console, other than IRB, with `Rails.application.config.console=`. It's best to add it to `console` block. *Piotr Sarnacki*
|
||||
|
||||
Example:
|
||||
|
||||
# it can be added to config/application.rb
|
||||
console do
|
||||
# this block is called only when running console,
|
||||
# so we can safely require pry here
|
||||
require "pry"
|
||||
config.console = Pry
|
||||
end
|
||||
|
||||
* Add convenience `hide!` method to Rails generators to hide current generator
|
||||
namespace from showing when running `rails generate`. *Carlos Antonio da Silva*
|
||||
|
||||
|
@ -122,6 +122,17 @@ WARNING: Threadsafe operation is incompatible with the normal workings of develo
|
||||
|
||||
* +config.whiny_nils+ enables or disables warnings when a certain set of methods are invoked on +nil+ and it does not respond to them. Defaults to true in development and test environments.
|
||||
|
||||
* +config.console+ allows you to set class that will be used as console you run +rails console+. It's best to run it in +console+ block:
|
||||
|
||||
<ruby>
|
||||
console do
|
||||
# this block is called only when running console,
|
||||
# so we can safely require pry here
|
||||
require "pry"
|
||||
config.console = Pry
|
||||
end
|
||||
</ruby>
|
||||
|
||||
h4. Configuring Assets
|
||||
|
||||
Rails 3.1, by default, is set up to use the +sprockets+ gem to manage assets within an application. This gem concatenates and compresses assets in order to make serving them much less painful.
|
||||
|
@ -6,7 +6,7 @@ module Rails
|
||||
class Application
|
||||
class Configuration < ::Rails::Engine::Configuration
|
||||
attr_accessor :allow_concurrency, :asset_host, :asset_path, :assets,
|
||||
:cache_classes, :cache_store, :consider_all_requests_local,
|
||||
:cache_classes, :cache_store, :consider_all_requests_local, :console,
|
||||
:dependency_loading, :exceptions_app, :file_watcher, :filter_parameters,
|
||||
:force_ssl, :helpers_paths, :logger, :log_tags, :preload_frameworks,
|
||||
:railties_order, :relative_url_root, :secret_token,
|
||||
|
@ -42,8 +42,9 @@ def start
|
||||
puts "Loading #{Rails.env} environment (Rails #{Rails.version})"
|
||||
end
|
||||
|
||||
IRB::ExtendCommandBundle.send :include, Rails::ConsoleMethods
|
||||
IRB.start
|
||||
console = Rails.application.config.console || IRB
|
||||
console::ExtendCommandBundle.send :include, Rails::ConsoleMethods
|
||||
console.start
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user