Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for 3.0 #173

Merged
merged 12 commits into from
Dec 13, 2015
9 changes: 1 addition & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: ruby

rvm:
- 2.2
- 2.2.3
- ruby-head
- rbx-2
- jruby
Expand All @@ -16,17 +16,10 @@ env:

sudo: false

before_script:
- RAILS_ENV=test bundle exec rake --rakefile=test/dummy/Rakefile db:setup

script:
- bundle exec rake ${TEST_SUITE}

matrix:
include:
- gemfile: gemfiles/Gemfile-4-0-stable
env: TEST_SUITE=test:templates
rvm: 2.2.2
allow_failures:
- rvm: ruby-head
- rvm: rbx-2
Expand Down
11 changes: 0 additions & 11 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,8 @@ gemspec

gem 'rails', github: 'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'sprockets', github: 'rails/sprockets'
gem 'sprockets-rails', github: 'rails/sprockets-rails'
gem 'rack', github: 'rack/rack'

platforms :jruby do
gem 'activerecord-jdbcsqlite3-adapter'
gem 'binding_of_caller', '0.7.3.pre1'
end

platforms :ruby do
gem 'sqlite3'
end

group :test do
gem 'rake'
gem 'mocha', require: false
Expand Down
44 changes: 7 additions & 37 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<p align=right>
Documentation for:
<a href=https://github.com/rails/web-console/tree/v2.0.0>v2.0.0</a>
<a href=https://github.com/rails/web-console/tree/v2.1.0>v2.1.0</a>
<a href=https://github.com/rails/web-console/tree/v2.1.1>v2.1.1</a>
<a href=https://github.com/rails/web-console/tree/v2.1.2>v2.1.2</a>
<a href=https://github.com/rails/web-console/tree/v1.0.4>v1.0.4</a>
<a href=https://github.com/rails/web-console/tree/v2.1.3>v2.1.3</a>
</p>

Expand All @@ -28,7 +25,7 @@ application, add the following to your `Gemfile`.

```ruby
group :development do
gem 'web-console', '~> 2.0'
gem 'web-console', '~> 3.0'
end
```

Expand All @@ -37,35 +34,9 @@ restart your server for the _Web Console_ to kick in.

## Runtime

_Web Console_ uses [John Mair]'s [binding_of_caller] to spawn a console in a
specific binding. This comes at the price of limited Ruby runtime support.

### CRuby

CRuby 1.9.2 and below is **not** supported.

### JRuby

JRuby needs to run in interpreted mode. You can enable it by:

```bash
export JRUBY_OPTS=-J-Djruby.compile.mode=OFF

# If you run JRuby 1.7.12 and above, you can use:
export JRUBY_OPTS=--dev
```

An unstable version of [binding_of_caller] is needed as the latest stable one
won't compile on _JRuby_. To install it, put the following in your application
`Gemfile`:

```ruby
group :development do
gem 'binding_of_caller', '0.7.3.pre1'
end
```

Only _JRuby_ 1.7, is supported (no JRuby 9K support at the moment).
CRuby 2.2 and below is **not** supported.

### Rubinius

Expand Down Expand Up @@ -215,17 +186,16 @@ Make sure you configuration lives in `config/environments/development.rb`.

## Credits

* Shoutout to [Charlie Somerville] for [better_errors] and [this] code.
* Kudos to [John Mair] for [binding_of_caller].
* Shoutout to [Charlie Somerville] for [better_errors].
* Kudos to [John Mair] for [debug_inspector].
* Thanks to [Charles Oliver Nutter] for all the _JRuby_ feedback.
* Hugs and kisses to all of our [contributors].
* Hugs and kisses to all of our [contributors]!

[better_errors]: https://github.com/charliesome/better_errors
[binding_of_caller]: https://github.com/banister/binding_of_caller
[debug_inspector]: https://github.com/banister/debug_inspector
[Charlie Somerville]: https://github.com/charliesome
[John Mair]: https://github.com/banister
[Charles Oliver Nutter]: https://github.com/headius
[templates]: https://github.com/rails/web-console/tree/master/lib/web_console/templates
[this]: https://github.com/rails/web-console/blob/master/lib/web_console/integration/cruby.rb#L20-L32
[rvt]: https://github.com/gsamokovarov/rvt
[contributors]: https://github.com/rails/web-console/graphs/contributors
20 changes: 0 additions & 20 deletions gemfiles/Gemfile-4-0-stable

This file was deleted.

20 changes: 0 additions & 20 deletions gemfiles/Gemfile-4-1-stable

This file was deleted.

20 changes: 0 additions & 20 deletions gemfiles/Gemfile-4-2-stable

This file was deleted.

9 changes: 6 additions & 3 deletions lib/web_console/extensions.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
ActionDispatch::DebugExceptions.class_eval do
def render_exception_with_web_console(request, exception)
render_exception_without_web_console(request, exception).tap do
backtrace_cleaner = request.env['action_dispatch.backtrace_cleaner']
# Retain superficial Rails 4.2 compatibility.
env = Hash === request ? request : request.env

backtrace_cleaner = env['action_dispatch.backtrace_cleaner']
error = ActionDispatch::ExceptionWrapper.new(backtrace_cleaner, exception).exception

# Get the original exception if ExceptionWrapper decides to follow it.
request.env['web_console.exception'] = error
env['web_console.exception'] = error

# ActionView::Template::Error bypass ExceptionWrapper original
# exception following. The backtrace in the view is generated from
# reaching out to original_exception in the view.
if error.is_a?(ActionView::Template::Error)
request.env['web_console.exception'] = error.original_exception
env['web_console.exception'] = error.original_exception
end
end
end
Expand Down
2 changes: 0 additions & 2 deletions lib/web_console/integration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def bindings
case RUBY_ENGINE
when 'rbx'
require 'web_console/integration/rubinius'
when 'jruby'
require 'web_console/integration/jruby'
when 'ruby'
require 'web_console/integration/cruby'
end
111 changes: 0 additions & 111 deletions lib/web_console/integration/jruby.rb

This file was deleted.

6 changes: 1 addition & 5 deletions lib/web_console/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ class Railtie < ::Rails::Railtie
config.web_console = ActiveSupport::OrderedOptions.new
config.web_console.whitelisted_ips = %w( 127.0.0.1 ::1 )

# See rails/web-console#150 and rails/rails#20319. Revert when Ruby on
# Rails 4.2.4 is released.
config.web_console.development_only = false

initializer 'web_console.initialize' do
require 'web_console/extensions'

Expand All @@ -24,7 +20,7 @@ class Railtie < ::Rails::Railtie
initializer 'web_console.development_only' do
unless (config.web_console.development_only == false) || Rails.env.development?
abort <<-END.strip_heredoc
Web Console is activated in the #{Rails.env} environment, which is
Web Console is activated in the #{Rails.env} environment. This is
usually a mistake. To ensure it's only activated in development
mode, move it to the development group of your Gemfile:

Expand Down
4 changes: 3 additions & 1 deletion test/dummy/config/application.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
require File.expand_path('../boot', __FILE__)

require 'rails/all'
require "active_model/railtie"
require "action_controller/railtie"
require "action_view/railtie"

Bundler.require(*Rails.groups)
require 'web_console'
Expand Down
11 changes: 0 additions & 11 deletions test/dummy/config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,6 @@
config.consider_all_requests_local = true
config.action_controller.perform_caching = false

# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false

# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log

# Raise an error on page load if there are pending migrations
config.active_record.migration_error = :page_load

# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
end
Loading