hanami-webconsole 0.1.0 → 2.1.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +26 -0
- data/LICENSE.md +1 -1
- data/README.md +10 -3
- data/hanami-webconsole.gemspec +5 -12
- data/lib/hanami/webconsole/middleware.rb +77 -0
- data/lib/hanami/webconsole/version.rb +1 -1
- data/lib/hanami/webconsole.rb +5 -2
- metadata +20 -57
- data/lib/hanami/webconsole/plugin.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfd72232a858cb02085d8bc8e1e51db6ad511fc9a98b33f2af6216f1a0872369
|
4
|
+
data.tar.gz: 13b031ac4e6380391ce93c03e106c3f6f067547bdff7c6e6aa1a2e0579ac7c4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85e9b3eea0220d6e8bb2b64bf9ecbb963a85d4a0ff678fe114e4aa622ddaca4395768b54b037c1f791f080aec02e1c6c06f6220e1b156a96c8e246e7100a5e84
|
7
|
+
data.tar.gz: cf80acd3bdf343e9acdedafd95292c76a439fb3b44bee86195932601f4ebebd4c54460859ccdf08673742bf869adf02d5042323a73c1ec822db32981ca80768a
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,30 @@
|
|
1
1
|
# Hanami::Webconsole
|
2
2
|
Hanami development web console.
|
3
3
|
|
4
|
+
## v2.1.0.beta2 - 2023-10-04
|
5
|
+
|
6
|
+
### Fixed
|
7
|
+
|
8
|
+
- [Tim Riley] Set correct error codes for Hanami app exceptions
|
9
|
+
|
10
|
+
## v2.1.0.beta1 - 2023-06-29
|
11
|
+
|
12
|
+
### Added
|
13
|
+
|
14
|
+
- [Tim Riley] Introduce `Hanami::Webconsole::Middleware`, a Rack middleware automatically used in
|
15
|
+
the Hanami app when hanami-webconsole is bundled (#6)
|
16
|
+
|
17
|
+
### Changed
|
18
|
+
|
19
|
+
- [Tim Riley] Remove the Hanami v1 plugin (#6)
|
20
|
+
|
21
|
+
## v0.2.0 - 2019-01-18
|
22
|
+
|
23
|
+
### Added
|
24
|
+
|
25
|
+
- [Luca Guidi] Official support for Ruby 2.6.0
|
26
|
+
- [Luca Guidi] Support for `bundler` 2.0+
|
27
|
+
|
4
28
|
## v0.1.0 - 2018-04-11
|
5
29
|
|
6
30
|
## v0.1.0.rc2 - 2018-04-06
|
@@ -10,5 +34,7 @@ Hanami development web console.
|
|
10
34
|
## v0.1.0.beta2 - 2018-03-23
|
11
35
|
|
12
36
|
## v0.1.0.beta1 - 2018-02-28
|
37
|
+
|
13
38
|
### Added
|
39
|
+
|
14
40
|
- [Luca Guidi & Anton Davydov] Package as Hanami plugin
|
data/LICENSE.md
CHANGED
data/README.md
CHANGED
@@ -2,10 +2,17 @@
|
|
2
2
|
|
3
3
|
[Hanami](http://hanamirb.org) development web console.
|
4
4
|
|
5
|
+
## Version
|
6
|
+
|
7
|
+
**This branch contains the code for `hanami-webconsole` 2.x.**
|
8
|
+
|
5
9
|
## Status
|
6
10
|
|
7
|
-
[![Gem Version](
|
8
|
-
[![
|
11
|
+
[![Gem Version](https://badge.fury.io/rb/hanami-webconsole.svg)](https://badge.fury.io/rb/hanami-webconsole)
|
12
|
+
[![CI](https://github.com/hanami/webconsole/workflows/ci/badge.svg?branch=main)](https://github.com/hanami/webconsole/actions?query=workflow%3Aci+branch%3Amain)
|
13
|
+
[![Test Coverage](https://codecov.io/gh/hanami/webconsole/branch/main/graph/badge.svg)](https://codecov.io/gh/hanami/webconsole)
|
14
|
+
[![Depfu](https://badges.depfu.com/badges/a8545fb67cf32a2c75b6227bc0821027/overview.svg)](https://depfu.com/github/hanami/webconsole?project=Bundler)
|
15
|
+
[![Inline Docs](http://inch-ci.org/github/hanami/webconsole.svg)](http://inch-ci.org/github/hanami/webconsole)
|
9
16
|
|
10
17
|
## Installation
|
11
18
|
|
@@ -57,4 +64,4 @@ This gem is based on the great work of [`better_errors`](https://rubygems.org/ge
|
|
57
64
|
|
58
65
|
## Copyright
|
59
66
|
|
60
|
-
Copyright ©
|
67
|
+
Copyright © 2014 Hanami Team – Released under MIT License
|
data/hanami-webconsole.gemspec
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
# frozen_string_literal: true
|
3
2
|
|
4
3
|
lib = File.expand_path("../lib", __FILE__)
|
@@ -10,23 +9,17 @@ Gem::Specification.new do |spec|
|
|
10
9
|
spec.version = Hanami::Webconsole::VERSION
|
11
10
|
spec.authors = ["Luca Guidi"]
|
12
11
|
spec.email = ["me@lucaguidi.com"]
|
13
|
-
|
14
12
|
spec.summary = "Hanami webconsole"
|
15
13
|
spec.description = "Hanami webconsole for development"
|
16
14
|
spec.homepage = "http://hanamirb.org"
|
17
15
|
spec.license = "MIT"
|
18
16
|
|
19
|
-
spec.
|
20
|
-
|
21
|
-
spec.files = `git ls-files -- lib/* CHANGELOG.md LICENSE.md README.md hanami-webconsole.gemspec`.split($INPUT_RECORD_SEPARATOR)
|
22
|
-
spec.bindir = "exe"
|
23
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
17
|
+
spec.files = `git ls-files -- lib/* CHANGELOG.md LICENSE.md README.md hanami-webconsole.gemspec`.split($INPUT_RECORD_SEPARATOR)
|
24
18
|
spec.require_paths = ["lib"]
|
25
19
|
|
26
|
-
spec.
|
27
|
-
spec.add_dependency "binding_of_caller", "~> 0.8"
|
20
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
28
21
|
|
29
|
-
|
30
|
-
spec.
|
31
|
-
spec.
|
22
|
+
# Avoid 2.10.0 until https://github.com/BetterErrors/better_errors/issues/516 is fixed
|
23
|
+
spec.add_dependency "better_errors", "~> 2.9", "< 2.10.0"
|
24
|
+
spec.add_dependency "binding_of_caller", "~> 1.0"
|
32
25
|
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rack"
|
4
|
+
|
5
|
+
module Hanami
|
6
|
+
module Webconsole
|
7
|
+
# @api private
|
8
|
+
# @since 2.1.0
|
9
|
+
class Middleware
|
10
|
+
# @api private
|
11
|
+
# @since 2.1.0
|
12
|
+
CAPTURE_EXCEPTION_PROC_KEY = "hanami.webconsole.capture_exception_proc"
|
13
|
+
private_constant :CAPTURE_EXCEPTION_PROC_KEY
|
14
|
+
|
15
|
+
# @see Middleware#call
|
16
|
+
#
|
17
|
+
# @api private
|
18
|
+
# @since 2.1.0
|
19
|
+
module BetterErrorsExtension
|
20
|
+
# The BetterErrors middleware always returns a 500 status when rescuing an exception
|
21
|
+
# (outside of Rails). This is not not always appropriate, such as for a
|
22
|
+
# `Hanami::Router::NotFoundError`, which should be a 404.
|
23
|
+
#
|
24
|
+
# To account for this, gently patch `BetterErrors::Middleware#show_error_page` (which is
|
25
|
+
# called only when an exception has been rescued) to pass that rescued exception to a proc
|
26
|
+
# we inject into the rack env here in our own middleware. This allows our middleware to know
|
27
|
+
# the about exception class and provide the correct status code after BetterErrors is done
|
28
|
+
# with its job.
|
29
|
+
#
|
30
|
+
# @see Webconsole::Middleware#call
|
31
|
+
def show_error_page(env, exception = nil)
|
32
|
+
if (capture_proc = env[CAPTURE_EXCEPTION_PROC_KEY])
|
33
|
+
capture_proc.call(exception)
|
34
|
+
end
|
35
|
+
|
36
|
+
super
|
37
|
+
end
|
38
|
+
end
|
39
|
+
BetterErrors::Middleware.prepend(BetterErrorsExtension)
|
40
|
+
|
41
|
+
# @api private
|
42
|
+
# @since 2.1.0
|
43
|
+
def initialize(app, config)
|
44
|
+
@better_errors = BetterErrors::Middleware.new(app)
|
45
|
+
@config = config
|
46
|
+
|
47
|
+
configure_better_errors
|
48
|
+
end
|
49
|
+
|
50
|
+
# @api private
|
51
|
+
# @since 2.1.0
|
52
|
+
def call(env)
|
53
|
+
rescued_exception = nil
|
54
|
+
env[CAPTURE_EXCEPTION_PROC_KEY] = -> ex { rescued_exception = ex }
|
55
|
+
|
56
|
+
status, headers, body = @better_errors.call(env)
|
57
|
+
|
58
|
+
# Replace the BetterErrors status with a properly configured one for the Hanami app
|
59
|
+
if rescued_exception
|
60
|
+
status = Rack::Utils.status_code(
|
61
|
+
@config.render_error_responses[rescued_exception.class.name]
|
62
|
+
)
|
63
|
+
end
|
64
|
+
|
65
|
+
[status, headers, body]
|
66
|
+
end
|
67
|
+
|
68
|
+
private
|
69
|
+
|
70
|
+
# @api private
|
71
|
+
# @since 2.1.0
|
72
|
+
def configure_better_errors
|
73
|
+
BetterErrors.application_root = @config.root.to_s
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
data/lib/hanami/webconsole.rb
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "better_errors"
|
4
|
+
require "binding_of_caller"
|
5
|
+
|
3
6
|
module Hanami
|
4
7
|
# Hanami web console for development
|
5
8
|
#
|
6
9
|
# @since 0.1.0
|
7
10
|
module Webconsole
|
8
|
-
|
9
|
-
|
11
|
+
require_relative "webconsole/version"
|
12
|
+
require_relative "webconsole/middleware"
|
10
13
|
end
|
11
14
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hanami-webconsole
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.1.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luca Guidi
|
8
|
-
autorequire:
|
9
|
-
bindir:
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: better_errors
|
@@ -16,70 +16,34 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
20
|
-
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
19
|
+
version: '2.9'
|
20
|
+
- - "<"
|
25
21
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: binding_of_caller
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0.8'
|
22
|
+
version: 2.10.0
|
34
23
|
type: :runtime
|
35
24
|
prerelease: false
|
36
25
|
version_requirements: !ruby/object:Gem::Requirement
|
37
26
|
requirements:
|
38
27
|
- - "~>"
|
39
28
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
41
|
-
-
|
42
|
-
name: bundler
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '1.16'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '1.16'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rake
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
29
|
+
version: '2.9'
|
30
|
+
- - "<"
|
60
31
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '12.0'
|
32
|
+
version: 2.10.0
|
69
33
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
34
|
+
name: binding_of_caller
|
71
35
|
requirement: !ruby/object:Gem::Requirement
|
72
36
|
requirements:
|
73
37
|
- - "~>"
|
74
38
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
76
|
-
type: :
|
39
|
+
version: '1.0'
|
40
|
+
type: :runtime
|
77
41
|
prerelease: false
|
78
42
|
version_requirements: !ruby/object:Gem::Requirement
|
79
43
|
requirements:
|
80
44
|
- - "~>"
|
81
45
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
46
|
+
version: '1.0'
|
83
47
|
description: Hanami webconsole for development
|
84
48
|
email:
|
85
49
|
- me@lucaguidi.com
|
@@ -92,14 +56,14 @@ files:
|
|
92
56
|
- README.md
|
93
57
|
- hanami-webconsole.gemspec
|
94
58
|
- lib/hanami/webconsole.rb
|
95
|
-
- lib/hanami/webconsole/
|
59
|
+
- lib/hanami/webconsole/middleware.rb
|
96
60
|
- lib/hanami/webconsole/version.rb
|
97
61
|
homepage: http://hanamirb.org
|
98
62
|
licenses:
|
99
63
|
- MIT
|
100
64
|
metadata:
|
101
65
|
allowed_push_host: https://rubygems.org
|
102
|
-
post_install_message:
|
66
|
+
post_install_message:
|
103
67
|
rdoc_options: []
|
104
68
|
require_paths:
|
105
69
|
- lib
|
@@ -110,13 +74,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
110
74
|
version: '0'
|
111
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
76
|
requirements:
|
113
|
-
- - "
|
77
|
+
- - ">"
|
114
78
|
- !ruby/object:Gem::Version
|
115
|
-
version:
|
79
|
+
version: 1.3.1
|
116
80
|
requirements: []
|
117
|
-
|
118
|
-
|
119
|
-
signing_key:
|
81
|
+
rubygems_version: 3.4.13
|
82
|
+
signing_key:
|
120
83
|
specification_version: 4
|
121
84
|
summary: Hanami webconsole
|
122
85
|
test_files: []
|