web_pipe 0.12.1 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +5 -1
- data/.rubocop.yml +15 -0
- data/.travis.yml +3 -2
- data/CHANGELOG.md +7 -0
- data/Gemfile +5 -0
- data/docs/extensions/params.md +4 -3
- data/lib/web_pipe/conn_support/builder.rb +2 -1
- data/lib/web_pipe/conn_support/composition.rb +2 -2
- data/lib/web_pipe/conn_support/errors.rb +6 -6
- data/lib/web_pipe/conn_support/headers.rb +2 -4
- data/lib/web_pipe/dsl/builder.rb +1 -0
- data/lib/web_pipe/dsl/class_context.rb +1 -0
- data/lib/web_pipe/dsl/dsl_context.rb +1 -1
- data/lib/web_pipe/dsl/instance_methods.rb +2 -0
- data/lib/web_pipe/extensions/container/container.rb +1 -0
- data/lib/web_pipe/extensions/cookies/cookies.rb +1 -0
- data/lib/web_pipe/extensions/dry_schema/dry_schema.rb +1 -0
- data/lib/web_pipe/extensions/dry_view/dry_view.rb +1 -0
- data/lib/web_pipe/extensions/flash/flash.rb +1 -0
- data/lib/web_pipe/extensions/params/params.rb +1 -0
- data/lib/web_pipe/extensions/params/params/transf.rb +1 -0
- data/lib/web_pipe/extensions/rails/rails.rb +2 -1
- data/lib/web_pipe/extensions/redirect/redirect.rb +1 -0
- data/lib/web_pipe/extensions/session/session.rb +1 -0
- data/lib/web_pipe/extensions/url/url.rb +1 -0
- data/lib/web_pipe/plug.rb +3 -3
- data/lib/web_pipe/rack_support/middleware_specification.rb +4 -3
- data/lib/web_pipe/version.rb +1 -1
- data/web_pipe.gemspec +4 -1
- metadata +32 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a993e68cff01cb6b0ef493b6bdf3207e62a7baca650302c9f65024f3981c18a
|
4
|
+
data.tar.gz: dc94f7dfabc97ad712a058f725e85831c38fe2658f42adeca3243b29f10273f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e5925278ef21f20b3c9b8ae25f7bd614c7e17b278693f3521f018cefe1acd1ef63116aba61a9722bc1f4d5b98bfbeb56a6e03d0d246ac359aa595e4c451f6eb
|
7
|
+
data.tar.gz: baf191023d9a19ed7facfc77f3107db45e2adb1949a25e4fc306b0a9f85e061e474fc557848beb469aaf0c5ad0446918b9c285b63cc5501bf21d31c19229878c
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
6
6
|
|
7
|
+
## [0.13.0] - 2021-01-15
|
8
|
+
### Added
|
9
|
+
- **BREAKING**. Ruby 2.5 deprecated.
|
10
|
+
[#40](https://github.com/waiting-for-dev/web_pipe/pull/40)
|
11
|
+
- Ruby 3.0 supported.
|
12
|
+
[#41](https://github.com/waiting-for-dev/web_pipe/pull/41)
|
13
|
+
|
7
14
|
## [0.12.1] - 2019-03-18
|
8
15
|
### Fixed
|
9
16
|
- Update rake to fix security alert
|
data/Gemfile
CHANGED
@@ -6,3 +6,8 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
|
6
6
|
|
7
7
|
# Specify your gem's dependencies in web_pipe.gemspec
|
8
8
|
gemspec
|
9
|
+
|
10
|
+
# TODO: Remove when dry-rb 0.8 is released (ruby 3.0 support)
|
11
|
+
group :development do
|
12
|
+
gem 'dry-view', github: 'dry-rb/dry-view', ref: 'a048e32'
|
13
|
+
end
|
data/docs/extensions/params.md
CHANGED
@@ -12,9 +12,10 @@ conn.params # => { 'foo' => 'bar' }
|
|
12
12
|
```
|
13
13
|
|
14
14
|
You can configure a stack of transformations to be applied to the
|
15
|
-
parameter hash. For that, we lean on [`
|
16
|
-
gem](https://github.com/
|
17
|
-
Gemfile). All hash transformations in `
|
15
|
+
parameter hash. For that, we lean on [`dry-transformer`
|
16
|
+
gem](https://github.com/dry-rb/dry-transformer) (you have to add it yourself to
|
17
|
+
your Gemfile). All hash transformations in `dry-transformer` are available by
|
18
|
+
default.
|
18
19
|
|
19
20
|
Transformations must be configured under `:param_transformations`
|
20
21
|
key:
|
@@ -15,12 +15,12 @@ module WebPipe
|
|
15
15
|
# @param env [Types::Env] Rack's env
|
16
16
|
#
|
17
17
|
# @return [Conn::Ongoing]
|
18
|
+
# rubocop:disable Metrics/MethodLength
|
18
19
|
def self.call(env)
|
19
20
|
rr = Rack::Request.new(env)
|
20
21
|
Conn::Ongoing.new(
|
21
22
|
request: rr,
|
22
23
|
env: env,
|
23
|
-
|
24
24
|
scheme: rr.scheme.to_sym,
|
25
25
|
request_method: rr.request_method.downcase.to_sym,
|
26
26
|
host: rr.host,
|
@@ -33,6 +33,7 @@ module WebPipe
|
|
33
33
|
request_headers: Headers.extract(env)
|
34
34
|
)
|
35
35
|
end
|
36
|
+
# rubocop:enable Metrics/MethodLength
|
36
37
|
end
|
37
38
|
end
|
38
39
|
end
|
@@ -28,11 +28,11 @@ module WebPipe
|
|
28
28
|
# @param returned [Any] What was returned from the {Operation}
|
29
29
|
def initialize(returned)
|
30
30
|
super(
|
31
|
-
<<~
|
31
|
+
<<~MSG
|
32
32
|
An operation returned +#{returned.inspect}+. To be valid,
|
33
33
|
an operation must return whether a
|
34
34
|
WebPipe::Conn::Ongoing or a WebPipe::Conn::Halted.
|
35
|
-
|
35
|
+
MSG
|
36
36
|
)
|
37
37
|
end
|
38
38
|
end
|
@@ -8,9 +8,9 @@ module WebPipe
|
|
8
8
|
# @param key [Any] Key not found in the bag
|
9
9
|
def initialize(key)
|
10
10
|
super(
|
11
|
-
<<~
|
11
|
+
<<~MSG
|
12
12
|
Bag does not contain a key with name +#{key}+.
|
13
|
-
|
13
|
+
MSG
|
14
14
|
)
|
15
15
|
end
|
16
16
|
end
|
@@ -21,9 +21,9 @@ module WebPipe
|
|
21
21
|
# @param key [Any] Key not found in config
|
22
22
|
def initialize(key)
|
23
23
|
super(
|
24
|
-
<<~
|
24
|
+
<<~MSG
|
25
25
|
Config does not contain a key with name +#{key}+.
|
26
|
-
|
26
|
+
MSG
|
27
27
|
)
|
28
28
|
end
|
29
29
|
end
|
@@ -36,10 +36,10 @@ module WebPipe
|
|
36
36
|
# @param gem [String] Gem name for the middleware
|
37
37
|
def initialize(feature, middleware, gem)
|
38
38
|
super(
|
39
|
-
<<~
|
39
|
+
<<~MSG
|
40
40
|
In order to use #{feature} you must use #{middleware} middleware:
|
41
41
|
https://rubygems.org/gems/#{gem}
|
42
|
-
|
42
|
+
MSG
|
43
43
|
)
|
44
44
|
end
|
45
45
|
end
|
@@ -25,7 +25,7 @@ module WebPipe
|
|
25
25
|
Hash[
|
26
26
|
env
|
27
27
|
.select { |k, _v| k.start_with?('HTTP_') }
|
28
|
-
.map { |k, v| pair(k[5
|
28
|
+
.map { |k, v| pair(k[5..], v) }
|
29
29
|
.concat(
|
30
30
|
env
|
31
31
|
.select { |k, _v| HEADERS_AS_CGI.include?(k) }
|
@@ -99,9 +99,7 @@ module WebPipe
|
|
99
99
|
#
|
100
100
|
# @see #normalize_key
|
101
101
|
def self.normalize(headers)
|
102
|
-
|
103
|
-
headers.map { |k, v| [normalize_key(k), v] }
|
104
|
-
]
|
102
|
+
headers.transform_keys { |k| normalize_key(k) }
|
105
103
|
end
|
106
104
|
end
|
107
105
|
end
|
data/lib/web_pipe/dsl/builder.rb
CHANGED
@@ -48,6 +48,7 @@ module WebPipe
|
|
48
48
|
# @return [Array<RackSupport::Middlewares>]
|
49
49
|
attr_reader :middlewares
|
50
50
|
|
51
|
+
# rubocop:disable Metrics/AbcSize
|
51
52
|
def initialize(injects = EMPTY_INJECTIONS)
|
52
53
|
@injections = Injections[injects]
|
53
54
|
container = self.class.container
|
@@ -60,6 +61,7 @@ module WebPipe
|
|
60
61
|
app = App.new(operations)
|
61
62
|
@rack_app = RackSupport::AppWithMiddlewares.new(middlewares, app)
|
62
63
|
end
|
64
|
+
# rubocop:enable Metrics/AbcSize
|
63
65
|
|
64
66
|
# Expected interface for rack.
|
65
67
|
#
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'web_pipe/conn'
|
4
4
|
|
5
|
+
#:nodoc:
|
5
6
|
module WebPipe
|
6
7
|
# Integrates with Rails framework.
|
7
8
|
#
|
@@ -73,7 +74,7 @@ module WebPipe
|
|
73
74
|
# class ApplicationController < ActionController::Base
|
74
75
|
# # By default uses the layout in `layouts/application`
|
75
76
|
# end
|
76
|
-
#
|
77
|
+
#
|
77
78
|
# # app/controllers/articles_index.rb
|
78
79
|
# require 'web_pipe/plugs/config'
|
79
80
|
#
|
data/lib/web_pipe/plug.rb
CHANGED
@@ -25,11 +25,11 @@ module WebPipe
|
|
25
25
|
# @param name [Any] Name for the plug that can't be resolved
|
26
26
|
def initialize(name)
|
27
27
|
super(
|
28
|
-
<<~
|
28
|
+
<<~MSG
|
29
29
|
Plug with name +#{name}+ is invalid. It must be something
|
30
30
|
callable, an instance method when no operation is given,
|
31
31
|
or something callable registered in the container."
|
32
|
-
|
32
|
+
MSG
|
33
33
|
)
|
34
34
|
end
|
35
35
|
end
|
@@ -83,7 +83,7 @@ module WebPipe
|
|
83
83
|
spec
|
84
84
|
elsif spec.nil?
|
85
85
|
pipe.method(name)
|
86
|
-
elsif container[spec]
|
86
|
+
elsif container[spec].respond_to?(:call)
|
87
87
|
container[spec]
|
88
88
|
else
|
89
89
|
raise InvalidPlugError, name
|
@@ -60,10 +60,11 @@ module WebPipe
|
|
60
60
|
# @return [Array<RackSupport::Middleware>]
|
61
61
|
def call
|
62
62
|
klass = spec[0]
|
63
|
-
options = spec[1
|
64
|
-
|
63
|
+
options = spec[1..] || Types::EMPTY_ARRAY
|
64
|
+
case klass
|
65
|
+
when WebPipe
|
65
66
|
klass.middlewares
|
66
|
-
|
67
|
+
when Class
|
67
68
|
[Middleware.new(middleware: klass, options: options)]
|
68
69
|
end
|
69
70
|
end
|
data/lib/web_pipe/version.rb
CHANGED
data/web_pipe.gemspec
CHANGED
@@ -43,7 +43,8 @@ Gem::Specification.new do |spec|
|
|
43
43
|
spec.add_development_dependency 'bundler'
|
44
44
|
spec.add_development_dependency 'dry-schema', '~> 1.0'
|
45
45
|
spec.add_development_dependency 'dry-transformer', '~> 0.1'
|
46
|
-
|
46
|
+
# TODO: Readd when dry-rb 0.8 is released (ruby 3.0 support)
|
47
|
+
# spec.add_development_dependency 'dry-view', '~> 0.8'
|
47
48
|
spec.add_development_dependency 'pry-byebug'
|
48
49
|
spec.add_development_dependency 'rack-flash3', '~> 1.0'
|
49
50
|
spec.add_development_dependency 'rack-test', '~> 1.1'
|
@@ -51,4 +52,6 @@ Gem::Specification.new do |spec|
|
|
51
52
|
spec.add_development_dependency 'redcarpet', '~> 3.4'
|
52
53
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
53
54
|
spec.add_development_dependency 'yard', '~> 0.9', '>= 0.9.20'
|
55
|
+
spec.add_development_dependency 'rubocop', '~> 1.8'
|
56
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 2.1'
|
54
57
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web_pipe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marc Busqué
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-monads
|
@@ -108,20 +108,6 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0.1'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: dry-view
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0.7'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0.7'
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
112
|
name: pry-byebug
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -232,6 +218,34 @@ dependencies:
|
|
232
218
|
- - ">="
|
233
219
|
- !ruby/object:Gem::Version
|
234
220
|
version: 0.9.20
|
221
|
+
- !ruby/object:Gem::Dependency
|
222
|
+
name: rubocop
|
223
|
+
requirement: !ruby/object:Gem::Requirement
|
224
|
+
requirements:
|
225
|
+
- - "~>"
|
226
|
+
- !ruby/object:Gem::Version
|
227
|
+
version: '1.8'
|
228
|
+
type: :development
|
229
|
+
prerelease: false
|
230
|
+
version_requirements: !ruby/object:Gem::Requirement
|
231
|
+
requirements:
|
232
|
+
- - "~>"
|
233
|
+
- !ruby/object:Gem::Version
|
234
|
+
version: '1.8'
|
235
|
+
- !ruby/object:Gem::Dependency
|
236
|
+
name: rubocop-rspec
|
237
|
+
requirement: !ruby/object:Gem::Requirement
|
238
|
+
requirements:
|
239
|
+
- - "~>"
|
240
|
+
- !ruby/object:Gem::Version
|
241
|
+
version: '2.1'
|
242
|
+
type: :development
|
243
|
+
prerelease: false
|
244
|
+
version_requirements: !ruby/object:Gem::Requirement
|
245
|
+
requirements:
|
246
|
+
- - "~>"
|
247
|
+
- !ruby/object:Gem::Version
|
248
|
+
version: '2.1'
|
235
249
|
description:
|
236
250
|
email:
|
237
251
|
- marc@lamarciana.com
|
@@ -241,6 +255,7 @@ extra_rdoc_files: []
|
|
241
255
|
files:
|
242
256
|
- ".gitignore"
|
243
257
|
- ".rspec"
|
258
|
+
- ".rubocop.yml"
|
244
259
|
- ".travis.yml"
|
245
260
|
- ".yardopts"
|
246
261
|
- CHANGELOG.md
|
@@ -341,7 +356,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
341
356
|
- !ruby/object:Gem::Version
|
342
357
|
version: '0'
|
343
358
|
requirements: []
|
344
|
-
rubygems_version: 3.
|
359
|
+
rubygems_version: 3.2.3
|
345
360
|
signing_key:
|
346
361
|
specification_version: 4
|
347
362
|
summary: Rack application builder through a pipe of operations on an immutable struct.
|