Hello community,
here is the log from the commit of package rubygem-web-console for
openSUSE:Factory checked in at 2018-05-06 15:01:38
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-web-console (Old)
and /work/SRC/openSUSE:Factory/.rubygem-web-console.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-web-console"
Sun May 6 15:01:38 2018 rev:16 rq:603058 version:3.6.2
Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-web-console/rubygem-web-console.changes
2017-07-26 13:05:45.666151647 +0200
+++
/work/SRC/openSUSE:Factory/.rubygem-web-console.new/rubygem-web-console.changes
2018-05-06 15:01:56.371988647 +0200
@@ -1,0 +2,35 @@
+Sun Apr 29 19:14:43 UTC 2018 - [email protected]
+
+- updated to version 3.6.2
+ see installed CHANGELOG.markdown
+
+ ## 3.6.2
+
+ * [#255](https://github.com/rails/web-console/pull/255) Fix the truncated
HTML body, because of wrong Content-Length header ([@timomeh])
+
+-------------------------------------------------------------------
+Thu Apr 19 07:17:27 UTC 2018 - [email protected]
+
+- updated to version 3.6.1
+ see installed CHANGELOG.markdown
+
+ ## 3.6.1
+
+ * [#252](https://github.com/rails/web-console/pull/252) Fix improper
injection in Rack bodies like ActionDispatch::Response::RackBody
([@gsamokovarov])
+
+-------------------------------------------------------------------
+Tue Apr 10 17:52:21 UTC 2018 - [email protected]
+
+- updated to version 3.6.0
+ see installed CHANGELOG.markdown
+
+ ## 3.6.0
+
+ * [#254](https://github.com/rails/web-console/pull/254) Rescue
ActionDispatch::RemoteIp::IpSpoofAttackError ([@wjordan])
+ * [#250](https://github.com/rails/web-console/pull/250) Close original body
to comply with Rack SPEC ([@wagenet])
+ * [#249](https://github.com/rails/web-console/pull/249) Update for
frozen-string-literal friendliness ([@pat])
+ * [#248](https://github.com/rails/web-console/pull/248) Fix copy on Safari
([@ybart])
+ * [#246](https://github.com/rails/web-console/pull/246) International
keyboard special character input fixes ([@fl0l0u])
+ * [#244](https://github.com/rails/web-console/pull/244) Let
WebConsole.logger respect Rails.logger ([@gsamokovarov])
+
+-------------------------------------------------------------------
Old:
----
web-console-3.5.1.gem
New:
----
web-console-3.6.2.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-web-console.spec ++++++
--- /var/tmp/diff_new_pack.IdTfLR/_old 2018-05-06 15:01:57.463948567 +0200
+++ /var/tmp/diff_new_pack.IdTfLR/_new 2018-05-06 15:01:57.463948567 +0200
@@ -1,7 +1,7 @@
#
# spec file for package rubygem-web-console
#
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -24,7 +24,7 @@
#
Name: rubygem-web-console
-Version: 3.5.1
+Version: 3.6.2
Release: 0
%define mod_name web-console
%define mod_full_name %{mod_name}-%{version}
++++++ web-console-3.5.1.gem -> web-console-3.6.2.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/CHANGELOG.markdown new/CHANGELOG.markdown
--- old/CHANGELOG.markdown 2017-05-12 12:27:36.000000000 +0200
+++ new/CHANGELOG.markdown 2018-04-29 20:40:18.000000000 +0200
@@ -2,15 +2,32 @@
## master (unreleased)
+## 3.6.2
+
+* [#255](https://github.com/rails/web-console/pull/255) Fix the truncated HTML
body, because of wrong Content-Length header ([@timomeh])
+
+## 3.6.1
+
+* [#252](https://github.com/rails/web-console/pull/252) Fix improper injection
in Rack bodies like ActionDispatch::Response::RackBody ([@gsamokovarov])
+
+## 3.6.0
+
+* [#254](https://github.com/rails/web-console/pull/254) Rescue
ActionDispatch::RemoteIp::IpSpoofAttackError ([@wjordan])
+* [#250](https://github.com/rails/web-console/pull/250) Close original body to
comply with Rack SPEC ([@wagenet])
+* [#249](https://github.com/rails/web-console/pull/249) Update for
frozen-string-literal friendliness ([@pat])
+* [#248](https://github.com/rails/web-console/pull/248) Fix copy on Safari
([@ybart])
+* [#246](https://github.com/rails/web-console/pull/246) International keyboard
special character input fixes ([@fl0l0u])
+* [#244](https://github.com/rails/web-console/pull/244) Let WebConsole.logger
respect Rails.logger ([@gsamokovarov])
+
## 3.5.1
-* [239](https://github.com/rails/web-console/pull/239) Fix the
ActionDispatch::DebugExceptions integration ([@gsamokovarov])
+* [#239](https://github.com/rails/web-console/pull/239) Fix the
ActionDispatch::DebugExceptions integration ([@gsamokovarov])
## 3.5.0
-* [237](https://github.com/rails/web-console/pull/237) Bindex integration for
JRuby 9k support ([@gsamokovarov])
-* [236](https://github.com/rails/web-console/pull/236) Remove unused Active
Support lazy load hook ([@betesh])
-* [230](https://github.com/rails/web-console/pull/230) Handle invalid remote
addresses ([@akirakoyasu])
+* [#237](https://github.com/rails/web-console/pull/237) Bindex integration for
JRuby 9k support ([@gsamokovarov])
+* [#236](https://github.com/rails/web-console/pull/236) Remove unused Active
Support lazy load hook ([@betesh])
+* [#230](https://github.com/rails/web-console/pull/230) Handle invalid remote
addresses ([@akirakoyasu])
## 3.4.0
@@ -22,7 +39,7 @@
## 3.3.0
-* [203](https://github.com/rails/web-console/pull/203) Map bindings to traces
based on the trace __FILE__ and __LINE__ ([@gsamokovarov])
+* [#203](https://github.com/rails/web-console/pull/203) Map bindings to traces
based on the trace __FILE__ and __LINE__ ([@gsamokovarov])
## 3.2.1
@@ -55,8 +72,8 @@
This is mainly a Rails 5 compatibility release. If you have the chance, please
go to 3.1.0 instead.
-* [#181](https://github.com/rails/web-console/pull/181) Log internal Web
Console errors (@schneems)
-* [#150](https://github.com/rails/web-console/pull/150) Revert #150.
(@gsamokovarov)
+* [#181](https://github.com/rails/web-console/pull/181) Log internal Web
Console errors ([@schneems])
+* [#150](https://github.com/rails/web-console/pull/150) Revert #150.
([@gsamokovarov])
## 2.2.1
@@ -108,3 +125,9 @@
[@schneems]: https://github.com/schneems
[@betesh]: https://github.com/betesh
[@akirakoyasu]: https://github.com/akirakoyasu
+[@wagenet]: https://github.com/wagenet
+[@wjordan]: https://github.com/wjordan
+[@pat]: https://github.com/pat
+[@ybart]: https://github.com/ybart
+[@fl0l0u]: https://github.com/fl0l0u
+[@timomeh]: https://github.com/timomeh
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/README.markdown new/README.markdown
--- old/README.markdown 2017-05-12 12:27:36.000000000 +0200
+++ new/README.markdown 2018-04-29 20:40:18.000000000 +0200
@@ -2,7 +2,6 @@
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.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 [](https://travis-ci.org/rails/web-console)
@@ -17,8 +16,7 @@
## Installation
-_Web Console_ is meant to work as a Rails plugin. To install it in your current
-application, add the following to your `Gemfile`.
+Add the following to your `Gemfile`.
```ruby
group :development do
@@ -26,13 +24,10 @@
end
```
-After you save the `Gemfile` changes, make sure to run `bundle install` and
-restart your server for the _Web Console_ to kick in.
-
## Usage
The web console allows you to create an interactive Ruby session in your
-browser. Those sessions are launched automatically in case on an error, but
+browser. Those sessions are launched automatically in case of an error, but
they can also be launched manually in any page.
For example, calling `console` in a view will display a console in the current
@@ -56,8 +51,8 @@
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.
+Only one `console` invocation per request is allowed. If you happen to
+have multiple ones, `WebConsole::DoubleRenderError` will be raised.
## Configuration
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Rakefile new/Rakefile
--- old/Rakefile 2017-05-12 12:27:36.000000000 +0200
+++ new/Rakefile 2018-04-29 20:40:18.000000000 +0200
@@ -1,26 +1,28 @@
+# frozen_string_literal: true
+
begin
- require 'bundler/setup'
+ require "bundler/setup"
rescue LoadError
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
+ puts "You must `gem install bundler` and `bundle install` to run rake tasks"
end
-require 'socket'
-require 'rake/testtask'
-require 'tmpdir'
-require 'securerandom'
-require 'json'
-require 'web_console/testing/erb_precompiler'
+require "socket"
+require "rake/testtask"
+require "tmpdir"
+require "securerandom"
+require "json"
+require "web_console/testing/erb_precompiler"
EXPANDED_CWD = File.expand_path(File.dirname(__FILE__))
Rake::TestTask.new(:test) do |t|
- t.libs << 'lib'
- t.libs << 'test'
- t.pattern = 'test/**/*_test.rb'
+ t.libs << "lib"
+ t.libs << "test"
+ t.pattern = "test/**/*_test.rb"
t.verbose = false
end
-Dir['lib/web_console/tasks/**/*.rake'].each { |task| load task }
+Dir["lib/web_console/tasks/**/*.rake"].each { |task| load task }
Bundler::GemHelper.install_tasks
Binary 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.rb new/lib/web-console.rb
--- old/lib/web-console.rb 2017-05-12 12:27:36.000000000 +0200
+++ new/lib/web-console.rb 2018-04-29 20:40:18.000000000 +0200
@@ -1 +1,3 @@
-require 'web_console'
+# frozen_string_literal: true
+
+require "web_console"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/web_console/context.rb
new/lib/web_console/context.rb
--- old/lib/web_console/context.rb 2017-05-12 12:27:36.000000000 +0200
+++ new/lib/web_console/context.rb 2018-04-29 20:40:18.000000000 +0200
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module WebConsole
# A context lets you get object names related to the current session binding.
class Context
@@ -17,12 +19,12 @@
private
GLOBAL_OBJECTS = [
- 'instance_variables',
- 'local_variables',
- 'methods',
- 'class_variables',
- 'Object.constants',
- 'global_variables'
+ "instance_variables",
+ "local_variables",
+ "methods",
+ "class_variables",
+ "Object.constants",
+ "global_variables"
]
def global
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/web_console/errors.rb
new/lib/web_console/errors.rb
--- old/lib/web_console/errors.rb 2017-05-12 12:27:36.000000000 +0200
+++ new/lib/web_console/errors.rb 2018-04-29 20:40:18.000000000 +0200
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module WebConsole
# The base class for every Web Console related error.
Error = Class.new(StandardError)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/web_console/evaluator.rb
new/lib/web_console/evaluator.rb
--- old/lib/web_console/evaluator.rb 2017-05-12 12:27:36.000000000 +0200
+++ new/lib/web_console/evaluator.rb 2018-04-29 20:40:18.000000000 +0200
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module WebConsole
# Simple Ruby code evaluator.
#
@@ -8,7 +10,7 @@
# Cleanses exceptions raised inside #eval.
cattr_reader :cleaner
@@cleaner = ActiveSupport::BacktraceCleaner.new
- @@cleaner.add_silencer { |line| line.start_with?(File.expand_path('..',
__FILE__)) }
+ @@cleaner.add_silencer { |line| line.start_with?(File.expand_path("..",
__FILE__)) }
def initialize(binding = TOPLEVEL_BINDING)
@binding = binding
@@ -25,7 +27,7 @@
def format_exception(exc)
backtrace = cleaner.clean(Array(exc.backtrace) - caller)
- format = "#{exc.class.name}: #{exc}\n"
+ format = "#{exc.class.name}: #{exc}\n".dup
format << backtrace.map { |trace| "\tfrom #{trace}\n" }.join
format
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/web_console/exception_mapper.rb
new/lib/web_console/exception_mapper.rb
--- old/lib/web_console/exception_mapper.rb 2017-05-12 12:27:36.000000000
+0200
+++ new/lib/web_console/exception_mapper.rb 2018-04-29 20:40:18.000000000
+0200
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module WebConsole
class ExceptionMapper
def initialize(exception)
@@ -15,19 +17,19 @@
private
- def guess_binding_for_index(index)
- file, line = @backtrace[index].to_s.split(':')
- line = line.to_i
-
- @bindings.find do |binding|
- binding.eval('__FILE__') == file && binding.eval('__LINE__') == line
+ def guess_binding_for_index(index)
+ file, line = @backtrace[index].to_s.split(":")
+ line = line.to_i
+
+ @bindings.find do |binding|
+ binding.eval("__FILE__") == file && binding.eval("__LINE__") == line
+ end
end
- end
- def guess_the_first_application_binding
- @bindings.find do |binding|
- binding.eval('__FILE__').to_s.start_with?(Rails.root.to_s)
+ def guess_the_first_application_binding
+ @bindings.find do |binding|
+ binding.eval("__FILE__").to_s.start_with?(Rails.root.to_s)
+ end
end
- end
end
end
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 2017-05-12 12:27:36.000000000 +0200
+++ new/lib/web_console/extensions.rb 2018-04-29 20:40:18.000000000 +0200
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Kernel
module_function
@@ -24,7 +26,7 @@
class DebugExceptions
def render_exception_with_web_console(request, exception)
render_exception_without_web_console(request, exception).tap do
- backtrace_cleaner =
request.get_header('action_dispatch.backtrace_cleaner')
+ backtrace_cleaner =
request.get_header("action_dispatch.backtrace_cleaner")
error = ExceptionWrapper.new(backtrace_cleaner, exception).exception
# Get the original exception if ExceptionWrapper decides to follow it.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/web_console/injector.rb
new/lib/web_console/injector.rb
--- old/lib/web_console/injector.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/lib/web_console/injector.rb 2018-04-29 20:40:18.000000000 +0200
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+module WebConsole
+ # Injects content into a Rack body.
+ class Injector
+ def initialize(body, headers)
+ @body = "".dup
+
+ body.each { |part| @body << part }
+ body.close if body.respond_to?(:close)
+
+ @headers = headers
+ end
+
+ def inject(content)
+ # Remove any previously set Content-Length header because we modify
+ # the body. Otherwise the response will be truncated.
+ @headers.delete("Content-Length")
+
+ [
+ if position = @body.rindex("</body>")
+ [ @body.insert(position, content) ]
+ else
+ [ @body << content ]
+ end,
+ @headers
+ ]
+ end
+ 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 2017-05-12 12:27:36.000000000 +0200
+++ new/lib/web_console/middleware.rb 2018-04-29 20:40:18.000000000 +0200
@@ -1,11 +1,13 @@
-require 'active_support/core_ext/string/strip'
+# frozen_string_literal: true
+
+require "active_support/core_ext/string/strip"
module WebConsole
class Middleware
- TEMPLATES_PATH = File.expand_path('../templates', __FILE__)
+ TEMPLATES_PATH = File.expand_path("../templates", __FILE__)
cattr_accessor :mount_point
- @@mount_point = '/__web_console'
+ @@mount_point = "/__web_console"
cattr_accessor :whiny_requests
@@whiny_requests = true
@@ -27,17 +29,15 @@
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)
+ if (session = Session.from(Thread.current)) &&
acceptable_content_type?(headers)
+ headers["X-Web-Console-Session-Id"] = session.id
+ headers["X-Web-Console-Mount-Point"] = mount_point
- 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 ]
+ template = Template.new(env, session)
+ body, headers = Injector.new(body,
headers).inject(template.render("index"))
end
+
+ [ status, headers, body ]
end
rescue => e
WebConsole.logger.error("\n#{e.class}: #{e}\n\tfrom
#{e.backtrace.join("\n\tfrom ")}")
@@ -54,15 +54,15 @@
private
def acceptable_content_type?(headers)
- Mime::Type.parse(headers['Content-Type'].to_s).first == Mime[:html]
+ Mime::Type.parse(headers["Content-Type"].to_s).first == Mime[:html]
end
def json_response(opts = {})
status = opts.fetch(:status, 200)
- headers = { 'Content-Type' => 'application/json; charset = utf-8' }
+ headers = { "Content-Type" => "application/json; charset = utf-8" }
body = yield.to_json
- Rack::Response.new(body, status, headers).finish
+ [ status, headers, [ body ] ]
end
def json_response_with_session(id, request, opts = {})
@@ -121,13 +121,13 @@
def respond_with_unavailable_session(id)
json_response(status: 404) do
- { output: format(I18n.t('errors.unavailable_session'), id: id)}
+ { output: format(I18n.t("errors.unavailable_session"), id: id) }
end
end
def respond_with_unacceptable_request
json_response(status: 406) do
- { output: I18n.t('errors.unacceptable_request') }
+ { output: I18n.t("errors.unacceptable_request") }
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 2017-05-12 12:27:36.000000000 +0200
+++ new/lib/web_console/railtie.rb 2018-04-29 20:40:18.000000000 +0200
@@ -1,20 +1,18 @@
-require 'rails/railtie'
+# frozen_string_literal: true
+
+require "rails/railtie"
module WebConsole
class Railtie < ::Rails::Railtie
config.web_console = ActiveSupport::OrderedOptions.new
config.web_console.whitelisted_ips = %w( 127.0.0.1 ::1 )
- initializer 'web_console.initialize' do
- require 'bindex'
- require 'web_console/extensions'
-
- if logger = ::Rails.logger
- WebConsole.logger = logger
- end
+ initializer "web_console.initialize" do
+ require "bindex"
+ require "web_console/extensions"
end
- initializer 'web_console.development_only' do
+ 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. This is
@@ -32,13 +30,13 @@
end
end
- initializer 'web_console.insert_middleware' do |app|
+ initializer "web_console.insert_middleware" do |app|
app.middleware.insert_before ActionDispatch::DebugExceptions, Middleware
end
- initializer 'web_console.mount_point' do
+ initializer "web_console.mount_point" do
if mount_point = config.web_console.mount_point
- Middleware.mount_point = mount_point.chomp('/')
+ Middleware.mount_point = mount_point.chomp("/")
end
if root = Rails.application.config.relative_url_root
@@ -46,26 +44,26 @@
end
end
- initializer 'web_console.template_paths' do
+ initializer "web_console.template_paths" do
if template_paths = config.web_console.template_paths
Template.template_paths.unshift(*Array(template_paths))
end
end
- initializer 'web_console.whitelisted_ips' do
+ initializer "web_console.whitelisted_ips" do
if whitelisted_ips = config.web_console.whitelisted_ips
Request.whitelisted_ips = Whitelist.new(whitelisted_ips)
end
end
- initializer 'web_console.whiny_requests' do
+ initializer "web_console.whiny_requests" do
if config.web_console.key?(:whiny_requests)
Middleware.whiny_requests = config.web_console.whiny_requests
end
end
- initializer 'i18n.load_path' do
- config.i18n.load_path.concat(Dir[File.expand_path('../locales/*.yml',
__FILE__)])
+ initializer "i18n.load_path" do
+ config.i18n.load_path.concat(Dir[File.expand_path("../locales/*.yml",
__FILE__)])
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/web_console/request.rb
new/lib/web_console/request.rb
--- old/lib/web_console/request.rb 2017-05-12 12:27:36.000000000 +0200
+++ new/lib/web_console/request.rb 2018-04-29 20:40:18.000000000 +0200
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module WebConsole
# Web Console tailored request object.
class Request < ActionDispatch::Request
@@ -6,7 +8,7 @@
@@whitelisted_ips = Whitelist.new
# Define a vendor MIME type. We can call it using Mime[:web_console_v2].
- Mime::Type.register 'application/vnd.web-console.v2', :web_console_v2
+ Mime::Type.register "application/vnd.web-console.v2", :web_console_v2
# Returns whether a request came from a whitelisted IP.
#
@@ -19,6 +21,8 @@
# Determines the remote IP using our much stricter whitelist.
def strict_remote_ip
GetSecureIp.new(self, whitelisted_ips).to_s
+ rescue ActionDispatch::RemoteIp::IpSpoofAttackError
+ "[Spoofed]"
end
# Returns whether the request is acceptable.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/web_console/response.rb
new/lib/web_console/response.rb
--- old/lib/web_console/response.rb 2017-05-12 12:27:36.000000000 +0200
+++ new/lib/web_console/response.rb 1970-01-01 01:00:00.000000000 +0100
@@ -1,23 +0,0 @@
-module WebConsole
- # A response object that writes content before the closing </body> tag, if
- # possible.
- #
- # The object quacks like Rack::Response.
- class Response < Struct.new(:body, :status, :headers)
- def write(content)
- raw_body = Array(body).first.to_s
-
- if position = raw_body.rindex('</body>')
- raw_body.insert(position, content)
- else
- raw_body << content
- end
-
- self.body = raw_body
- end
-
- def finish
- Rack::Response.new(body, status, headers).finish
- end
- 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 2017-05-12 12:27:37.000000000 +0200
+++ new/lib/web_console/session.rb 2018-04-29 20:40:18.000000000 +0200
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module WebConsole
# A session lets you persist an +Evaluator+ instance in memory associated
# with multiple bindings.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/web_console/tasks/extensions.rake
new/lib/web_console/tasks/extensions.rake
--- old/lib/web_console/tasks/extensions.rake 2017-05-12 12:27:37.000000000
+0200
+++ new/lib/web_console/tasks/extensions.rake 2018-04-29 20:40:18.000000000
+0200
@@ -1,23 +1,25 @@
+# frozen_string_literal: true
+
namespace :ext do
- rootdir = Pathname('extensions')
+ rootdir = Pathname("extensions")
- desc 'Build Chrome Extension'
- task chrome: 'chrome:build'
+ desc "Build Chrome Extension"
+ task chrome: "chrome:build"
namespace :chrome do
- dist = Pathname('dist/crx')
+ dist = Pathname("dist/crx")
extdir = rootdir.join(dist)
- manifest_json = rootdir.join('chrome/manifest.json')
+ manifest_json = rootdir.join("chrome/manifest.json")
directory extdir
- task build: [ extdir, 'lib:templates' ] do
+ task build: [ extdir, "lib:templates" ] do
cd rootdir do
- cp_r [ 'img/', 'tmp/lib/' ], dist
+ cp_r [ "img/", "tmp/lib/" ], dist
`cd chrome && git ls-files`.split("\n").each do |src|
dest = dist.join(src)
mkdir_p dest.dirname
- cp Pathname('chrome').join(src), dest
+ cp Pathname("chrome").join(src), dest
end
end
end
@@ -34,7 +36,7 @@
cd(extdir) { sh "zip -r ../crx-web-console-#{version}.zip ./" }
end
- desc 'Launch a browser with the chrome extension.'
+ desc "Launch a browser with the chrome extension."
task run: [ :build ] do
cd(rootdir) { sh "sh ./script/run_chrome.sh --load-extension=#{dist}" }
end
@@ -45,15 +47,15 @@
end
namespace :lib do
- templates = Pathname('lib/web_console/templates')
- tmplib = rootdir.join('tmp/lib/')
- js_erb = FileList.new(templates.join('**/*.js.erb'))
+ templates = Pathname("lib/web_console/templates")
+ tmplib = rootdir.join("tmp/lib/")
+ js_erb = FileList.new(templates.join("**/*.js.erb"))
dirs = js_erb.pathmap("%{^#{templates},#{tmplib}}d")
task templates: dirs + js_erb.pathmap("%{^#{templates},#{tmplib}}X")
dirs.each { |d| directory d }
- rule '.js' => [ "%{^#{tmplib},#{templates}}X.js.erb" ] do |t|
+ rule ".js" => [ "%{^#{tmplib},#{templates}}X.js.erb" ] do |t|
File.write(t.name,
WebConsole::Testing::ERBPrecompiler.new(t.source).build)
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/web_console/tasks/templates.rake
new/lib/web_console/tasks/templates.rake
--- old/lib/web_console/tasks/templates.rake 2017-05-12 12:27:37.000000000
+0200
+++ new/lib/web_console/tasks/templates.rake 2018-04-29 20:40:18.000000000
+0200
@@ -1,14 +1,16 @@
+# frozen_string_literal: true
+
namespace :templates do
- desc 'Run tests for templates'
+ desc "Run tests for templates"
task test: [ :daemonize, :npm, :rackup, :wait, :mocha, :kill, :exit ]
task serve: [ :npm, :rackup ]
- workdir = Pathname(EXPANDED_CWD).join('test/templates')
+ workdir = Pathname(EXPANDED_CWD).join("test/templates")
pid = Pathname(Dir.tmpdir).join("web_console_test.pid")
runner = URI.parse("http://#{ENV['IP'] || '127.0.0.1'}:#{ENV['PORT'] ||
29292}/html/test_runner.html")
rackup = "rackup --host #{runner.host} --port #{runner.port}"
result = nil
- browser = 'phantomjs'
+ browser = "phantomjs"
def need_to_wait?(uri)
Net::HTTP.start(uri.host, uri.port) { |http| http.get(uri.path) }
@@ -20,13 +22,13 @@
rackup += " -D --pid #{pid}"
end
- task :npm => [ :phantomjs ] do
- Dir.chdir(workdir) { system 'npm install --silent' }
+ task npm: [ :phantomjs ] do
+ Dir.chdir(workdir) { system "npm install --silent" }
end
task :phantomjs do
unless system("which #{browser} >/dev/null")
- browser = './node_modules/.bin/phantomjs'
+ browser = "./node_modules/.bin/phantomjs"
Dir.chdir(workdir) { system("test -f #{browser} || npm install --silent
phantomjs-prebuilt") }
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/web_console/template.rb
new/lib/web_console/template.rb
--- old/lib/web_console/template.rb 2017-05-12 12:27:37.000000000 +0200
+++ new/lib/web_console/template.rb 2018-04-29 20:40:18.000000000 +0200
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module WebConsole
# A facade that handles template rendering and composition.
#
@@ -6,7 +8,7 @@
class Template
# Lets you customize the default templates folder location.
cattr_accessor :template_paths
- @@template_paths = [ File.expand_path('../templates', __FILE__) ]
+ @@template_paths = [ File.expand_path("../templates", __FILE__) ]
def initialize(env, session)
@env = env
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/web_console/templates/console.js.erb
new/lib/web_console/templates/console.js.erb
--- old/lib/web_console/templates/console.js.erb 2017-05-12
12:27:37.000000000 +0200
+++ new/lib/web_console/templates/console.js.erb 2018-04-29
20:40:18.000000000 +0200
@@ -494,7 +494,7 @@
hint.className = 'console-hint';
hint.dataset.keyword = found;
hint.innerText = found.substr(self.suggestKeyword.length);
- // clear hinting information after timeout in a few time
+ // clear hinting information after timeout in a few time
if (self.suggestTimeout) clearTimeout(self.suggestTimeout);
self.suggestTimeout = setTimeout(function() { self.renderInput() },
self.suggestWait);
}
@@ -710,9 +710,10 @@
}
if (ev.ctrlKey || ev.metaKey) {
- // Set focus to our clipboard in case they hit the "v" key
- this.clipboard.focus();
if (ev.keyCode == 86) {
+ // Set focus to our clipboard when they hit the "v" key
+ this.clipboard.focus();
+
// Pasting to clipboard doesn't happen immediately,
// so we have to wait for a while to get the pasted text.
var _this = this;
@@ -732,7 +733,7 @@
*/
REPLConsole.prototype.onKeyPress = function(ev) {
// Only write to the console if it's a single key press.
- if (ev.ctrlKey || ev.metaKey) { return; }
+ if (ev.ctrlKey && !ev.altKey || ev.metaKey) { return; }
var keyCode = ev.keyCode || ev.which;
this.insertAtCurrent(String.fromCharCode(keyCode));
ev.stopPropagation();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/web_console/testing/erb_precompiler.rb
new/lib/web_console/testing/erb_precompiler.rb
--- old/lib/web_console/testing/erb_precompiler.rb 2017-05-12
12:27:37.000000000 +0200
+++ new/lib/web_console/testing/erb_precompiler.rb 2018-04-29
20:40:18.000000000 +0200
@@ -1,5 +1,7 @@
-require 'web_console/testing/helper'
-require 'web_console/testing/fake_middleware'
+# frozen_string_literal: true
+
+require "web_console/testing/helper"
+require "web_console/testing/fake_middleware"
module WebConsole
module Testing
@@ -8,7 +10,7 @@
def initialize(path)
@erb = ERB.new(File.read(path))
@view = FakeMiddleware.new(
- view_path: Helper.gem_root.join('lib/web_console/templates'),
+ view_path: Helper.gem_root.join("lib/web_console/templates"),
).view
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/web_console/testing/fake_middleware.rb
new/lib/web_console/testing/fake_middleware.rb
--- old/lib/web_console/testing/fake_middleware.rb 2017-05-12
12:27:37.000000000 +0200
+++ new/lib/web_console/testing/fake_middleware.rb 2018-04-29
20:40:18.000000000 +0200
@@ -1,12 +1,14 @@
-require 'action_view'
-require 'web_console'
-require 'web_console/testing/helper'
-Mime = { web_console_v2: 'fake' }
+# frozen_string_literal: true
+
+require "action_view"
+require "web_console"
+require "web_console/testing/helper"
+Mime = { web_console_v2: "fake" }
module WebConsole
module Testing
class FakeMiddleware
-
I18n.load_path.concat(Dir[Helper.gem_root.join('lib/web_console/locales/*.yml')])
+
I18n.load_path.concat(Dir[Helper.gem_root.join("lib/web_console/locales/*.yml")])
DEFAULT_HEADERS = { "Content-Type" => "application/javascript" }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/web_console/testing/helper.rb
new/lib/web_console/testing/helper.rb
--- old/lib/web_console/testing/helper.rb 2017-05-12 12:27:37.000000000
+0200
+++ new/lib/web_console/testing/helper.rb 2018-04-29 20:40:18.000000000
+0200
@@ -1,8 +1,10 @@
+# frozen_string_literal: true
+
module WebConsole
module Testing
module Helper
def self.gem_root
- Pathname(File.expand_path('../../../../', __FILE__))
+ Pathname(File.expand_path("../../../../", __FILE__))
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 2017-05-12 12:27:37.000000000 +0200
+++ new/lib/web_console/version.rb 2018-04-29 20:40:18.000000000 +0200
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module WebConsole
- VERSION = '3.5.1'
+ VERSION = "3.6.2"
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/web_console/view.rb new/lib/web_console/view.rb
--- old/lib/web_console/view.rb 2017-05-12 12:27:37.000000000 +0200
+++ new/lib/web_console/view.rb 2018-04-29 20:40:18.000000000 +0200
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module WebConsole
class View < ActionView::Base
# Execute a block only on error pages.
@@ -15,7 +17,7 @@
# leaking globals, unless you explicitly want to.
def render_javascript(template)
assign(template: template)
- render(template: template, layout: 'layouts/javascript')
+ render(template: template, layout: "layouts/javascript")
end
# Render inlined string to be used inside of JavaScript code.
@@ -23,7 +25,7 @@
# The inlined string is returned as an actual JavaScript string. You
# don't need to wrap the result yourself.
def render_inlined_string(template)
- render(template: template, layout: 'layouts/inlined_string')
+ render(template: template, layout: "layouts/inlined_string")
end
# Custom ActionView::Base#render wrapper which silences all the log
@@ -31,7 +33,7 @@
#
# Helps to keep the Rails logs clean during errors.
def render(*)
- if logger = WebConsole.logger and logger.respond_to?(:silence)
+ if (logger = WebConsole.logger) && logger.respond_to?(:silence)
WebConsole.logger.silence { super }
else
super
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/web_console/whiny_request.rb
new/lib/web_console/whiny_request.rb
--- old/lib/web_console/whiny_request.rb 2017-05-12 12:27:37.000000000
+0200
+++ new/lib/web_console/whiny_request.rb 2018-04-29 20:40:18.000000000
+0200
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module WebConsole
# Noisy wrapper around +Request+.
#
@@ -21,7 +23,7 @@
end
def logger
- env['action_dispatch.logger'] || WebConsole.logger
+ env["action_dispatch.logger"] || WebConsole.logger
end
def request
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/web_console/whitelist.rb
new/lib/web_console/whitelist.rb
--- old/lib/web_console/whitelist.rb 2017-05-12 12:27:37.000000000 +0200
+++ new/lib/web_console/whitelist.rb 2018-04-29 20:40:18.000000000 +0200
@@ -1,4 +1,6 @@
-require 'ipaddr'
+# frozen_string_literal: true
+
+require "ipaddr"
module WebConsole
# Whitelist of allowed networks that can access Web Console.
@@ -20,7 +22,7 @@
end
def to_s
- @networks.map(&method(:human_readable_ipaddr)).join(', ')
+ @networks.map(&method(:human_readable_ipaddr)).join(", ")
end
private
@@ -38,7 +40,7 @@
end
def human_readable_ipaddr(ipaddr)
- ipaddr.to_range.to_s.split('..').uniq.join('/')
+ ipaddr.to_range.to_s.split("..").uniq.join("/")
end
end
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 2017-05-12 12:27:36.000000000 +0200
+++ new/lib/web_console.rb 2018-04-29 20:40:18.000000000 +0200
@@ -1,5 +1,7 @@
-require 'active_support/dependencies/autoload'
-require 'active_support/logger'
+# frozen_string_literal: true
+
+require "active_support/dependencies/autoload"
+require "active_support/logger"
module WebConsole
extend ActiveSupport::Autoload
@@ -8,7 +10,7 @@
autoload :Evaluator
autoload :ExceptionMapper
autoload :Session
- autoload :Response
+ autoload :Injector
autoload :Request
autoload :WhinyRequest
autoload :Whitelist
@@ -16,13 +18,14 @@
autoload :Middleware
autoload :Context
- autoload_at 'web_console/errors' do
+ autoload_at "web_console/errors" do
autoload :Error
autoload :DoubleRenderError
end
- mattr_accessor :logger
- @@logger = ActiveSupport::Logger.new($stderr)
+ def self.logger
+ Rails.logger || (@logger ||= ActiveSupport::Logger.new($stderr))
+ end
end
-require 'web_console/railtie'
+require "web_console/railtie"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2017-05-12 12:27:36.000000000 +0200
+++ new/metadata 2018-04-29 20:40:18.000000000 +0200
@@ -1,7 +1,7 @@
--- !ruby/object:Gem::Specification
name: web-console
version: !ruby/object:Gem::Version
- version: 3.5.1
+ version: 3.6.2
platform: ruby
authors:
- Charlie Somerville
@@ -11,7 +11,7 @@
autorequire:
bindir: bin
cert_chain: []
-date: 2017-05-12 00:00:00.000000000 Z
+date: 2018-04-29 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: railties
@@ -90,11 +90,11 @@
- lib/web_console/evaluator.rb
- lib/web_console/exception_mapper.rb
- lib/web_console/extensions.rb
+- lib/web_console/injector.rb
- lib/web_console/locales/en.yml
- lib/web_console/middleware.rb
- lib/web_console/railtie.rb
- lib/web_console/request.rb
-- lib/web_console/response.rb
- lib/web_console/session.rb
- lib/web_console/tasks/extensions.rake
- lib/web_console/tasks/templates.rake
@@ -136,7 +136,7 @@
version: '0'
requirements: []
rubyforge_project:
-rubygems_version: 2.6.11
+rubygems_version: 2.7.3
signing_key:
specification_version: 4
summary: A debugging tool for your Ruby on Rails applications.