commit rubygem-web-console for openSUSE:Factory
Hello community, here is the log from the commit of package rubygem-web-console for openSUSE:Factory checked in at 2016-04-22 16:24:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-web-console (Old) and /work/SRC/openSUSE:Factory/.rubygem-web-console.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "rubygem-web-console" Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-web-console/rubygem-web-console.changes 2016-03-17 16:49:24.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.rubygem-web-console.new/rubygem-web-console.changes 2016-04-22 16:24:27.000000000 +0200 @@ -1,0 +2,16 @@ +Tue Apr 12 04:33:31 UTC 2016 - coolo@suse.com + +- updated to version 3.1.1 + see installed CHANGELOG.markdown + + ## 3.1.1 + + * [#185](https://github.com/rails/web-console/pull/185) Fix `rails console` startup ([@gsamokovarov]) + + ## 3.1.0 + + * [#182](https://github.com/rails/web-console/pull/182) Let `#console` live in `Kernel` ([@schneems]) + * [#181](https://github.com/rails/web-console/pull/181) Log internal Web Console errors ([@gsamokovarov]) + * [#180](https://github.com/rails/web-console/pull/180) Autoload Web Console constants for faster Rails boot time ([@herminiotorres]) + +------------------------------------------------------------------- Old: ---- web-console-3.0.0.gem New: ---- web-console-3.1.1.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-web-console.spec ++++++ --- /var/tmp/diff_new_pack.UV1Ceu/_old 2016-04-22 16:24:27.000000000 +0200 +++ /var/tmp/diff_new_pack.UV1Ceu/_new 2016-04-22 16:24:27.000000000 +0200 @@ -24,7 +24,7 @@ # Name: rubygem-web-console -Version: 3.0.0 +Version: 3.1.1 Release: 0 %define mod_name web-console %define mod_full_name %{mod_name}-%{version} @@ -52,7 +52,7 @@ %install %gem_install \ - --doc-files="MIT-LICENSE" \ + --doc-files="CHANGELOG.markdown MIT-LICENSE README.markdown" \ -f %gem_packages ++++++ web-console-3.0.0.gem -> web-console-3.1.1.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHANGELOG.markdown new/CHANGELOG.markdown --- old/CHANGELOG.markdown 2015-12-13 17:58:49.000000000 +0100 +++ new/CHANGELOG.markdown 2016-01-28 10:20:38.000000000 +0100 @@ -2,6 +2,16 @@ ## master (unreleased) +## 3.1.1 + +* [#185](https://github.com/rails/web-console/pull/185) Fix `rails console` startup ([@gsamokovarov]) + +## 3.1.0 + +* [#182](https://github.com/rails/web-console/pull/182) Let `#console` live in `Kernel` ([@schneems]) +* [#181](https://github.com/rails/web-console/pull/181) Log internal Web Console errors ([@gsamokovarov]) +* [#180](https://github.com/rails/web-console/pull/180) Autoload Web Console constants for faster Rails boot time ([@herminiotorres]) + ## 3.0.0 * [#173](https://github.com/rails/web-console/pull/173) Revert "Change config.development_only default until 4.2.4 is released" ([@gsamokovarov]) @@ -55,3 +65,5 @@ [@parterburn]: https://github.com/parterburn [@sh19910711]: https://github.com/sh19910711 [@frenesim]: https://github.com/frenesim +[@herminiotorres]: https://github.com/herminiotorres +[@schneems]: https://github.com/schneems diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MIT-LICENSE new/MIT-LICENSE --- old/MIT-LICENSE 2015-12-13 17:58:49.000000000 +0100 +++ new/MIT-LICENSE 2016-01-28 10:20:38.000000000 +0100 @@ -1,4 +1,4 @@ -Copyright 2014 Charlie Somerville, Genadi Samokovarov, Guillermo Iguaran and Ryan Dao +Copyright 2014-2016 Charlie Somerville, Genadi Samokovarov, Guillermo Iguaran and Ryan Dao Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.markdown new/README.markdown --- old/README.markdown 2015-12-13 17:58:49.000000000 +0100 +++ new/README.markdown 2016-01-28 10:20:38.000000000 +0100 @@ -1,7 +1,8 @@ <p align=right> Documentation for: <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> + <a href=https://github.com/rails/web-console/tree/v2.2.1>v2.2.1</a> + <a href=https://github.com/rails/web-console/tree/v3.0.0>v3.0.0</a> </p> # Web Console [![Build Status](https://travis-ci.org/rails/web-console.svg?branch=master)](https://travis-ci.org/rails/web-console) @@ -67,8 +68,10 @@ end ``` -Only one `console` invocation is allowed per request. If you happen to have -multiple ones, a `WebConsole::DoubleRenderError` is raised. +The method is defined in `Kernel` and you can invoke it any application code. + +Only one `console` invocation is allowed once per request. If you happen to +have multiple ones, a `WebConsole::DoubleRenderError` will be raised. ## Configuration Files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/web_console/extensions.rb new/lib/web_console/extensions.rb --- old/lib/web_console/extensions.rb 2015-12-13 17:58:49.000000000 +0100 +++ new/lib/web_console/extensions.rb 2016-01-28 10:20:38.000000000 +0100 @@ -1,24 +1,48 @@ -ActionDispatch::DebugExceptions.class_eval do - def render_exception_with_web_console(request, exception) - render_exception_without_web_console(request, exception).tap do - # 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. - 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) - env['web_console.exception'] = error.original_exception +module Kernel + module_function + + # Instructs Web Console to render a console in the specified binding. + # + # If +bidning+ isn't explicitly given it will default to the binding of the + # previous frame. E.g. the one that invoked +console+. + # + # Raises DoubleRenderError if a double +console+ invocation per request is + # detected. + def console(binding = WebConsole.caller_bindings.first) + raise WebConsole::DoubleRenderError if Thread.current[:__web_console_binding] + + Thread.current[:__web_console_binding] = binding + + # Make sure nothing is rendered from the view helper. Otherwise + # you're gonna see unexpected #<Binding:0x007fee4302b078> in the + # templates. + nil + end +end + +module ActionDispatch + class DebugExceptions + def render_exception_with_web_console(request, exception) + render_exception_without_web_console(request, exception).tap do + # Retain superficial Rails 4.2 compatibility. + env = Hash === request ? request : request.env + + backtrace_cleaner = env['action_dispatch.backtrace_cleaner'] + error = ExceptionWrapper.new(backtrace_cleaner, exception).exception + + # Get the original exception if ExceptionWrapper decides to follow it. + Thread.current[:__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) + Thread.current[:__web_console_exception] = error.cause + end end end - end - alias_method :render_exception_without_web_console, :render_exception - alias_method :render_exception, :render_exception_with_web_console + alias_method :render_exception_without_web_console, :render_exception + alias_method :render_exception, :render_exception_with_web_console + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/web_console/helper.rb new/lib/web_console/helper.rb --- old/lib/web_console/helper.rb 2015-12-13 17:58:49.000000000 +0100 +++ new/lib/web_console/helper.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,22 +0,0 @@ -module WebConsole - module Helper - # Communicates with the middleware to render a console in a +binding+. - # - # If +bidning+ isn't explicitly given, Binding#of_caller will be used to - # get the binding of the previous frame. E.g. the one that invoked - # +console+. - # - # Raises DoubleRenderError if a double +console+ invocation per request is - # detected. - def console(binding = nil) - raise DoubleRenderError if request.env['web_console.binding'] - - request.env['web_console.binding'] = binding || ::WebConsole.caller_bindings.first - - # Make sure nothing is rendered from the view helper. Otherwise - # you're gonna see unexpected #<Binding:0x007fee4302b078> in the - # templates. - nil - end - end -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/web_console/integration.rb new/lib/web_console/integration.rb --- old/lib/web_console/integration.rb 2015-12-13 17:58:49.000000000 +0100 +++ new/lib/web_console/integration.rb 2016-01-28 10:20:38.000000000 +0100 @@ -19,7 +19,7 @@ # # Every integration should the instance variable. def bindings - @bindings || [] + (defined?(@bindings) && @bindings) || [] end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/web_console/middleware.rb new/lib/web_console/middleware.rb --- old/lib/web_console/middleware.rb 2015-12-13 17:58:49.000000000 +0100 +++ new/lib/web_console/middleware.rb 2016-01-28 10:20:38.000000000 +0100 @@ -15,34 +15,40 @@ end def call(env) - request = create_regular_or_whiny_request(env) - return @app.call(env) unless request.from_whitelisted_ip? + app_exception = catch :app_exception do + request = create_regular_or_whiny_request(env) + return call_app(env) unless request.from_whitelisted_ip? + + if id = id_for_repl_session_update(request) + return update_repl_session(id, request) + elsif id = id_for_repl_session_stack_frame_change(request) + return change_stack_trace(id, request) + end + + status, headers, body = call_app(env) + + if session = Session.from(Thread.current) and acceptable_content_type?(headers) + response = Response.new(body, status, headers) + template = Template.new(env, session) + + response.headers["X-Web-Console-Session-Id"] = session.id + response.headers["X-Web-Console-Mount-Point"] = mount_point + response.write(template.render('index')) + response.finish + else + [ status, headers, body ] + end + end + rescue => e + WebConsole.logger.error("\n#{e.class}: #{e}\n\tfrom #{e.backtrace.join("\n\tfrom ")}") + raise e + ensure + # Clean up the fiber locals after the session creation. Object#console + # uses those to communicate the current binding or exception to the middleware. + Thread.current[:__web_console_exception] = nil + Thread.current[:__web_console_binding] = nil - if id = id_for_repl_session_update(request) - return update_repl_session(id, request) - elsif id = id_for_repl_session_stack_frame_change(request) - return change_stack_trace(id, request) - end - - status, headers, body = @app.call(env) - - if exception = env['web_console.exception'] - session = Session.from_exception(exception) - elsif binding = env['web_console.binding'] - session = Session.from_binding(binding) - end - - if session && acceptable_content_type?(headers) - response = Response.new(body, status, headers) - template = Template.new(env, session) - - response.headers["X-Web-Console-Session-Id"] = session.id - response.headers["X-Web-Console-Mount-Point"] = mount_point - response.write(template.render('index')) - response.finish - else - [ status, headers, body ] - end + raise app_exception if Exception === app_exception end private @@ -120,5 +126,11 @@ { output: I18n.t('errors.unacceptable_request') } end end + + def call_app(env) + @app.call(env) + rescue => e + throw :app_exception, e + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/web_console/railtie.rb new/lib/web_console/railtie.rb --- old/lib/web_console/railtie.rb 2015-12-13 17:58:49.000000000 +0100 +++ new/lib/web_console/railtie.rb 2016-01-28 10:20:38.000000000 +0100 @@ -6,14 +6,11 @@ config.web_console.whitelisted_ips = %w( 127.0.0.1 ::1 ) initializer 'web_console.initialize' do + require 'web_console/integration' require 'web_console/extensions' - ActiveSupport.on_load(:action_view) do - ActionView::Base.send(:include, Helper) - end - - ActiveSupport.on_load(:action_controller) do - ActionController::Base.send(:include, Helper) + if logger = ::Rails.logger + WebConsole.logger = logger end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/web_console/session.rb new/lib/web_console/session.rb --- old/lib/web_console/session.rb 2015-12-13 17:58:49.000000000 +0100 +++ new/lib/web_console/session.rb 2016-01-28 10:20:38.000000000 +0100 @@ -1,9 +1,9 @@ module WebConsole - # A session lets you persist wrap an +Evaluator+ instance in memory - # associated with multiple bindings. + # A session lets you persist an +Evaluator+ instance in memory associated + # with multiple bindings. # # Each newly created session is persisted into memory and you can find it - # later its +id+. + # later by its +id+. # # A session may be associated with multiple bindings. This is used by the # error pages only, as currently, this is the only client that needs to do @@ -21,14 +21,19 @@ inmemory_storage[id] end - # Create a Session from an exception. - def from_exception(exc) - new(exc.bindings) - end - - # Create a Session from a single binding. - def from_binding(binding) - new(binding) + # Create a Session from an binding or exception in a storage. + # + # The storage is expected to respond to #[]. The binding is expected in + # :__web_console_binding and the exception in :__web_console_exception. + # + # Can return nil, if no binding or exception have been preserved in the + # storage. + def from(storage) + if exc = storage[:__web_console_exception] + new(exc.bindings) + elsif binding = storage[:__web_console_binding] + new(binding) + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/web_console/tracer.rb new/lib/web_console/tracer.rb --- old/lib/web_console/tracer.rb 2015-12-13 17:58:49.000000000 +0100 +++ new/lib/web_console/tracer.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,11 +0,0 @@ -module WebConsole - class BindingTracer - def initialize(exception) - @bindings = exception.bindings - @backtrace = exception.backtrace - end - - def binding_for_trace(trace) - end - end -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/web_console/version.rb new/lib/web_console/version.rb --- old/lib/web_console/version.rb 2015-12-13 17:58:49.000000000 +0100 +++ new/lib/web_console/version.rb 2016-01-28 10:20:38.000000000 +0100 @@ -1,3 +1,3 @@ module WebConsole - VERSION = '3.0.0' + VERSION = '3.1.1' end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/web_console.rb new/lib/web_console.rb --- old/lib/web_console.rb 2015-12-13 17:58:49.000000000 +0100 +++ new/lib/web_console.rb 2016-01-28 10:20:38.000000000 +0100 @@ -1,23 +1,29 @@ +require 'active_support/dependencies/autoload' require 'active_support/lazy_load_hooks' require 'active_support/logger' -require 'web_console/integration' -require 'web_console/railtie' -require 'web_console/errors' -require 'web_console/helper' -require 'web_console/evaluator' -require 'web_console/session' -require 'web_console/template' -require 'web_console/middleware' -require 'web_console/whitelist' -require 'web_console/request' -require 'web_console/response' -require 'web_console/view' -require 'web_console/whiny_request' - module WebConsole + extend ActiveSupport::Autoload + + autoload :View + autoload :Evaluator + autoload :Session + autoload :Response + autoload :Request + autoload :WhinyRequest + autoload :Whitelist + autoload :Template + autoload :Middleware + + autoload_at 'web_console/errors' do + autoload :Error + autoload :DoubleRenderError + end + mattr_accessor :logger @@logger = ActiveSupport::Logger.new($stderr) ActiveSupport.run_load_hooks(:web_console, self) end + +require 'web_console/railtie' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2015-12-13 17:58:49.000000000 +0100 +++ new/metadata 2016-01-28 10:20:38.000000000 +0100 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: web-console version: !ruby/object:Gem::Version - version: 3.0.0 + version: 3.1.1 platform: ruby authors: - Charlie Somerville @@ -11,7 +11,7 @@ autorequire: bindir: bin cert_chain: [] -date: 2015-12-13 00:00:00.000000000 Z +date: 2016-01-28 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: railties @@ -74,7 +74,6 @@ - lib/web_console/errors.rb - lib/web_console/evaluator.rb - lib/web_console/extensions.rb -- lib/web_console/helper.rb - lib/web_console/integration.rb - lib/web_console/integration/cruby.rb - lib/web_console/integration/rubinius.rb @@ -100,7 +99,6 @@ - lib/web_console/testing/erb_precompiler.rb - lib/web_console/testing/fake_middleware.rb - lib/web_console/testing/helper.rb -- lib/web_console/tracer.rb - lib/web_console/version.rb - lib/web_console/view.rb - lib/web_console/whiny_request.rb @@ -125,7 +123,7 @@ version: '0' requirements: [] rubyforge_project: -rubygems_version: 2.4.5 +rubygems_version: 2.5.1 signing_key: specification_version: 4 summary: A debugging tool for your Ruby on Rails applications.
participants (1)
-
root@hilbert.suse.de