web_pipe 0.1.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 617c24131c1091c3ec7fb214f8f90af0f6fd199d2684ee8b71e08ac373f9795a
4
- data.tar.gz: 68a73cfff54e49580ea8426265579ece63e3abbe78dd93b84862cee86017ba19
3
+ metadata.gz: d89f930070f399bae4f6949b4f62b61d2fcb6f8716e9527baa350cf673daa4a6
4
+ data.tar.gz: a7942d96afa3110e68dd55591a56b780d39a61c6e5b22cff5087a628b5997a6e
5
5
  SHA512:
6
- metadata.gz: aee8034e0eff973a91df4bed368f459cd841a3ea7de448b584bfef7f7d995f519ea3201bfd3f16290fb6692bf5fe8ab9bfe5d37d443eeb75581127adc3de3cee
7
- data.tar.gz: 452773b224c0affce8aeed40251f25835cfea045208d4ba92aeb076d2a3b888df6171cfb7d5323c8d16b5ab8eb830d649d8add14fc17b1c24339957266d7de65
6
+ metadata.gz: 9a5b905649927d6bbba53540583f9429ef862aa0ee764087f037f3b490e32c87d3d24cbd30980267d7a7bd89735d23c9a3965c21938fa50d326f7a794eab6c6b
7
+ data.tar.gz: 19c1b7ec4247cfe48cde66b0c74eee6978f905759f943b77d0b93d315e2cc603759a4ae5afc7282945255093d4fd746e4101e62834067b10853aaa9f69e3d254
data/CHANGELOG.md CHANGED
@@ -4,6 +4,15 @@ 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.0.1] - 2019-05-07
7
+ ## [0.2.0] - 2019-07-05
8
+ ### Added
9
+ - dry-view integration ([#1](https://github.com/waiting-for-dev/web_pipe/pull/1), [#3](https://github.com/waiting-for-dev/web_pipe/pull/3), [#4](https://github.com/waiting-for-dev/web_pipe/pull/4), [#5](https://github.com/waiting-for-dev/web_pipe/pull/5) and [#6](https://github.com/waiting-for-dev/web_pipe/pull/6))
10
+ - Configuring a container in `WebPipe::Conn` ([#2](https://github.com/waiting-for-dev/web_pipe/pull/2) and [#5](https://github.com/waiting-for-dev/web_pipe/pull/5))
11
+ - Plug to set `Content-Type` response header ([#7](https://github.com/waiting-for-dev/web_pipe/pull/7))
12
+
13
+ ### Fixed
14
+ - Fix key interpolation in `KeyNotFoundInBagError` ([#8](https://github.com/waiting-for-dev/web_pipe/pull/8))
15
+
16
+ ## [0.1.0] - 2019-05-07
8
17
  ### Added
9
18
  - Initial release.
data/Gemfile.lock CHANGED
@@ -5,7 +5,7 @@ PATH
5
5
  dry-initializer (~> 3.0)
6
6
  dry-monads (~> 1.2)
7
7
  dry-struct (~> 1.0)
8
- dry-types (~> 1.0)
8
+ dry-types (~> 1.1)
9
9
  rack (~> 2.0)
10
10
 
11
11
  GEM
@@ -18,7 +18,7 @@ GEM
18
18
  dry-configurable (0.8.2)
19
19
  concurrent-ruby (~> 1.0)
20
20
  dry-core (~> 0.4, >= 0.4.7)
21
- dry-container (0.7.0)
21
+ dry-container (0.7.1)
22
22
  concurrent-ruby (~> 1.0)
23
23
  dry-configurable (~> 0.1, >= 0.1.3)
24
24
  dry-core (0.4.7)
@@ -26,7 +26,7 @@ GEM
26
26
  dry-equalizer (0.2.2)
27
27
  dry-inflector (0.1.2)
28
28
  dry-initializer (3.0.1)
29
- dry-logic (1.0.0)
29
+ dry-logic (1.0.2)
30
30
  concurrent-ruby (~> 1.0)
31
31
  dry-core (~> 0.2)
32
32
  dry-equalizer (~> 0.2)
@@ -39,13 +39,19 @@ GEM
39
39
  dry-equalizer (~> 0.2)
40
40
  dry-types (~> 1.0)
41
41
  ice_nine (~> 0.11)
42
- dry-types (1.0.0)
42
+ dry-types (1.1.0)
43
43
  concurrent-ruby (~> 1.0)
44
44
  dry-container (~> 0.3)
45
45
  dry-core (~> 0.4, >= 0.4.4)
46
46
  dry-equalizer (~> 0.2, >= 0.2.2)
47
47
  dry-inflector (~> 0.1, >= 0.1.2)
48
- dry-logic (~> 1.0)
48
+ dry-logic (~> 1.0, >= 1.0.2)
49
+ dry-view (0.7.0)
50
+ dry-configurable (~> 0.1)
51
+ dry-core (~> 0.2)
52
+ dry-equalizer (~> 0.2)
53
+ dry-inflector (~> 0.1)
54
+ tilt (~> 2.0, >= 2.0.6)
49
55
  ice_nine (0.11.2)
50
56
  method_source (0.9.2)
51
57
  pry (0.12.2)
@@ -72,20 +78,22 @@ GEM
72
78
  diff-lcs (>= 1.2.0, < 2.0)
73
79
  rspec-support (~> 3.8.0)
74
80
  rspec-support (3.8.0)
75
- yard (0.9.19)
81
+ tilt (2.0.9)
82
+ yard (0.9.20)
76
83
 
77
84
  PLATFORMS
78
85
  ruby
79
86
 
80
87
  DEPENDENCIES
81
88
  bundler (~> 1.17)
89
+ dry-view (~> 0.7)
82
90
  pry-byebug
83
91
  rack-test (~> 1.1)
84
92
  rake (~> 10.0)
85
93
  redcarpet (~> 3.4)
86
94
  rspec (~> 3.0)
87
95
  web_pipe!
88
- yard (~> 0.9)
96
+ yard (~> 0.9, >= 0.9.20)
89
97
 
90
98
  BUNDLED WITH
91
99
  1.17.2
data/README.md CHANGED
@@ -262,6 +262,26 @@ op_2 = ->(conn) { conn.set_response_body('Hello') }
262
262
  WebPipe::App.new([op_1, op_2])
263
263
  ```
264
264
 
265
+ ## Plugs
266
+
267
+ `web_pipe` ships with a series of common operations you can take
268
+ advantage in order to build your application:
269
+
270
+ - [container](lib/web_pipe/plugs/container.rb): Allows
271
+ configuring a container to resolve dependencies.
272
+ - [content_type](lib/web_pipe/plugs/content_type.rb): Sets
273
+ `Content-Type` response header.
274
+
275
+ ## Extensions
276
+
277
+ By default, `web_pipe` behavior is the very minimal you need to build
278
+ a web application. However, you can extend it with the following
279
+ extensions (click on each name for details on the usage):
280
+
281
+ - [dry-view](lib/web_pipe/extensions/dry_view/dry_view.rb):
282
+ Integration with [`dry-view`](https://dry-rb.org/gems/dry-view/)
283
+ rendering system.
284
+
265
285
  ## Current status
266
286
 
267
287
  `web_pipe` is in active development. The very basic features to build
data/lib/web_pipe.rb CHANGED
@@ -4,6 +4,8 @@ require 'web_pipe/dsl/builder'
4
4
  # README](https://github.com/waiting-for-dev/web_pipe/blob/master/README.md)
5
5
  # for a general overview of this library.
6
6
  module WebPipe
7
+ extend Dry::Core::Extensions
8
+
7
9
  # Including just delegates to an instance of `Builder`, so
8
10
  # `Builder#included` is finally called.
9
11
  def self.included(klass)
@@ -13,4 +15,8 @@ module WebPipe
13
15
  def self.call(*args)
14
16
  DSL::Builder.new(*args)
15
17
  end
18
+
19
+ register_extension :dry_view do
20
+ require 'web_pipe/extensions/dry_view/dry_view'
21
+ end
16
22
  end
data/lib/web_pipe/app.rb CHANGED
@@ -30,7 +30,7 @@ module WebPipe
30
30
  #
31
31
  # It should be anything callable expecting a {Conn} and
32
32
  # returning a {Conn}.
33
- Operation = Types.Contract(:call)
33
+ Operation = Types.Interface(:call)
34
34
 
35
35
  # Type for a rack environment.
36
36
  RackEnv = Types::Strict::Hash
data/lib/web_pipe/conn.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'dry/struct'
2
+ require 'web_pipe/types'
2
3
  require 'web_pipe/conn_support/types'
3
4
  require 'web_pipe/conn_support/errors'
4
5
  require 'web_pipe/conn_support/headers'
@@ -23,7 +24,7 @@ module WebPipe
23
24
  # instance is detected.
24
25
  #
25
26
  # @example
26
- # WebPipe::Conn::Builder.call(env).
27
+ # WebPipe::ConnSupport::Builder.call(env).
27
28
  # set_status(404).
28
29
  # add_response_header('Content-Type', 'text/plain').
29
30
  # set_response_body('Not found').
@@ -341,7 +342,9 @@ module WebPipe
341
342
  #
342
343
  # @raise ConnSupport::KeyNotFoundInBagError when key is not
343
344
  # registered in the bag.
344
- def fetch(key)
345
+ def fetch(key, default = Types::Undefined)
346
+ return bag.fetch(key, default) unless default == Types::Undefined
347
+
345
348
  bag.fetch(key) { raise ConnSupport::KeyNotFoundInBagError.new(key) }
346
349
  end
347
350
 
@@ -369,7 +372,7 @@ module WebPipe
369
372
  # @return
370
373
  # [Array<StatusCode, Headers, ResponseBody>]
371
374
  #
372
- # @private
375
+ # @api private
373
376
  def rack_response
374
377
  [
375
378
  status,
@@ -8,7 +8,7 @@ module WebPipe
8
8
  #
9
9
  # It always return a {Conn::Clean} subclass.
10
10
  #
11
- # @private
11
+ # @api private
12
12
  module Builder
13
13
  # @param env [Types::Env] Rack's env
14
14
  #
@@ -7,7 +7,7 @@ module WebPipe
7
7
  def initialize(key)
8
8
  super(
9
9
  <<~eos
10
- Bag does not contain a key with name +key+.
10
+ Bag does not contain a key with name +#{key}+.
11
11
  eos
12
12
  )
13
13
  end
@@ -2,7 +2,7 @@ module WebPipe
2
2
  module ConnSupport
3
3
  # Helpers to work with headers and its rack's env representation.
4
4
  #
5
- # @private
5
+ # @api private
6
6
  module Headers
7
7
  # Headers which come as plain CGI-like variables (without the `HTTP_`
8
8
  # prefixed) from the rack server.
@@ -1,6 +1,5 @@
1
1
  require 'dry/types'
2
2
  require 'rack/request'
3
- require 'web_pipe/types'
4
3
 
5
4
  module WebPipe
6
5
  module ConnSupport
@@ -24,7 +23,7 @@ module WebPipe
24
23
  ScriptName = Strict::String
25
24
  PathInfo = Strict::String
26
25
  QueryString = Strict::String
27
- RequestBody = WebPipe::Types.Contract(:gets, :each, :read, :rewind)
26
+ RequestBody = Interface(:gets, :each, :read, :rewind)
28
27
 
29
28
  BaseUrl = Strict::String
30
29
  Path = Strict::String
@@ -35,8 +34,7 @@ module WebPipe
35
34
  Status = Strict::Integer.
36
35
  default(200).
37
36
  constrained(gteq: 100, lteq: 599)
38
- ResponseBody = WebPipe::Types.Contract(:each).
39
- default([''].freeze)
37
+ ResponseBody = Interface(:each).default([''].freeze)
40
38
 
41
39
  Headers = Strict::Hash.
42
40
  map(Strict::String, Strict::String).
@@ -1,4 +1,5 @@
1
1
  require 'dry/initializer'
2
+ require 'web_pipe/types'
2
3
  require 'web_pipe/dsl/class_context'
3
4
  require 'web_pipe/dsl/instance_methods'
4
5
 
@@ -8,10 +9,10 @@ module WebPipe
8
9
  # extends a {ClassContext} instance and includes
9
10
  # {InstanceMethods}.
10
11
  #
11
- # @private
12
+ # @api private
12
13
  class Builder < Module
13
14
  # Container with nothing registered.
14
- EMPTY_CONTAINER = {}.freeze
15
+ EMPTY_CONTAINER = Types::EMPTY_HASH
15
16
 
16
17
  # @!attribute [r] container
17
18
  # @return [Types::Container[]]
@@ -15,7 +15,7 @@ module WebPipe
15
15
  # that are meant to be class methods in the pipe are defined as
16
16
  # singleton methods of the instance.
17
17
  #
18
- # @private
18
+ # @api private
19
19
  class ClassContext < Module
20
20
  # Methods to be imported from the {DSLContext}.
21
21
  DSL_METHODS = %i[middlewares use plugs plug].freeze
@@ -10,7 +10,7 @@ module WebPipe
10
10
  # This allows adding rack middlewares and plugs at the class
11
11
  # definition level.
12
12
  #
13
- # @private
13
+ # @api private
14
14
  class DSLContext
15
15
  # @!attribute middlewares
16
16
  # @return [Array<Rack::Middleware>]
@@ -17,10 +17,10 @@ module WebPipe
17
17
  # The pipe state can be accessed through the pipe class, which
18
18
  # has been configured through {ClassContext}.
19
19
  #
20
- # @private
20
+ # @api private
21
21
  module InstanceMethods
22
22
  # No injections at all.
23
- EMPTY_INJECTIONS = {}.freeze
23
+ EMPTY_INJECTIONS = Types::EMPTY_HASH
24
24
 
25
25
  # Type for how plugs should be injected.
26
26
  Injections = Types::Strict::Hash.map(Plug::Name, Plug::Spec)
@@ -0,0 +1,156 @@
1
+ require 'web_pipe/types'
2
+ require 'web_pipe/conn'
3
+ require 'dry/view'
4
+
5
+ module WebPipe
6
+ # Integration with `dry-view` rendering system.
7
+ #
8
+ # This extensions adds a {#view} method to {WebPipe::Conn} which
9
+ # sets the string output of a `dry-view` view as response body.
10
+ #
11
+ # @example
12
+ # WebPipe.load_extensions(:dry_view)
13
+ #
14
+ # class SayHelloView < Dry::View
15
+ # config.paths = [File.join(__dir__, '..', 'templates')]
16
+ # config.template = 'say_hello'
17
+ #
18
+ # expose :name
19
+ # end
20
+ #
21
+ # class App
22
+ # include WebPipe
23
+ #
24
+ # plug :render
25
+ #
26
+ # def render(conn)
27
+ # conn.view(SayHello.new, name: 'Joe')
28
+ # end
29
+ # end
30
+ #
31
+ # If {WebPipe::Conn#bag} has a `:container` key, the view instance
32
+ # can be resolved from it. {WebPipe::Plugs::Container} can be used
33
+ # to streamline this integration.
34
+ #
35
+ # @example
36
+ # class App
37
+ # include WebPipe
38
+ #
39
+ # Container = { 'views.say_hello' => SayHelloView.new }.freeze
40
+ #
41
+ # plug :container, with: WebPipe::Plugs::Container[Container]
42
+ # plug :render
43
+ #
44
+ # def render(conn)
45
+ # conn.view('views.say_hello', name: 'Joe')
46
+ # end
47
+ # end
48
+ #
49
+ # Context ({Dry::View::Context}) for the view can be set explicetly
50
+ # through the `context:` argument, as in a standard call to
51
+ # {Dry::View#call}. However, it is possible to leverage configured
52
+ # default context while still being able to inject request specific
53
+ # context. For that to work, a key `:view_context` should be present
54
+ # in {WebPipe::Conn#bag}. It must be equal to a hash which will be
55
+ # passed to {Dry::View::Context#with} to create the final context:
56
+ #
57
+ # @example
58
+ # class MyContext < Dry::View::Context
59
+ # attr_reader :current_path
60
+ #
61
+ # def initialize(current_path: nil, **options)
62
+ # @current_path = current_path
63
+ # super
64
+ # end
65
+ # end
66
+ #
67
+ # class SayHelloView < Dry::View
68
+ # config.paths = [File.join(__dir__, '..', 'templates')]
69
+ # config.template = 'say_hello'
70
+ # config.default_context = MyContext.new
71
+ #
72
+ # expose :name
73
+ # end
74
+ #
75
+ # class App
76
+ # include WebPipe
77
+ #
78
+ # plug :set_view_context
79
+ # plug :render
80
+ #
81
+ # def set_view_context(conn)
82
+ # conn.put(:view_context, { current_path: conn.full_path })
83
+ # end
84
+ #
85
+ # def render(conn)
86
+ # conn.view(SayHelloView.new, name: 'Joe') # `current_path`
87
+ # # will be available in the view scope
88
+ # end
89
+ # end
90
+ #
91
+ # It can be streamline using {WebPipe::Plugs::ViewContext} plug,
92
+ # which accepts a callable object which should return the request
93
+ # context from given {WebPipe::Conn}:
94
+ #
95
+ # @example
96
+ # # ...
97
+ # plug :set_view_context, WebPipe::Plugs::ViewContext[
98
+ # ->(conn) { { current_path: conn.full_path } }
99
+ # ]
100
+ # # ...
101
+ #
102
+ # @see https://dry-rb.org/gems/dry-view/
103
+ class Conn < Dry::Struct
104
+ # Where to find in {#bag} request's view context
105
+ VIEW_CONTEXT_KEY = :view_context
106
+
107
+ # Default request's view context
108
+ DEFAULT_VIEW_CONTEXT = Types::EMPTY_HASH
109
+
110
+ # Sets string output of a view as response body.
111
+ #
112
+ # If the view is not a {Dry::View} instance, it is resolved from
113
+ # the configured container.
114
+ #
115
+ # `kwargs` is used as the input for the view (the arguments that
116
+ # {Dry::View#call} receives). If they doesn't contain an explicit
117
+ # `context:` key, it can be added through the injection injection
118
+ # of what is present in bag's `:view_context`.(see
119
+ # {Dry::View::Context#with}).
120
+ #
121
+ # @param view_spec [Dry::View, Any]
122
+ # @param kwargs [Hash] Arguments to pass along to `Dry::View#call`
123
+ #
124
+ # @return WebPipe::Conn
125
+ def view(view_spec, **kwargs)
126
+ view_instance = view_instance(view_spec)
127
+ view_input = view_input(kwargs, view_instance)
128
+
129
+ set_response_body(
130
+ view_instance.call(
131
+ view_input
132
+ ).to_str
133
+ )
134
+ end
135
+
136
+ private
137
+
138
+ def view_instance(view_spec)
139
+ return view_spec if view_spec.is_a?(Dry::View)
140
+
141
+ fetch(:container)[view_spec]
142
+ end
143
+
144
+ def view_input(kwargs, view_instance)
145
+ return kwargs if kwargs.key?(:context)
146
+
147
+ context = view_instance.
148
+ config.
149
+ default_context.
150
+ with(
151
+ fetch(VIEW_CONTEXT_KEY, DEFAULT_VIEW_CONTEXT)
152
+ )
153
+ kwargs.merge(context: context)
154
+ end
155
+ end
156
+ end
@@ -0,0 +1,38 @@
1
+ require 'web_pipe/types'
2
+ require 'web_pipe/extensions/dry_view/dry_view'
3
+
4
+ module WebPipe
5
+ module Plugs
6
+ # Calls object with conn and puts the result into bag's `:view_context`.
7
+ #
8
+ # This is meant to contain a Proc which will be called with the same
9
+ # {WebPipe::Conn} instance of the operation. It must return
10
+ # request specific view context as a hash. Ultimately, this will
11
+ # be provided to {Dry::View::Context#with} before passing the
12
+ # result along to the view instance.
13
+ #
14
+ # @example
15
+ # class App
16
+ # include WebPipe
17
+ #
18
+ # ViewContext = (conn) -> { { current_path: conn.full_path } }
19
+ #
20
+ # plug :view_context, with: WebPipe::Plugs::ViewContext[ViewContext]
21
+ # plug :render
22
+ #
23
+ # def render
24
+ # view(MyView.new)
25
+ # end
26
+ # end
27
+ #
28
+ # @see WebPipe::Conn#view
29
+ module ViewContext
30
+ def self.[](view_context_proc)
31
+ Types.Interface(:call)[view_context_proc]
32
+ lambda do |conn|
33
+ conn.put(Conn::VIEW_CONTEXT_KEY, view_context_proc.(conn))
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
data/lib/web_pipe/plug.rb CHANGED
@@ -16,7 +16,7 @@ module WebPipe
16
16
  # - Otherwise, spec is taken as the key to resolve the operation
17
17
  # from the `container`.
18
18
  #
19
- # @private
19
+ # @api private
20
20
  class Plug
21
21
  # Error raised when no operation can be resolved from a {Spec}.
22
22
  class InvalidPlugError < ArgumentError
@@ -0,0 +1,5 @@
1
+ module WebPipe
2
+ # Namespace for builders of operations on {WebPipe::Conn}.
3
+ module Plugs
4
+ end
5
+ end
@@ -0,0 +1,31 @@
1
+ require 'web_pipe/types'
2
+
3
+ module WebPipe
4
+ module Plugs
5
+ # Sets a container into bag's `:container` key.
6
+ #
7
+ # Given container is check to respond to `#[]` method, which is
8
+ # meant to be used to resolve dependencies.
9
+ #
10
+ # @example
11
+ # class App
12
+ # include WebPipe
13
+ #
14
+ # Cont = { name: SomeDependency.new }.freeze
15
+ #
16
+ # plug :container, with: WebPipe::Plugs::Container[Cont]
17
+ # plug :resolve
18
+ #
19
+ # private
20
+ #
21
+ # def resolve(conn)
22
+ # conn.put(:dependency, conn.fetch(:container)[:name])
23
+ # end
24
+ # end
25
+ module Container
26
+ def self.[](container)
27
+ ->(conn) { conn.put(:container, Types::Container[container]) }
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'web_pipe/types'
4
+
5
+ module WebPipe
6
+ module Plugs
7
+ # Sets `Content-Type` response header.
8
+ #
9
+ # @example
10
+ # class App
11
+ # include WebPipe
12
+ #
13
+ # plug :html, with: WebPipe::Plugs::ContentType['text/html']
14
+ # end
15
+ module ContentType
16
+ # Content-Type header
17
+ HEADER = 'Content-Type'
18
+
19
+ def self.[](content_type)
20
+ ->(conn) { conn.add_response_header(HEADER, content_type) }
21
+ end
22
+ end
23
+ end
24
+ end
@@ -7,13 +7,13 @@ module WebPipe
7
7
  module Rack
8
8
  # Helper to build and call a rack application with middlewares.
9
9
  #
10
- # @private
10
+ # @api private
11
11
  class AppWithMiddlewares
12
12
  # Type for a rack application.
13
13
  #
14
14
  # It should be something callable accepting a rack env and
15
15
  # returning a rack response.
16
- App = Types.Contract(:call)
16
+ App = Types.Interface(:call)
17
17
 
18
18
  # @!attribute [r] rack_middlewares
19
19
  # @return [Array<RackMiddleware>]
@@ -1,31 +1,12 @@
1
1
  require 'dry/types'
2
+ require 'dry/core/constants'
2
3
 
3
4
  module WebPipe
4
5
  # Namespace for generic library types.
5
6
  module Types
6
7
  include Dry.Types()
8
+ include Dry::Core::Constants
7
9
 
8
- # Type constructor which validates value fulfills with expected
9
- # methods.
10
- #
11
- # @param methods [Array<Symbols>]
12
- #
13
- # @return [Object] on success
14
- # @raise Dry::Types::CoercionError when value does not respond
15
- # to all the methods.
16
- def self.Contract(*methods)
17
- Constructor(Nominal::Any) do |value|
18
- methods.reduce(value) do |value, method|
19
- if value.respond_to?(method)
20
- value
21
- else
22
- raise NoMethodError, "+#{value.inspect}+ does not respond to +#{method}+"
23
- end
24
- end
25
- end
26
- end
27
-
28
- # Anything which can resolve from a `#[]` method.
29
- Container = Contract(:[])
10
+ Container = Interface(:[])
30
11
  end
31
12
  end
@@ -1,3 +1,3 @@
1
1
  module WebPipe
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
data/web_pipe.gemspec CHANGED
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
37
37
 
38
38
  spec.add_runtime_dependency "rack", "~> 2.0"
39
39
  spec.add_runtime_dependency "dry-monads", "~> 1.2"
40
- spec.add_runtime_dependency "dry-types", "~> 1.0"
40
+ spec.add_runtime_dependency "dry-types", "~> 1.1"
41
41
  spec.add_runtime_dependency "dry-struct", "~> 1.0"
42
42
  spec.add_runtime_dependency "dry-initializer", "~> 3.0"
43
43
 
@@ -45,7 +45,8 @@ Gem::Specification.new do |spec|
45
45
  spec.add_development_dependency "rake", "~> 10.0"
46
46
  spec.add_development_dependency "rspec", "~> 3.0"
47
47
  spec.add_development_dependency "rack-test", "~> 1.1"
48
- spec.add_development_dependency "yard", "~> 0.9"
48
+ spec.add_development_dependency "yard", "~> 0.9", ">= 0.9.20"
49
49
  spec.add_development_dependency "redcarpet", "~> 3.4"
50
50
  spec.add_development_dependency "pry-byebug"
51
+ spec.add_development_dependency "dry-view", "~> 0.7"
51
52
  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.1.0
4
+ version: 0.2.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: 2019-05-07 00:00:00.000000000 Z
11
+ date: 2019-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.0'
47
+ version: '1.1'
48
48
  type: :runtime
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: '1.0'
54
+ version: '1.1'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: dry-struct
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -143,6 +143,9 @@ dependencies:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0.9'
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ version: 0.9.20
146
149
  type: :development
147
150
  prerelease: false
148
151
  version_requirements: !ruby/object:Gem::Requirement
@@ -150,6 +153,9 @@ dependencies:
150
153
  - - "~>"
151
154
  - !ruby/object:Gem::Version
152
155
  version: '0.9'
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ version: 0.9.20
153
159
  - !ruby/object:Gem::Dependency
154
160
  name: redcarpet
155
161
  requirement: !ruby/object:Gem::Requirement
@@ -178,6 +184,20 @@ dependencies:
178
184
  - - ">="
179
185
  - !ruby/object:Gem::Version
180
186
  version: '0'
187
+ - !ruby/object:Gem::Dependency
188
+ name: dry-view
189
+ requirement: !ruby/object:Gem::Requirement
190
+ requirements:
191
+ - - "~>"
192
+ - !ruby/object:Gem::Version
193
+ version: '0.7'
194
+ type: :development
195
+ prerelease: false
196
+ version_requirements: !ruby/object:Gem::Requirement
197
+ requirements:
198
+ - - "~>"
199
+ - !ruby/object:Gem::Version
200
+ version: '0.7'
181
201
  description:
182
202
  email:
183
203
  - marc@lamarciana.com
@@ -208,7 +228,12 @@ files:
208
228
  - lib/web_pipe/dsl/class_context.rb
209
229
  - lib/web_pipe/dsl/dsl_context.rb
210
230
  - lib/web_pipe/dsl/instance_methods.rb
231
+ - lib/web_pipe/extensions/dry_view/dry_view.rb
232
+ - lib/web_pipe/extensions/dry_view/plugs/view_context.rb
211
233
  - lib/web_pipe/plug.rb
234
+ - lib/web_pipe/plugs.rb
235
+ - lib/web_pipe/plugs/container.rb
236
+ - lib/web_pipe/plugs/content_type.rb
212
237
  - lib/web_pipe/rack/app_with_middlewares.rb
213
238
  - lib/web_pipe/rack/middleware.rb
214
239
  - lib/web_pipe/types.rb