web_pipe 0.8.0 → 0.9.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile +4 -2
- data/README.md +60 -310
- data/Rakefile +5 -3
- data/bin/console +4 -3
- data/docs/_config.yml +1 -0
- data/docs/building_a_rack_application.md +25 -0
- data/docs/composing_applications.md +43 -0
- data/docs/connection_struct/configuring_the_connection_struct.md +25 -0
- data/docs/connection_struct/halting_the_pipe.md +71 -0
- data/docs/connection_struct/sharing_data_downstream.md +46 -0
- data/docs/connection_struct.md +77 -0
- data/docs/design_model.md +44 -0
- data/docs/dsl_free_usage.md +26 -0
- data/docs/extensions/container.md +41 -0
- data/docs/extensions/cookies.md +47 -0
- data/docs/extensions/dry_schema.md +51 -0
- data/docs/extensions/dry_view.md +113 -0
- data/docs/extensions/flash.md +41 -0
- data/docs/extensions/params.md +117 -0
- data/docs/extensions/redirect.md +25 -0
- data/docs/extensions/router_params.md +40 -0
- data/docs/extensions/session.md +39 -0
- data/docs/extensions/url.md +11 -0
- data/docs/extensions.md +13 -0
- data/docs/introduction.md +73 -0
- data/docs/plugging_operations/composing_operations.md +36 -0
- data/docs/plugging_operations/injecting_operations.md +32 -0
- data/docs/plugging_operations/resolving_operations.md +71 -0
- data/docs/plugging_operations.md +21 -0
- data/docs/plugs/config.md +18 -0
- data/docs/plugs/content_type.md +16 -0
- data/docs/plugs.md +13 -0
- data/docs/recipes/dry_rb_integration.md +18 -0
- data/docs/recipes/hanami_router_integration.md +25 -0
- data/docs/recipes/using_all_restful_methods.md +25 -0
- data/docs/using_rack_middlewares/composing_middlewares.md +26 -0
- data/docs/using_rack_middlewares/injecting_middlewares.md +47 -0
- data/docs/using_rack_middlewares.md +22 -0
- data/lib/web_pipe/app.rb +4 -2
- data/lib/web_pipe/conn.rb +5 -3
- data/lib/web_pipe/conn_support/builder.rb +2 -0
- data/lib/web_pipe/conn_support/composition.rb +9 -7
- data/lib/web_pipe/conn_support/errors.rb +3 -1
- data/lib/web_pipe/conn_support/headers.rb +12 -10
- data/lib/web_pipe/conn_support/types.rb +11 -9
- data/lib/web_pipe/dsl/builder.rb +5 -3
- data/lib/web_pipe/dsl/class_context.rb +5 -3
- data/lib/web_pipe/dsl/dsl_context.rb +7 -5
- data/lib/web_pipe/dsl/instance_methods.rb +7 -5
- data/lib/web_pipe/extensions/container/container.rb +2 -0
- data/lib/web_pipe/extensions/cookies/cookies.rb +4 -3
- data/lib/web_pipe/extensions/dry_schema/dry_schema.rb +2 -0
- data/lib/web_pipe/extensions/dry_schema/plugs/sanitize_params.rb +4 -2
- data/lib/web_pipe/extensions/dry_view/dry_view.rb +13 -9
- data/lib/web_pipe/extensions/flash/flash.rb +7 -7
- data/lib/web_pipe/extensions/params/params/transf.rb +3 -1
- data/lib/web_pipe/extensions/params/params.rb +7 -5
- data/lib/web_pipe/extensions/redirect/redirect.rb +8 -6
- data/lib/web_pipe/extensions/router_params/router_params.rb +4 -2
- data/lib/web_pipe/extensions/session/session.rb +6 -4
- data/lib/web_pipe/extensions/url/url.rb +3 -1
- data/lib/web_pipe/plug.rb +7 -5
- data/lib/web_pipe/plugs.rb +7 -1
- data/lib/web_pipe/rack_support/app_with_middlewares.rb +3 -1
- data/lib/web_pipe/rack_support/middleware.rb +2 -0
- data/lib/web_pipe/rack_support/middleware_specification.rb +5 -3
- data/lib/web_pipe/types.rb +3 -1
- data/lib/web_pipe/version.rb +3 -1
- data/lib/web_pipe.rb +5 -3
- data/web_pipe.gemspec +34 -34
- metadata +82 -48
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'web_pipe/types'
|
2
4
|
require 'web_pipe/dsl/dsl_context'
|
3
5
|
|
@@ -32,7 +34,7 @@ module WebPipe
|
|
32
34
|
define_container
|
33
35
|
define_dsl
|
34
36
|
end
|
35
|
-
|
37
|
+
|
36
38
|
private
|
37
39
|
|
38
40
|
def define_container
|
@@ -47,11 +49,11 @@ module WebPipe
|
|
47
49
|
DSL_METHODS.each do |method|
|
48
50
|
module_exec(dsl_context) do |dsl_context|
|
49
51
|
define_method(method) do |*args, &block|
|
50
|
-
dsl_context.method(method).(*args, &block)
|
52
|
+
dsl_context.method(method).call(*args, &block)
|
51
53
|
end
|
52
54
|
end
|
53
55
|
end
|
54
56
|
end
|
55
57
|
end
|
56
58
|
end
|
57
|
-
end
|
59
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'web_pipe'
|
2
4
|
require 'web_pipe/types'
|
3
5
|
require 'web_pipe/plug'
|
@@ -59,11 +61,11 @@ module WebPipe
|
|
59
61
|
# @return [Array<Plug>]
|
60
62
|
def plug(name, spec = nil, &block_spec)
|
61
63
|
plug_spec = if spec.is_a?(WebPipe)
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
64
|
+
spec.to_proc
|
65
|
+
elsif spec
|
66
|
+
spec
|
67
|
+
else
|
68
|
+
block_spec
|
67
69
|
end
|
68
70
|
|
69
71
|
plugs << Plug.new(name: name, spec: plug_spec)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'web_pipe/types'
|
2
4
|
require 'web_pipe/conn'
|
3
5
|
require 'web_pipe/app'
|
@@ -58,7 +60,7 @@ module WebPipe
|
|
58
60
|
app = App.new(operations)
|
59
61
|
@rack_app = RackSupport::AppWithMiddlewares.new(middlewares, app)
|
60
62
|
end
|
61
|
-
|
63
|
+
|
62
64
|
# Expected interface for rack.
|
63
65
|
#
|
64
66
|
# @param env [Hash] Rack env
|
@@ -100,10 +102,10 @@ module WebPipe
|
|
100
102
|
#
|
101
103
|
# @see ConnSupport::Composition
|
102
104
|
def to_proc
|
103
|
-
ConnSupport::Composition
|
104
|
-
new(operations)
|
105
|
-
method(:call)
|
106
|
-
to_proc
|
105
|
+
ConnSupport::Composition
|
106
|
+
.new(operations)
|
107
|
+
.method(:call)
|
108
|
+
.to_proc
|
107
109
|
end
|
108
110
|
end
|
109
111
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'web_pipe'
|
2
4
|
require 'web_pipe/types'
|
3
5
|
require 'rack/utils'
|
@@ -8,7 +10,7 @@ module WebPipe
|
|
8
10
|
# This extension helps with the addition of the `Set-Cookie` header
|
9
11
|
# to the response, which is the way the server has to instruct the
|
10
12
|
# browser to keep a cookie. A cookie can be added with the
|
11
|
-
# {#
|
13
|
+
# {#set_cookie} method, while it can be marked for deletion with
|
12
14
|
# {#delete_cookie}. Remember that marking a cookie for deletion just
|
13
15
|
# means adding the same cookie name with an expiration time in the
|
14
16
|
# past.
|
@@ -54,8 +56,7 @@ module WebPipe
|
|
54
56
|
def request_cookies
|
55
57
|
request.cookies
|
56
58
|
end
|
57
|
-
|
58
|
-
|
59
|
+
|
59
60
|
# @param key [String]
|
60
61
|
# @param value [String]
|
61
62
|
# @param opts [SET_COOKIE_OPTIONS[]]
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'web_pipe/types'
|
2
4
|
require 'web_pipe/extensions/dry_schema/dry_schema'
|
3
5
|
|
@@ -18,11 +20,11 @@ module WebPipe
|
|
18
20
|
# @return [ConnSupport::Composition::Operation[], Types::Undefined]
|
19
21
|
def self.call(schema, handler = Types::Undefined)
|
20
22
|
lambda do |conn|
|
21
|
-
result = schema.(conn.params)
|
23
|
+
result = schema.call(conn.params)
|
22
24
|
if result.success?
|
23
25
|
conn.add_config(DrySchema::SANITIZED_PARAMS_KEY, result.output)
|
24
26
|
else
|
25
|
-
get_handler(conn, handler).(conn, result)
|
27
|
+
get_handler(conn, handler).call(conn, result)
|
26
28
|
end
|
27
29
|
end
|
28
30
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'web_pipe/types'
|
2
4
|
require 'web_pipe/conn'
|
3
5
|
require 'dry/view'
|
@@ -17,7 +19,7 @@ module WebPipe
|
|
17
19
|
#
|
18
20
|
# expose :name
|
19
21
|
# end
|
20
|
-
#
|
22
|
+
#
|
21
23
|
# class App
|
22
24
|
# include WebPipe
|
23
25
|
#
|
@@ -39,7 +41,7 @@ module WebPipe
|
|
39
41
|
#
|
40
42
|
# Container = { 'views.say_hello' => SayHelloView.new }.freeze
|
41
43
|
#
|
42
|
-
# plug :config_container, ->(conn) { conn.add_config(:container, Container
|
44
|
+
# plug :config_container, ->(conn) { conn.add_config(:container, Container) }
|
43
45
|
# plug :render
|
44
46
|
#
|
45
47
|
# def render(conn)
|
@@ -75,6 +77,8 @@ module WebPipe
|
|
75
77
|
# expose :name
|
76
78
|
# end
|
77
79
|
#
|
80
|
+
# WebPipe.load_extensions(:url)
|
81
|
+
#
|
78
82
|
# class App
|
79
83
|
# include WebPipe
|
80
84
|
#
|
@@ -118,7 +122,7 @@ module WebPipe
|
|
118
122
|
def view(view_spec, **kwargs)
|
119
123
|
view_instance = view_instance(view_spec)
|
120
124
|
view_input = view_input(kwargs, view_instance)
|
121
|
-
|
125
|
+
|
122
126
|
set_response_body(
|
123
127
|
view_instance.call(
|
124
128
|
view_input
|
@@ -137,12 +141,12 @@ module WebPipe
|
|
137
141
|
def view_input(kwargs, view_instance)
|
138
142
|
return kwargs if kwargs.key?(:context)
|
139
143
|
|
140
|
-
context =
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
144
|
+
context = view_instance
|
145
|
+
.config
|
146
|
+
.default_context
|
147
|
+
.with(
|
148
|
+
fetch_config(VIEW_CONTEXT_KEY, DEFAULT_VIEW_CONTEXT).call(self)
|
149
|
+
)
|
146
150
|
kwargs.merge(context: context)
|
147
151
|
end
|
148
152
|
end
|
@@ -4,7 +4,7 @@ require 'web_pipe/conn'
|
|
4
4
|
require 'web_pipe/conn_support/errors'
|
5
5
|
|
6
6
|
module WebPipe
|
7
|
-
# Provides with a
|
7
|
+
# Provides with a typical flash messages functionality.
|
8
8
|
#
|
9
9
|
# @example
|
10
10
|
# require 'web_pipe'
|
@@ -12,15 +12,15 @@ module WebPipe
|
|
12
12
|
# require 'rack-flash'
|
13
13
|
#
|
14
14
|
# WebPipe.load_extensions(:flash)
|
15
|
-
#
|
15
|
+
#
|
16
16
|
# class MyApp
|
17
17
|
# include WebPipe
|
18
18
|
#
|
19
19
|
# use :session, Rack::Session::Cookie, secret: 'secret'
|
20
20
|
# use :flash, Rack::Flash
|
21
21
|
#
|
22
|
-
# plug :
|
23
|
-
# plug :
|
22
|
+
# plug :add_to_flash, ->(conn) { conn.add_flash(:notice, 'Hello world') }
|
23
|
+
# plug :add_to_flash_now, ->(conn) { conn.add_flash_now(:notice_now, 'Hello world now') }
|
24
24
|
# end
|
25
25
|
#
|
26
26
|
# Usually, you will end up making `conn.flash` available to your view system:
|
@@ -37,7 +37,7 @@ module WebPipe
|
|
37
37
|
# @see https://github.com/nakajima/rack-flash
|
38
38
|
module Flash
|
39
39
|
RACK_FLASH_KEY = 'x-rack.flash'
|
40
|
-
|
40
|
+
|
41
41
|
# Returns the flash bag.
|
42
42
|
#
|
43
43
|
# @return [Rack::Flash::FlashHash]
|
@@ -47,8 +47,8 @@ module WebPipe
|
|
47
47
|
def flash
|
48
48
|
env.fetch(RACK_FLASH_KEY) do
|
49
49
|
raise ConnSupport::MissingMiddlewareError.new(
|
50
|
-
|
51
|
-
|
50
|
+
'flash', 'Rack::Flash', 'https://rubygems.org/gems/rack-flash3'
|
51
|
+
)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'web_pipe/types'
|
2
4
|
require 'web_pipe/extensions/params/params/transf'
|
3
5
|
|
@@ -32,7 +34,7 @@ module WebPipe
|
|
32
34
|
# @example
|
33
35
|
# # http://www.example.com?foo=bar
|
34
36
|
# conn.
|
35
|
-
# add_config(:
|
37
|
+
# add_config(:param_transformations, [:deep_symbolize_keys]).
|
36
38
|
# params #=> { foo: 'bar' }
|
37
39
|
#
|
38
40
|
# You can register your own transformation functions:
|
@@ -61,7 +63,7 @@ module WebPipe
|
|
61
63
|
# # http://www.example.com?foo=bar
|
62
64
|
# fake = ->(_params) { { fake: :params } }
|
63
65
|
# conn.
|
64
|
-
# params(fake) #=> { fake: :params }
|
66
|
+
# params(fake) #=> { fake: :params }
|
65
67
|
#
|
66
68
|
# @see https://github.com/solnic/transproc
|
67
69
|
module Params
|
@@ -80,7 +82,7 @@ module WebPipe
|
|
80
82
|
acc.>>transformation(t)
|
81
83
|
end
|
82
84
|
|
83
|
-
Transf[transformations].(request.params)
|
85
|
+
Transf[transformations].call(request.params)
|
84
86
|
end
|
85
87
|
|
86
88
|
private
|
@@ -90,10 +92,10 @@ module WebPipe
|
|
90
92
|
if (transformation.fn.arity - transformation.args.count) == 1
|
91
93
|
transformation
|
92
94
|
else
|
93
|
-
Transf[
|
95
|
+
Transf[spec, self]
|
94
96
|
end
|
95
97
|
end
|
96
98
|
end
|
97
99
|
|
98
100
|
Conn.include(Params)
|
99
|
-
end
|
101
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'web_pipe/types'
|
2
4
|
|
3
5
|
module WebPipe
|
@@ -26,14 +28,14 @@ module WebPipe
|
|
26
28
|
|
27
29
|
# Valid type for a redirect status code
|
28
30
|
RedirectCode = Types::Strict::Integer.constrained(gteq: 300, lteq: 399)
|
29
|
-
|
30
|
-
# @param
|
31
|
+
|
32
|
+
# @param location [String]
|
31
33
|
# @param code [Integer]
|
32
|
-
def redirect(
|
33
|
-
add_response_header(LOCATION_HEADER,
|
34
|
-
set_status(RedirectCode[code])
|
34
|
+
def redirect(location, code = 302)
|
35
|
+
add_response_header(LOCATION_HEADER, location)
|
36
|
+
.set_status(RedirectCode[code])
|
35
37
|
end
|
36
38
|
end
|
37
39
|
|
38
40
|
Conn.include(Redirect)
|
39
|
-
end
|
41
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'web_pipe'
|
2
4
|
require 'web_pipe/types'
|
3
5
|
|
@@ -45,7 +47,7 @@ module WebPipe
|
|
45
47
|
# @see https://github.com/hanami/router#string-matching-with-variables
|
46
48
|
module RouterParams
|
47
49
|
ROUTER_PARAM_KEY = 'router.params'
|
48
|
-
|
50
|
+
|
49
51
|
# @param params [Hash]
|
50
52
|
# @param conn [WebPipe::Conn]
|
51
53
|
#
|
@@ -56,4 +58,4 @@ module WebPipe
|
|
56
58
|
|
57
59
|
WebPipe::Params::Transf.register(:router_params, method(:call))
|
58
60
|
end
|
59
|
-
end
|
61
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'web_pipe/conn'
|
2
4
|
require 'web_pipe/types'
|
3
5
|
require 'rack'
|
@@ -13,13 +15,14 @@ module WebPipe
|
|
13
15
|
#
|
14
16
|
# @example
|
15
17
|
# require 'web_pipe'
|
18
|
+
# require 'rack/session'
|
16
19
|
#
|
17
20
|
# WebPipe.load_extensions(:session)
|
18
21
|
#
|
19
22
|
# class MyApp
|
20
23
|
# include WebPipe
|
21
24
|
#
|
22
|
-
# use Rack::Cookie, secret: 'top_secret'
|
25
|
+
# use Rack::Session::Cookie, secret: 'top_secret'
|
23
26
|
#
|
24
27
|
# plug :add_session, ->(conn) { conn.add_session('foo', 'bar') }
|
25
28
|
# plug :fetch_session, ->(conn) { conn.add(:foo, conn.fetch_session('foo')) }
|
@@ -36,8 +39,8 @@ module WebPipe
|
|
36
39
|
def session
|
37
40
|
env.fetch(Rack::RACK_SESSION) do
|
38
41
|
raise ConnSupport::MissingMiddlewareError.new(
|
39
|
-
|
40
|
-
|
42
|
+
'session', 'Rack::Session', 'https://www.rubydoc.info/github/rack/rack/Rack/Session'
|
43
|
+
)
|
41
44
|
end
|
42
45
|
end
|
43
46
|
|
@@ -53,7 +56,6 @@ module WebPipe
|
|
53
56
|
session.fetch(*args, &block)
|
54
57
|
end
|
55
58
|
|
56
|
-
|
57
59
|
# Adds given key/value pair to the session.
|
58
60
|
#
|
59
61
|
# @param key [SESSION_KEY[]] Session key
|
data/lib/web_pipe/plug.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'dry/struct'
|
2
4
|
require 'web_pipe/types'
|
3
5
|
require 'web_pipe/conn_support/composition'
|
@@ -81,10 +83,10 @@ module WebPipe
|
|
81
83
|
spec
|
82
84
|
elsif spec.nil?
|
83
85
|
pipe.method(name)
|
84
|
-
elsif container[spec]
|
86
|
+
elsif container[spec]&.respond_to?(:call)
|
85
87
|
container[spec]
|
86
88
|
else
|
87
|
-
raise InvalidPlugError
|
89
|
+
raise InvalidPlugError, name
|
88
90
|
end
|
89
91
|
end
|
90
92
|
|
@@ -98,12 +100,12 @@ module WebPipe
|
|
98
100
|
# @return [Array<ConnSupport::Composition::Operation[]>]
|
99
101
|
def self.inject_and_resolve(plugs, injections, container, object)
|
100
102
|
plugs.map do |plug|
|
101
|
-
if injections.
|
103
|
+
if injections.key?(plug.name)
|
102
104
|
plug.with(injections[plug.name])
|
103
105
|
else
|
104
106
|
plug
|
105
|
-
end.(container, object)
|
107
|
+
end.call(container, object)
|
106
108
|
end
|
107
109
|
end
|
108
110
|
end
|
109
|
-
end
|
111
|
+
end
|
data/lib/web_pipe/plugs.rb
CHANGED
@@ -1,5 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module WebPipe
|
2
4
|
# Namespace for builders of operations on {WebPipe::Conn}.
|
5
|
+
#
|
6
|
+
# Plugs are just higher order functions: functions which return functions
|
7
|
+
# (operations). For this reason, as a convention its interface is also
|
8
|
+
# `#call`.
|
3
9
|
module Plugs
|
4
10
|
end
|
5
|
-
end
|
11
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'web_pipe/types'
|
2
4
|
require 'web_pipe/rack_support/middleware'
|
3
5
|
require 'rack'
|
@@ -24,7 +26,7 @@ module WebPipe
|
|
24
26
|
|
25
27
|
# @return [Rack::Builder]
|
26
28
|
attr_reader :builder
|
27
|
-
|
29
|
+
|
28
30
|
def initialize(rack_middlewares, app)
|
29
31
|
@rack_middlewares = Types.Array(Middleware)[rack_middlewares]
|
30
32
|
@app = App[app]
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'dry/struct'
|
2
4
|
require 'web_pipe/rack_support/middleware'
|
3
5
|
require 'web_pipe/types'
|
@@ -45,11 +47,11 @@ module WebPipe
|
|
45
47
|
# @return [Array<RackSupport::Middleware>]
|
46
48
|
def self.inject_and_resolve(middleware_specifications, injections)
|
47
49
|
middleware_specifications.map do |spec|
|
48
|
-
if injections.
|
50
|
+
if injections.key?(spec.name)
|
49
51
|
spec.with(injections[spec.name])
|
50
52
|
else
|
51
53
|
spec
|
52
|
-
end.
|
54
|
+
end.call
|
53
55
|
end.flatten
|
54
56
|
end
|
55
57
|
|
@@ -69,7 +71,7 @@ module WebPipe
|
|
69
71
|
# Returns new instance with {#spec} replaced.
|
70
72
|
#
|
71
73
|
# @param new_spec [Spec[]]
|
72
|
-
#
|
74
|
+
#
|
73
75
|
# @return [MiddlewareSpecification]
|
74
76
|
def with(new_spec)
|
75
77
|
new(spec: new_spec)
|
data/lib/web_pipe/types.rb
CHANGED
data/lib/web_pipe/version.rb
CHANGED
data/lib/web_pipe.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'web_pipe/dsl/builder'
|
2
4
|
|
3
5
|
# See [the
|
@@ -9,7 +11,7 @@ module WebPipe
|
|
9
11
|
# Including just delegates to an instance of `Builder`, so
|
10
12
|
# `Builder#included` is finally called.
|
11
13
|
def self.included(klass)
|
12
|
-
klass.include(call
|
14
|
+
klass.include(call)
|
13
15
|
end
|
14
16
|
|
15
17
|
def self.call(*args)
|
@@ -24,7 +26,7 @@ module WebPipe
|
|
24
26
|
require 'web_pipe/extensions/dry_schema/dry_schema'
|
25
27
|
require 'web_pipe/extensions/dry_schema/plugs/sanitize_params'
|
26
28
|
end
|
27
|
-
|
29
|
+
|
28
30
|
register_extension :dry_view do
|
29
31
|
require 'web_pipe/extensions/dry_view/dry_view'
|
30
32
|
end
|
@@ -56,4 +58,4 @@ module WebPipe
|
|
56
58
|
register_extension :url do
|
57
59
|
require 'web_pipe/extensions/url/url'
|
58
60
|
end
|
59
|
-
end
|
61
|
+
end
|
data/web_pipe.gemspec
CHANGED
@@ -1,54 +1,54 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
lib = File.expand_path(
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require
|
5
|
+
require 'web_pipe/version'
|
6
6
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
|
-
spec.name =
|
8
|
+
spec.name = 'web_pipe'
|
9
9
|
spec.version = WebPipe::VERSION
|
10
|
-
spec.authors = [
|
11
|
-
spec.email = [
|
10
|
+
spec.authors = ['Marc Busqué']
|
11
|
+
spec.email = ['marc@lamarciana.com']
|
12
12
|
|
13
|
-
spec.summary =
|
14
|
-
spec.homepage =
|
13
|
+
spec.summary = 'Rack application builder through a pipe of operations on an immutable struct.'
|
14
|
+
spec.homepage = 'https://github.com/waiting-for-dev/web_pipe'
|
15
15
|
|
16
16
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
17
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
18
|
if spec.respond_to?(:metadata)
|
19
|
-
spec.metadata[
|
19
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
20
20
|
|
21
|
-
spec.metadata[
|
22
|
-
spec.metadata[
|
23
|
-
spec.metadata[
|
21
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
22
|
+
spec.metadata['source_code_uri'] = spec.homepage
|
23
|
+
spec.metadata['changelog_uri'] = spec.homepage + '/CHANGELOG.md'
|
24
24
|
else
|
25
|
-
raise
|
26
|
-
|
25
|
+
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
26
|
+
'public gem pushes.'
|
27
27
|
end
|
28
28
|
|
29
29
|
# Specify which files should be added to the gem when it is released.
|
30
30
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
31
|
-
spec.files
|
31
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
32
32
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
33
33
|
end
|
34
|
-
spec.bindir =
|
34
|
+
spec.bindir = 'exe'
|
35
35
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
36
|
-
spec.require_paths = [
|
37
|
-
|
38
|
-
spec.add_runtime_dependency
|
39
|
-
spec.add_runtime_dependency
|
40
|
-
spec.add_runtime_dependency
|
41
|
-
spec.add_runtime_dependency
|
42
|
-
spec.add_runtime_dependency
|
43
|
-
|
44
|
-
spec.add_development_dependency
|
45
|
-
spec.add_development_dependency
|
46
|
-
spec.add_development_dependency
|
47
|
-
spec.add_development_dependency
|
48
|
-
spec.add_development_dependency
|
49
|
-
spec.add_development_dependency
|
50
|
-
spec.add_development_dependency
|
51
|
-
spec.add_development_dependency
|
52
|
-
spec.add_development_dependency
|
53
|
-
spec.add_development_dependency
|
36
|
+
spec.require_paths = ['lib']
|
37
|
+
|
38
|
+
spec.add_runtime_dependency 'dry-monads', '~> 1.3'
|
39
|
+
spec.add_runtime_dependency 'dry-struct', '~> 1.0'
|
40
|
+
spec.add_runtime_dependency 'dry-types', '~> 1.1'
|
41
|
+
spec.add_runtime_dependency 'rack', '~> 2.0'
|
42
|
+
spec.add_runtime_dependency 'transproc', '~> 1.1'
|
43
|
+
|
44
|
+
spec.add_development_dependency 'bundler', '~> 1.17'
|
45
|
+
spec.add_development_dependency 'dry-schema', '~> 1.0'
|
46
|
+
spec.add_development_dependency 'dry-view', '~> 0.7'
|
47
|
+
spec.add_development_dependency 'pry-byebug'
|
48
|
+
spec.add_development_dependency 'rack-flash3', '~> 1.0'
|
49
|
+
spec.add_development_dependency 'rack-test', '~> 1.1'
|
50
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
51
|
+
spec.add_development_dependency 'redcarpet', '~> 3.4'
|
52
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
53
|
+
spec.add_development_dependency 'yard', '~> 0.9', '>= 0.9.20'
|
54
54
|
end
|