dry-web-roda 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c6be6ea6b8d9623e8af79c8f0592ba036523bff362e5d0ab278f273949d38654
4
- data.tar.gz: d02c91f5ce75cb4c8737540d0d6433ad41db9719081a9772920a3f2b8fc0e167
3
+ metadata.gz: de59ba21d0b5c59a9a8292a73bb94b2101d135bb95d906bd560ef9dd625b613e
4
+ data.tar.gz: f8f437a3077df4f3b4dc13e69fe47ca0d3338bdad3283b217b883d3fb8e5e96d
5
5
  SHA512:
6
- metadata.gz: 143aed614b62127210c9338d97adfc5cb96aea5e6eaae4117f05bf9c58a096ac4c65530527643a888237b594c2e40a35854f9264f40716d3107d27050589b46e
7
- data.tar.gz: b68d11fd027f77f61e041d598a65fbf5852ed48ec18c425255a3d51de9c4bfe177cf5332edbff766b8dc1802df5c4572128a3f878209d999684386bc9aa95cba
6
+ metadata.gz: f49bcbf08f9b51f870a1919029251eed84309f2b19e2db9868d784f576ed0b4dd151b6956a8b3bd0ee6a8b47e7803497623b3f6e3d5f644b0380415e3e748c2a
7
+ data.tar.gz: b7a78d5ea09833ef49ffebcf409b0514ef96abee6b56e8548931cc3b2819ac181e5805319036bd26b4d913bf31658375404397ae953a8bbb51334592dc93467b
@@ -1,6 +1,5 @@
1
1
  language: ruby
2
2
  dist: trusty
3
- sudo: false
4
3
  services:
5
4
  - postgresql
6
5
  cache: bundler
@@ -12,16 +11,17 @@ before_script:
12
11
  script:
13
12
  - ./script/ci
14
13
  rvm:
15
- - 2.5.0
16
- - 2.4.3
17
- - 2.3.6
18
- - jruby-9.1.9.0
14
+ - 2.6.2
15
+ - 2.5.5
16
+ - 2.4.5
17
+ - 2.3.8
18
+ - jruby-9.2.6.0
19
19
  env:
20
20
  global:
21
21
  - JRUBY_OPTS='--dev -J-Xmx1024M'
22
22
  matrix:
23
23
  allow_failures:
24
- - rvm: jruby-9.1.9.0
24
+ - rvm: jruby-9.2.6.0
25
25
  notifications:
26
26
  email: false
27
27
  webhooks:
@@ -1,3 +1,14 @@
1
+ # 0.12.0 - 2019-04-16
2
+
3
+ ### Changed
4
+
5
+ - Update generated app to work with latest releases of dry-rb gems, including dry-view 0.7.0 and dry-monitor 0.3.0 (parndt in [#94][pr94])
6
+ - [BREAKING] `view` roda helper now expects the dry-view context object to be registered in the container as `"view_context"` (instead of previous `"view.context"`) (parndt in [#94][pr94])
7
+
8
+ [pr94]: https://github.com/dry-rb/dry-web-roda/pull/94/files
9
+
10
+ [Compare v0.11.0...v0.12.0](https://github.com/dry-rb/dry-web-roda/compare/v0.11.0...v0.12.0)
11
+
1
12
  # 0.11.0 - 2018-02-21
2
13
 
3
14
  ### Changed
data/Gemfile CHANGED
@@ -15,14 +15,14 @@ gem "pg"
15
15
  gem "rom", "~> 4.0"
16
16
  gem "rom-factory", "~> 0.5"
17
17
  gem "rom-sql", "~> 2.1"
18
- gem "dry-matcher", "~> 0.6.0"
19
- gem "dry-monads", "~> 0.3"
18
+ gem "dry-matcher", "~> 0.7"
19
+ gem "dry-monads", "~> 1.2"
20
20
  gem "dry-struct", "~> 0.3"
21
21
  gem "dry-system", "~> 0.9"
22
- gem "dry-transaction", "~> 0.10"
22
+ gem "dry-transaction", "~> 0.13"
23
23
  gem "dry-types", "~> 0.12"
24
24
  gem "dry-validation", "~> 0.11"
25
- gem "dry-view", "~> 0.3"
25
+ gem "dry-view", "~> 0.7"
26
26
  gem "dry-web", "~> 0.8"
27
27
  gem "slim"
28
28
  gem "pry-byebug", platform: :mri
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.add_runtime_dependency "thor", "~> 0.19"
28
28
 
29
29
  spec.add_development_dependency "aruba"
30
- spec.add_development_dependency "bundler", "~> 1.7"
30
+ spec.add_development_dependency "bundler", ">= 1.7"
31
31
  spec.add_development_dependency "rake", "~> 11.0"
32
32
  spec.add_development_dependency "rspec", "~> 3.4"
33
33
  spec.add_development_dependency "capybara", "~> 2.5"
@@ -53,8 +53,8 @@ module Dry
53
53
  add_template('repository.rb.tt', "lib/#{underscored_project_name}/repository.rb")
54
54
  add_template('.keep', 'lib/persistence/relations/.keep')
55
55
  add_template('.keep', 'lib/persistence/commands/.keep')
56
- add_template('view__context.rb.tt', "lib/#{underscored_project_name}/view/context.rb")
57
- add_template('view__controller.rb.tt', "lib/#{underscored_project_name}/view/controller.rb")
56
+ add_template('view_context.rb.tt', "lib/#{underscored_project_name}/view_context.rb")
57
+ add_template('view.rb.tt', "lib/#{underscored_project_name}/view.rb")
58
58
  end
59
59
 
60
60
  def add_log
@@ -34,8 +34,8 @@ module Dry
34
34
  end
35
35
 
36
36
  def add_lib
37
- add_template('subapp/view__context.rb.tt', "#{lib_path}/view/context.rb")
38
- add_template('subapp/view__controller.rb.tt', "#{lib_path}/view/controller.rb")
37
+ add_template('subapp/view_context.rb.tt', "#{lib_path}/view_context.rb")
38
+ add_template('subapp/view.rb.tt', "#{lib_path}/view.rb")
39
39
  add_template('subapp/welcome.rb.tt', "#{lib_path}/views/welcome.rb")
40
40
  end
41
41
 
@@ -10,7 +10,6 @@ gem "puma"
10
10
  gem "rack_csrf"
11
11
 
12
12
  gem "rack", ">= 2.0"
13
- gem "rerun"
14
13
 
15
14
  # Database persistence
16
15
  gem "pg"
@@ -18,19 +17,23 @@ gem "rom", "~> 4.0"
18
17
  gem "rom-sql", "~> 2.1"
19
18
 
20
19
  # Application dependencies
21
- gem "dry-matcher", "~> 0.6.0"
22
- gem "dry-monads", "~> 0.3"
20
+ gem "dry-matcher", "~> 0.7"
21
+ gem "dry-monads", "~> 1.2"
23
22
  gem "dry-struct", "~> 0.3"
24
- gem "dry-transaction", "~> 0.10"
23
+ gem "dry-transaction", "~> 0.13"
25
24
  gem "dry-types", "~> 0.12"
26
25
  gem "dry-validation", "~> 0.11"
27
- gem "dry-view", "~> 0.4"
26
+ gem "dry-view", "~> 0.7"
28
27
  gem "slim"
29
28
 
30
29
  group :development, :test do
31
30
  gem "pry-byebug", platform: :mri
32
31
  end
33
32
 
33
+ group :development do
34
+ gem "rerun"
35
+ end
36
+
34
37
  group :test do
35
38
  gem "capybara"
36
39
  gem "capybara-screenshot"
@@ -1,5 +1,7 @@
1
1
  require "dry/web/container"
2
2
  require "dry/system/components"
3
+ require 'dry-monitor'
4
+ Dry::Monitor.load_extensions(:rack)
3
5
 
4
6
  module <%= config[:camel_cased_app_name] %>
5
7
  class Container < Dry::Web::Container
@@ -11,19 +11,21 @@ module <%= config[:camel_cased_app_name] %>
11
11
  opts[:root] = Pathname(__FILE__).join("../..").realpath.dirname
12
12
 
13
13
  use Rack::Session::Cookie, key: "<%= config[:underscored_project_name] %>.session", secret: self["settings"].session_secret
14
+ use Rack::MethodOverride
14
15
 
15
16
  plugin :csrf, raise: true
16
17
  plugin :dry_view
17
18
  plugin :error_handler
18
19
  plugin :flash
19
20
  plugin :multi_route
21
+ plugin :all_verbs
20
22
 
21
23
  route do |r|
22
24
  # Enable this after writing your first web/routes/ file
23
25
  # r.multi_route
24
26
 
25
27
  r.root do
26
- r.view "welcome"
28
+ r.view :welcome
27
29
  end
28
30
  end
29
31
 
@@ -1,6 +1,7 @@
1
1
  <%= config[:camel_cased_app_name] %>::Container.boot :monitor do
2
2
  init do
3
3
  require "dry/monitor"
4
+ Dry::Monitor.load_extensions(:sql)
4
5
  end
5
6
 
6
7
  start do
@@ -0,0 +1,17 @@
1
+ # auto_register: false
2
+
3
+ require "slim"
4
+ require "dry/view"
5
+ require "<%= config[:underscored_umbrella_name] %>/<%= config[:underscored_project_name] %>/container"
6
+
7
+ module <%= config[:camel_cased_umbrella_name] %>
8
+ module <%= config[:camel_cased_app_name] %>
9
+ class View < Dry::View
10
+ configure do |config|
11
+ config.paths = [Container.root.join("web/templates")]
12
+ config.default_context = Container["view_context"]
13
+ config.layout = "application"
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,8 @@
1
+ require "<%= config[:underscored_umbrella_name] %>/view_context"
2
+
3
+ module <%= config[:camel_cased_umbrella_name] %>
4
+ module <%= config[:camel_cased_app_name] %>
5
+ class ViewContext < <%= config[:camel_cased_umbrella_name] %>::ViewContext
6
+ end
7
+ end
8
+ end
@@ -12,19 +12,21 @@ module <%= config[:camel_cased_umbrella_name] %>
12
12
  opts[:root] = Pathname(__FILE__).join("../../..").realpath.dirname
13
13
 
14
14
  use Rack::Session::Cookie, key: "<%= config[:underscored_umbrella_name] %>.<%= config[:underscored_project_name] %>.session", secret: self["core.settings"].session_secret
15
+ use Rack::MethodOverride
15
16
 
16
17
  plugin :csrf, raise: true
17
18
  plugin :dry_view
18
19
  plugin :error_handler
19
20
  plugin :flash
20
21
  plugin :multi_route
22
+ plugin :all_verbs
21
23
 
22
24
  route do |r|
23
25
  # Enable this after writing your first web/routes/ file
24
26
  # r.multi_route
25
27
 
26
28
  r.root do
27
- r.view "welcome"
29
+ r.view :welcome
28
30
  end
29
31
  end
30
32
 
@@ -1,9 +1,9 @@
1
- require "<%= config[:underscored_umbrella_name] %>/<%= config[:underscored_project_name] %>/view/controller"
1
+ require "<%= config[:underscored_umbrella_name] %>/<%= config[:underscored_project_name] %>/view"
2
2
 
3
3
  module <%= config[:camel_cased_umbrella_name] %>
4
4
  module <%= config[:camel_cased_app_name] %>
5
5
  module Views
6
- class Welcome < View::Controller
6
+ class Welcome < View
7
7
  configure do |config|
8
8
  config.template = "welcome"
9
9
  end
@@ -0,0 +1,15 @@
1
+ # auto_register: false
2
+
3
+ require "slim"
4
+ require "dry/view"
5
+ require "<%= config[:underscored_project_name] %>/container"
6
+
7
+ module <%= config[:camel_cased_app_name] %>
8
+ class View < Dry::View
9
+ configure do |config|
10
+ config.paths = [Container.root.join("web/templates")]
11
+ config.default_context = Container["view_context"]
12
+ config.layout = "application"
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,31 @@
1
+ require "dry/view/context"
2
+
3
+ module <%= config[:camel_cased_app_name] %>
4
+ class ViewContext < Dry::View::Context
5
+ def csrf_token
6
+ self[:csrf_token]
7
+ end
8
+
9
+ def csrf_metatag
10
+ self[:csrf_metatag]
11
+ end
12
+
13
+ def csrf_tag
14
+ self[:csrf_tag]
15
+ end
16
+
17
+ def flash
18
+ self[:flash]
19
+ end
20
+
21
+ def flash?
22
+ %i[notice alert].any? { |type| flash[type] }
23
+ end
24
+
25
+ private
26
+
27
+ def [](name)
28
+ _options.fetch(name)
29
+ end
30
+ end
31
+ end
@@ -1,8 +1,8 @@
1
- require "<%= config[:underscored_project_name] %>/view/controller"
1
+ require "<%= config[:underscored_project_name] %>/view"
2
2
 
3
3
  module <%= config[:camel_cased_app_name] %>
4
4
  module Views
5
- class Welcome < <%= config[:camel_cased_app_name] %>::View::Controller
5
+ class Welcome < <%= config[:camel_cased_app_name] %>::View
6
6
  configure do |config|
7
7
  config.template = "welcome"
8
8
  end
@@ -1,7 +1,7 @@
1
1
  module Dry
2
2
  module Web
3
3
  module Roda
4
- VERSION = "0.11.0".freeze
4
+ VERSION = "0.12.0".freeze
5
5
  end
6
6
  end
7
7
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Roda
2
4
  module RodaPlugins
3
5
  module DryView
@@ -7,7 +9,7 @@ class Roda
7
9
 
8
10
  module InstanceMethods
9
11
  def view_context
10
- self.class["view.context"].with(view_context_options)
12
+ self.class["view_context"].with(view_context_options)
11
13
  end
12
14
 
13
15
  def view_context_options
@@ -21,8 +23,9 @@ class Roda
21
23
 
22
24
  module RequestMethods
23
25
  def view(name, options = {})
24
- options = {context: scope.view_context}.merge(options)
25
- on to: scope.view_key(name), call_with: [options]
26
+ resolve(scope.view_key(name)) do |renderer|
27
+ renderer.call({ context: scope.view_context }.merge(options)).to_s
28
+ end
26
29
  end
27
30
  end
28
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-web-roda
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Solnica
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-02-20 00:00:00.000000000 Z
11
+ date: 2019-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-configurable
@@ -98,14 +98,14 @@ dependencies:
98
98
  name: bundler
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '1.7'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '1.7'
111
111
  - !ruby/object:Gem::Dependency
@@ -229,15 +229,15 @@ files:
229
229
  - lib/dry/web/roda/templates/subapp/container.rb.tt
230
230
  - lib/dry/web/roda/templates/subapp/example_routes.rb.tt
231
231
  - lib/dry/web/roda/templates/subapp/import.rb.tt
232
- - lib/dry/web/roda/templates/subapp/view__context.rb.tt
233
- - lib/dry/web/roda/templates/subapp/view__controller.rb.tt
232
+ - lib/dry/web/roda/templates/subapp/view.rb.tt
233
+ - lib/dry/web/roda/templates/subapp/view_context.rb.tt
234
234
  - lib/dry/web/roda/templates/subapp/web.rb.tt
235
235
  - lib/dry/web/roda/templates/subapp/welcome.rb.tt
236
236
  - lib/dry/web/roda/templates/types.rb
237
237
  - lib/dry/web/roda/templates/umbrella_project/boot.rb.tt
238
238
  - lib/dry/web/roda/templates/umbrella_project/web.rb.tt
239
- - lib/dry/web/roda/templates/view__context.rb.tt
240
- - lib/dry/web/roda/templates/view__controller.rb.tt
239
+ - lib/dry/web/roda/templates/view.rb.tt
240
+ - lib/dry/web/roda/templates/view_context.rb.tt
241
241
  - lib/dry/web/roda/templates/welcome.html.slim
242
242
  - lib/dry/web/roda/templates/welcome.rb.tt
243
243
  - lib/dry/web/roda/version.rb
@@ -276,8 +276,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
276
276
  - !ruby/object:Gem::Version
277
277
  version: '0'
278
278
  requirements: []
279
- rubyforge_project:
280
- rubygems_version: 2.7.5
279
+ rubygems_version: 3.0.3
281
280
  signing_key:
282
281
  specification_version: 4
283
282
  summary: Roda integration for dry-web apps
@@ -1,10 +0,0 @@
1
- require "<%= config[:underscored_umbrella_name] %>/view/context"
2
-
3
- module <%= config[:camel_cased_umbrella_name] %>
4
- module <%= config[:camel_cased_app_name] %>
5
- module View
6
- class Context < <%= config[:camel_cased_umbrella_name] %>::View::Context
7
- end
8
- end
9
- end
10
- end
@@ -1,19 +0,0 @@
1
- # auto_register: false
2
-
3
- require "slim"
4
- require "dry/view/controller"
5
- require "<%= config[:underscored_umbrella_name] %>/<%= config[:underscored_project_name] %>/container"
6
-
7
- module <%= config[:camel_cased_umbrella_name] %>
8
- module <%= config[:camel_cased_app_name] %>
9
- module View
10
- class Controller < Dry::View::Controller
11
- configure do |config|
12
- config.paths = [Container.root.join("web/templates")]
13
- config.context = Container["view.context"]
14
- config.layout = "application"
15
- end
16
- end
17
- end
18
- end
19
- end
@@ -1,41 +0,0 @@
1
- module <%= config[:camel_cased_app_name] %>
2
- module View
3
- class Context
4
- attr_reader :attrs
5
-
6
- def initialize(attrs = {})
7
- @attrs = attrs
8
- end
9
-
10
- def csrf_token
11
- self[:csrf_token]
12
- end
13
-
14
- def csrf_metatag
15
- self[:csrf_metatag]
16
- end
17
-
18
- def csrf_tag
19
- self[:csrf_tag]
20
- end
21
-
22
- def flash
23
- self[:flash]
24
- end
25
-
26
- def flash?
27
- %i[notice alert].any? { |type| flash[type] }
28
- end
29
-
30
- def with(new_attrs)
31
- self.class.new(attrs.merge(new_attrs))
32
- end
33
-
34
- private
35
-
36
- def [](name)
37
- attrs.fetch(name)
38
- end
39
- end
40
- end
41
- end
@@ -1,17 +0,0 @@
1
- # auto_register: false
2
-
3
- require "slim"
4
- require "dry/view/controller"
5
- require "<%= config[:underscored_project_name] %>/container"
6
-
7
- module <%= config[:camel_cased_app_name] %>
8
- module View
9
- class Controller < Dry::View::Controller
10
- configure do |config|
11
- config.paths = [Container.root.join("web/templates")]
12
- config.context = Container["view.context"]
13
- config.layout = "application"
14
- end
15
- end
16
- end
17
- end