web-console 2.1.3 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.markdown +45 -0
  3. data/README.markdown +26 -6
  4. data/Rakefile +37 -0
  5. data/lib/web_console/extensions.rb +2 -1
  6. data/lib/web_console/integration/cruby.rb +2 -1
  7. data/lib/web_console/integration/rubinius.rb +2 -1
  8. data/lib/web_console/railtie.rb +19 -1
  9. data/lib/web_console/session.rb +4 -3
  10. data/lib/web_console/templates/_inner_console_markup.html.erb +8 -3
  11. data/lib/web_console/templates/console.js.erb +169 -46
  12. data/lib/web_console/templates/error_page.js.erb +2 -15
  13. data/lib/web_console/templates/main.js.erb +1 -24
  14. data/lib/web_console/templates/style.css.erb +22 -9
  15. data/lib/web_console/tracer.rb +11 -0
  16. data/lib/web_console/version.rb +1 -1
  17. metadata +5 -155
  18. data/test/dummy/README.rdoc +0 -28
  19. data/test/dummy/Rakefile +0 -6
  20. data/test/dummy/app/assets/javascripts/application.js +0 -13
  21. data/test/dummy/app/assets/stylesheets/application.css +0 -13
  22. data/test/dummy/app/controllers/application_controller.rb +0 -5
  23. data/test/dummy/app/controllers/controller_helper_test_controller.rb +0 -7
  24. data/test/dummy/app/controllers/exception_test_controller.rb +0 -15
  25. data/test/dummy/app/controllers/helper_error_controller.rb +0 -4
  26. data/test/dummy/app/controllers/helper_test_controller.rb +0 -5
  27. data/test/dummy/app/controllers/tests_controller.rb +0 -16
  28. data/test/dummy/app/helpers/application_helper.rb +0 -2
  29. data/test/dummy/app/views/controller_helper_test/index.html.erb +0 -1
  30. data/test/dummy/app/views/exception_test/xhr.html.erb +0 -1
  31. data/test/dummy/app/views/helper_error/index.html.erb +0 -2
  32. data/test/dummy/app/views/helper_test/index.html.erb +0 -220
  33. data/test/dummy/app/views/layouts/application.html.erb +0 -16
  34. data/test/dummy/bin/bundle +0 -3
  35. data/test/dummy/bin/rails +0 -4
  36. data/test/dummy/bin/rake +0 -4
  37. data/test/dummy/config.ru +0 -4
  38. data/test/dummy/config/application.rb +0 -19
  39. data/test/dummy/config/boot.rb +0 -5
  40. data/test/dummy/config/database.yml +0 -25
  41. data/test/dummy/config/environment.rb +0 -5
  42. data/test/dummy/config/environments/development.rb +0 -29
  43. data/test/dummy/config/environments/production.rb +0 -80
  44. data/test/dummy/config/environments/test.rb +0 -34
  45. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  46. data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  47. data/test/dummy/config/initializers/inflections.rb +0 -16
  48. data/test/dummy/config/initializers/mime_types.rb +0 -5
  49. data/test/dummy/config/initializers/secret_token.rb +0 -12
  50. data/test/dummy/config/initializers/session_store.rb +0 -3
  51. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  52. data/test/dummy/config/locales/en.yml +0 -23
  53. data/test/dummy/config/routes.rb +0 -15
  54. data/test/dummy/db/schema.rb +0 -16
  55. data/test/dummy/db/test.sqlite3 +0 -0
  56. data/test/dummy/log/test.log +0 -808
  57. data/test/dummy/public/404.html +0 -58
  58. data/test/dummy/public/422.html +0 -58
  59. data/test/dummy/public/500.html +0 -57
  60. data/test/dummy/public/favicon.ico +0 -0
  61. data/test/dummy/tmp/cache/assets/test/sprockets/0c9b99b1b975b36a5b686845ae729db3 +0 -0
  62. data/test/dummy/tmp/cache/assets/test/sprockets/12e9f58adcf819cf65fd68b6859a438f +0 -0
  63. data/test/dummy/tmp/cache/assets/test/sprockets/1fd6abead3df36a4e4a2cb042a551b39 +0 -0
  64. data/test/dummy/tmp/cache/assets/test/sprockets/33b5eb81b5aaaa1e6dd5dcb6517792b4 +0 -0
  65. data/test/dummy/tmp/cache/assets/test/sprockets/3e460b2e021085f88b5597b38d194932 +0 -0
  66. data/test/dummy/tmp/cache/assets/test/sprockets/52f04b2ea6e461f4661b6d0be393fa94 +0 -0
  67. data/test/dummy/tmp/cache/assets/test/sprockets/688c344c2919f882338f06c5daaea209 +0 -0
  68. data/test/dummy/tmp/cache/assets/test/sprockets/7f079298e19bbef40a5d6a37dc03033a +0 -0
  69. data/test/dummy/tmp/cache/assets/test/sprockets/91aa709f89e465f58056fabe5f75eef4 +0 -0
  70. data/test/dummy/tmp/cache/assets/test/sprockets/95f4e4e5217aec9f71b2c1a65a9a9231 +0 -0
  71. data/test/dummy/tmp/cache/assets/test/sprockets/9c41be9b6625756fbb6d05b7665dd911 +0 -0
  72. data/test/dummy/tmp/cache/assets/test/sprockets/a95f64d41fcf8244b8f5b84a55f07822 +0 -0
  73. data/test/dummy/tmp/cache/assets/test/sprockets/c5e6bf1efd5929bee63e28ad7c9f6f83 +0 -0
  74. data/test/dummy/tmp/cache/assets/test/sprockets/d863259e9eeca657a1624135cfe24446 +0 -0
  75. data/test/dummy/tmp/cache/assets/test/sprockets/e1d2fc4601b6423ec8a42415ee05dd14 +0 -0
  76. data/test/dummy/tmp/cache/assets/test/sprockets/e82616536a759c2e87d703adc77d65da +0 -0
  77. data/test/support/scenarios/bad_custom_error_scenario.rb +0 -17
  78. data/test/support/scenarios/basic_nested_scenario.rb +0 -15
  79. data/test/support/scenarios/custom_error_scenario.rb +0 -11
  80. data/test/support/scenarios/eval_nested_scenario.rb +0 -15
  81. data/test/support/scenarios/flat_scenario.rb +0 -9
  82. data/test/support/scenarios/reraised_scenario.rb +0 -21
  83. data/test/test_helper.rb +0 -78
  84. data/test/web_console/evaluator_test.rb +0 -73
  85. data/test/web_console/extensions_test.rb +0 -28
  86. data/test/web_console/helper_test.rb +0 -76
  87. data/test/web_console/integration_test.rb +0 -47
  88. data/test/web_console/middleware_test.rb +0 -116
  89. data/test/web_console/railtie_test.rb +0 -99
  90. data/test/web_console/request_test.rb +0 -82
  91. data/test/web_console/session_test.rb +0 -59
  92. data/test/web_console/whiny_request_test.rb +0 -33
  93. data/test/web_console/whitelist_test.rb +0 -43
@@ -1,59 +0,0 @@
1
- require 'test_helper'
2
-
3
- module WebConsole
4
- class SessionTest < ActiveSupport::TestCase
5
- class LineAwareError < StandardError
6
- def self.raise
7
- ::Kernel.raise new(__LINE__)
8
- rescue => exc
9
- exc
10
- end
11
-
12
- attr_reader :line
13
-
14
- def initialize(line)
15
- @line = line
16
- end
17
- end
18
-
19
- setup do
20
- Session::INMEMORY_STORAGE.clear
21
- @session = Session.new TOPLEVEL_BINDING
22
- end
23
-
24
- test 'returns nil when a session is not found' do
25
- assert_nil Session.find("nonexistent session")
26
- end
27
-
28
- test 'find returns a persisted object' do
29
- assert_equal @session, Session.find(@session.id)
30
- end
31
-
32
- test 'can evaluate code in the currently selected binding' do
33
- assert_equal "=> 42\n", @session.eval('40 + 2')
34
- end
35
-
36
- test 'can create session from a single binding' do
37
- saved_line, saved_binding = __LINE__, binding
38
- session = Session.from_binding(saved_binding)
39
-
40
- assert_equal "=> #{saved_line}\n", session.eval('__LINE__')
41
- end
42
-
43
- test 'can create session from an exception' do
44
- exc = LineAwareError.raise
45
- session = Session.from_exception(exc)
46
-
47
- assert_equal "=> #{exc.line}\n", session.eval('__LINE__')
48
- end
49
-
50
- test 'can switch to bindings' do
51
- exc, saved_line = LineAwareError.raise, __LINE__
52
-
53
- session = Session.from_exception(exc)
54
- session.switch_binding_to(1)
55
-
56
- assert_equal "=> #{saved_line}\n", session.eval('__LINE__')
57
- end
58
- end
59
- end
@@ -1,33 +0,0 @@
1
- require 'test_helper'
2
-
3
- module WebConsole
4
- class WhinyRequestTest < ActiveSupport::TestCase
5
- test '#from_whitelited_ip? logs out to stderr' do
6
- Request.stubs(:whitelisted_ips).returns(IPAddr.new('127.0.0.1'))
7
- assert_output_to_stderr do
8
- req = request('http://example.com', 'REMOTE_ADDR' => '0.0.0.0')
9
- assert_not req.from_whitelited_ip?
10
- end
11
- end
12
-
13
- test '#acceptable_content_type? logs out to stderr' do
14
- Request.stubs(:acceptable_content_types).returns([])
15
- assert_output_to_stderr do
16
- req = request('http://example.com', 'CONTENT_TYPE' => 'application/json')
17
- assert_not req.acceptable_content_type?
18
- end
19
- end
20
-
21
- private
22
-
23
- def assert_output_to_stderr
24
- output = capture(:stderr) { yield }
25
- assert_not output.blank?
26
- end
27
-
28
- def request(*args)
29
- request = Request.new(Rack::MockRequest.env_for(*args))
30
- WhinyRequest.new(request)
31
- end
32
- end
33
- end
@@ -1,43 +0,0 @@
1
- module WebConsole
2
- class WhitelistTest < ActiveSupport::TestCase
3
- test 'localhost is always whitelisted' do
4
- whitelisted_ips = whitelist('8.8.8.8')
5
-
6
- assert_includes whitelisted_ips, '127.0.0.1'
7
- assert_includes whitelisted_ips, '::1'
8
- end
9
-
10
- test 'can whitelist single IPs' do
11
- whitelisted_ips = whitelist('8.8.8.8')
12
-
13
- assert_includes whitelisted_ips, '8.8.8.8'
14
- end
15
-
16
- test 'can whitelist whole networks' do
17
- whitelisted_ips = whitelist('172.16.0.0/12')
18
-
19
- 1.upto(255).each do |n|
20
- assert_includes whitelisted_ips, "172.16.0.#{n}"
21
- end
22
- end
23
-
24
- test 'can whitelist multiple networks' do
25
- whitelisted_ips = whitelist %w(172.16.0.0/12 192.168.0.0/16)
26
-
27
- 1.upto(255).each do |n|
28
- assert_includes whitelisted_ips, "172.16.0.#{n}"
29
- assert_includes whitelisted_ips, "192.168.0.#{n}"
30
- end
31
- end
32
-
33
- test 'can be represented in a human readable form' do
34
- assert_includes whitelist.to_s, '127.0.0.0/127.255.255.255, ::1'
35
- end
36
-
37
- private
38
-
39
- def whitelist(*args)
40
- Whitelist.new(*args)
41
- end
42
- end
43
- end