hanami-utils 2.0.0.rc1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/hanami-utils.gemspec +1 -1
- data/lib/hanami/middleware.rb +10 -3
- data/lib/hanami/utils/class.rb +0 -27
- data/lib/hanami/utils/hash.rb +1 -1
- data/lib/hanami/utils/json.rb +10 -0
- data/lib/hanami/utils/kernel.rb +1 -0
- data/lib/hanami/utils/shell_color.rb +5 -1
- data/lib/hanami/utils/version.rb +4 -1
- metadata +13 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2575ff2a640a9ffcddf8a9930a887d536ec9da4b64bc4a2883849ed261f57b43
|
4
|
+
data.tar.gz: 70fbfe55f826d940c0f5decad39840990925e061de975e53d2b672fdae9873df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73d5a9fade1cb961ac4be22b8967507fceebde1a9d8edb33d71634b06ef6c06538c8d0ef2b1a32a33e8442c7609b675ae99bd63780c353c6db02485ddbfd3432
|
7
|
+
data.tar.gz: 368ffe941852e67432d9574b79220b1807b1529cbdf4289fb2fd2db92299888617bc3779bd6e0c3f03b81d5fbcb9725b8b36364733d262a3c5fa2cb257db91b1
|
data/CHANGELOG.md
CHANGED
data/hanami-utils.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.metadata["rubygems_mfa_required"] = "true"
|
21
21
|
spec.required_ruby_version = ">= 3.0"
|
22
22
|
|
23
|
-
spec.add_dependency "dry-transformer", "~> 0
|
23
|
+
spec.add_dependency "dry-transformer", "~> 1.0", "< 2"
|
24
24
|
spec.add_dependency "concurrent-ruby", "~> 1.0"
|
25
25
|
|
26
26
|
spec.add_development_dependency "bundler", ">= 1.6", "< 3"
|
data/lib/hanami/middleware.rb
CHANGED
@@ -1,11 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Hanami
|
4
|
+
# Shared Rack middleware for Hanami apps.
|
5
|
+
#
|
6
|
+
# This module is defined in hanami-utils so that any gem providing middleware can use its
|
7
|
+
# resources.
|
8
|
+
#
|
9
|
+
# @since 2.0.0
|
4
10
|
module Middleware
|
5
|
-
#
|
6
|
-
|
11
|
+
# Base class for all errors raised during middleware loading.
|
12
|
+
#
|
7
13
|
# @since 2.0.0
|
8
|
-
|
14
|
+
# @api public
|
15
|
+
class Error < StandardError
|
9
16
|
end
|
10
17
|
end
|
11
18
|
end
|
data/lib/hanami/utils/class.rb
CHANGED
@@ -71,33 +71,6 @@ module Hanami
|
|
71
71
|
def self.load(name, namespace = Object)
|
72
72
|
load!(name, namespace) if namespace.const_defined?(name.to_s, false)
|
73
73
|
end
|
74
|
-
|
75
|
-
def self.tokenize(pattern)
|
76
|
-
if match = TOKENIZE_REGEXP.match(pattern)
|
77
|
-
pre = match.pre_match
|
78
|
-
post = match.post_match
|
79
|
-
tokens = match[1].split(TOKENIZE_SEPARATOR)
|
80
|
-
tokens.each do |token|
|
81
|
-
yield("#{pre}#{token}#{post}")
|
82
|
-
end
|
83
|
-
else
|
84
|
-
yield(pattern)
|
85
|
-
end
|
86
|
-
|
87
|
-
nil
|
88
|
-
end
|
89
|
-
|
90
|
-
# Regexp for .tokenize
|
91
|
-
#
|
92
|
-
# @since 1.3.0
|
93
|
-
# @api private
|
94
|
-
TOKENIZE_REGEXP = /\((.*)\)/
|
95
|
-
|
96
|
-
# Separator for .tokenize
|
97
|
-
#
|
98
|
-
# @since 1.3.0
|
99
|
-
# @api private
|
100
|
-
TOKENIZE_SEPARATOR = "|"
|
101
74
|
end
|
102
75
|
end
|
103
76
|
end
|
data/lib/hanami/utils/hash.rb
CHANGED
data/lib/hanami/utils/json.rb
CHANGED
@@ -35,10 +35,20 @@ module Hanami
|
|
35
35
|
|
36
36
|
# rubocop:disable Style/ClassVars
|
37
37
|
if defined?(MultiJson)
|
38
|
+
# @since 0.8.0
|
39
|
+
# @api private
|
38
40
|
@@engine = MultiJsonAdapter.new
|
41
|
+
|
42
|
+
# @since 0.8.0
|
43
|
+
# @api private
|
39
44
|
ParserError = MultiJson::ParseError
|
40
45
|
else
|
46
|
+
# @since 0.8.0
|
47
|
+
# @api private
|
41
48
|
@@engine = ::JSON
|
49
|
+
|
50
|
+
# @since 0.8.0
|
51
|
+
# @api private
|
42
52
|
ParserError = ::JSON::ParserError
|
43
53
|
end
|
44
54
|
# rubocop:enable Style/ClassVars
|
data/lib/hanami/utils/kernel.rb
CHANGED
@@ -7,12 +7,16 @@ module Hanami
|
|
7
7
|
# It doesn't check if you're writing to a file or anything, so you have to
|
8
8
|
# check that yourself before using this module.
|
9
9
|
#
|
10
|
+
# @api public
|
10
11
|
# @since 1.2.0
|
11
12
|
module ShellColor
|
12
|
-
#
|
13
|
+
# Error raised for unknown color codes.
|
13
14
|
#
|
14
15
|
# @since 1.2.0
|
16
|
+
# @api public
|
15
17
|
class UnknownColorCodeError < ::StandardError
|
18
|
+
# @since 1.2.0
|
19
|
+
# @api private
|
16
20
|
def initialize(code)
|
17
21
|
super("unknown color code: `#{code.inspect}'")
|
18
22
|
end
|
data/lib/hanami/utils/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hanami-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luca Guidi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-11-
|
11
|
+
date: 2022-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-transformer
|
@@ -16,14 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0
|
19
|
+
version: '1.0'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '2'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
27
|
- - "~>"
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0
|
29
|
+
version: '1.0'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: concurrent-ruby
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -149,11 +155,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
149
155
|
version: '3.0'
|
150
156
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
157
|
requirements:
|
152
|
-
- - "
|
158
|
+
- - ">="
|
153
159
|
- !ruby/object:Gem::Version
|
154
|
-
version:
|
160
|
+
version: '0'
|
155
161
|
requirements: []
|
156
|
-
rubygems_version: 3.3.
|
162
|
+
rubygems_version: 3.3.7
|
157
163
|
signing_key:
|
158
164
|
specification_version: 4
|
159
165
|
summary: Ruby core extentions and Hanami utilities
|