rack_web_console 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 314e65918f28b885675d30dcb5bcf1ae6463bef3
4
- data.tar.gz: 5f0280aeba099f083cdf14e1fb1e1d4a1d3c9dcd
2
+ SHA256:
3
+ metadata.gz: 149b958c664ecf146ab6a5ef125b18a0284fc39da5f5d97f2cad19f56cbba14a
4
+ data.tar.gz: 0b8d95d928f868ee2ab240a31da3278e85890b0acc2144685334f37b5de8cd52
5
5
  SHA512:
6
- metadata.gz: ad8b22b9a10a50e2915640531d076423d9e9a11a9323230723fd9d033b0de0340aba07da2c73a31a772ae0780403b8f05bc7c4d1da682733d14f13dc2b43020f
7
- data.tar.gz: 7c172dd60203277bd8115ea402af16d44e45685fab81f1f01530933a6c7ea02bb3268ab1ff2e83e01ef053a8aed5a557ef74e44a61984ca179bb298476fd63ba
6
+ metadata.gz: 58e7a0c1cd2044bbb9ee24ebee8ba2582df912d07e66183300d56dd2311e8b1a2924928810c326dfabd39fdeb362f15fbab729c71617315b2b5a50c141f08556
7
+ data.tar.gz: 25042555f4c32705431ff7457e37afd109ee3a8d0591798ae2164e420608e2a5e5556745a6815ba234678c70e16ee4e4b03b4fdcfc70a14d65e865b7692e0d0d
data/.gitignore CHANGED
@@ -6,4 +6,6 @@
6
6
  /doc/
7
7
  /pkg/
8
8
  /spec/reports/
9
+ /spec/log/
10
+ /spec/tmp/
9
11
  /tmp/
data/README.md CHANGED
@@ -57,12 +57,12 @@ you may have to do this:
57
57
  # app/controllers/console_controller.rb:
58
58
  require 'rack_web_console'
59
59
  class ConsoleController < ApplicationController
60
- skip_before_action :verify_authenticity_token
60
+ skip_forgery_protection
61
61
 
62
62
  def index
63
- status, headers, body = RackConsole.new(binding).call(env)
64
- response.headers.merge headers
65
- render inline: body.join("\n"), status: status
63
+ status, headers, body = RackConsole.new(binding).call(request.env)
64
+ response.headers.merge! headers
65
+ render html: body.join("\n").html_safe, status: status
66
66
  end
67
67
  end
68
68
 
@@ -73,9 +73,9 @@ Rails.application.routes.draw do
73
73
  end
74
74
  ```
75
75
 
76
- The `rails-web-console` gem is probably a better gem to use with Rails but this example should
77
- demonstrate how it could be used with basically any framework. If you're not really interested
78
- on some specific binding, you can simply mount it directly in config.ru:
76
+ This example demonstrates how to use it with a Rails project, but it could be used with basically
77
+ any framework. If you're not really interested on some specific binding, you can simply mount it
78
+ directly in config.ru:
79
79
 
80
80
  ```ruby
81
81
  # config.ru
@@ -6,6 +6,7 @@
6
6
  #script { width: 100% }
7
7
  .console_result, .return { white-space: pre-wrap; }
8
8
  .return { background-color: blue }
9
+ .error { background-color: red; color: white; font-weight: bold }
9
10
  .console_result {
10
11
  background-color: black;
11
12
  color: white;
@@ -1,3 +1,3 @@
1
1
  class RackConsole
2
- VERSION = '0.1.3'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -20,9 +20,10 @@ class RackConsole
20
20
 
21
21
  private
22
22
 
23
-
24
23
  def process_script(env)
25
- params = CGI.parse env['rack.input'].read
24
+ rack_input = env['rack.input']
25
+ rack_input.rewind
26
+ params = CGI.parse rack_input.read
26
27
  token = params['token']&.first.to_s
27
28
  return [403, {}, []] unless same_origin?(env) && token == @@token
28
29
  script = params['script'].first
@@ -34,7 +35,9 @@ class RackConsole
34
35
  result << %Q{<div class="stdout">#{::ERB::Util.h oc.output}</div>}
35
36
  result << %Q{<div class="return">#{::ERB::Util.h result_eval.inspect}</div>}
36
37
  rescue ::Exception => e
37
- result << e.message << "\n" << e.backtrace.join("\n")
38
+ message = ::ERB::Util.h "#{e.message}\n#{e.backtrace.join "\n"}"
39
+ result << %Q{<div class="stdout">#{::ERB::Util.h oc.output}</div>}
40
+ result << %Q{<div class="error">#{message}</div>}
38
41
  end
39
42
  end
40
43
  headers = { 'Content-Type' => 'text/html; charset=utf-8' }
@@ -16,8 +16,10 @@ Gem::Specification.new do |spec|
16
16
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^spec/}) }
17
17
  spec.require_paths = ['lib']
18
18
 
19
- spec.add_development_dependency 'bundler', '~> 1.12'
20
- spec.add_development_dependency 'rake', '~> 10.0'
21
- spec.add_development_dependency 'rspec', '~> 3.0'
22
- spec.add_development_dependency 'rack'
19
+ spec.add_development_dependency 'bundler', '~> 2.5'
20
+ spec.add_development_dependency 'rake', '~> 13.2'
21
+ spec.add_development_dependency 'rspec', '~> 3.13.0'
22
+ spec.add_development_dependency 'rack', '~> 3.1'
23
+ spec.add_development_dependency 'puma', '~> 6.4.3'
24
+ spec.add_development_dependency 'rails', '~> 7.2.1'
23
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack_web_console
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Rosenfeld Rosas
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-28 00:00:00.000000000 Z
11
+ date: 2024-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,57 +16,85 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.12'
19
+ version: '2.5'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.12'
26
+ version: '2.5'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '13.2'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '13.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '3.0'
47
+ version: 3.13.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '3.0'
54
+ version: 3.13.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rack
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.1'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.1'
69
+ - !ruby/object:Gem::Dependency
70
+ name: puma
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: '0'
75
+ version: 6.4.3
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - ">="
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 6.4.3
83
+ - !ruby/object:Gem::Dependency
84
+ name: rails
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 7.2.1
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
67
95
  - !ruby/object:Gem::Version
68
- version: '0'
69
- description:
96
+ version: 7.2.1
97
+ description:
70
98
  email:
71
99
  - rr.rosas@gmail.com
72
100
  executables: []
@@ -93,7 +121,7 @@ homepage: https://github.com/rosenfeld/rack_web_console
93
121
  licenses:
94
122
  - MIT
95
123
  metadata: {}
96
- post_install_message:
124
+ post_install_message:
97
125
  rdoc_options: []
98
126
  require_paths:
99
127
  - lib
@@ -108,9 +136,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
136
  - !ruby/object:Gem::Version
109
137
  version: '0'
110
138
  requirements: []
111
- rubyforge_project:
112
- rubygems_version: 2.5.1
113
- signing_key:
139
+ rubygems_version: 3.5.16
140
+ signing_key:
114
141
  specification_version: 4
115
142
  summary: A web console for Rack apps.
116
143
  test_files: []