dry-web-roda 0.7.5 → 0.8.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
  SHA1:
3
- metadata.gz: b0b52ca289fcd050c9e5b498b086623693121890
4
- data.tar.gz: ecc6be6cf23f114ae9b1609e1d7a6a3fbfcdf404
3
+ metadata.gz: e348dfce9fa4b251b883b90b61878d6ceee1af35
4
+ data.tar.gz: 2cea77e0744f93b64bee61faae24f6369b213328
5
5
  SHA512:
6
- metadata.gz: 461355ca58d5e379276d622408c7d781cec9fedd28eacc15b678bdb701204c7ed196f5442a100bae6ba188e28e38c7dcbf3830754806d792e15503c04b9150cf
7
- data.tar.gz: d977fe040b436a017212dab9191401af617d14dd11471ae4b26422dd8a1fbcfceeb1667ff2f612a4a2fc978ca5c316772448ade18ca00fe447acedddfbf9881e
6
+ metadata.gz: 5cf1e0afb685e830f0a60a8516188939d744c3ba79c93da3983fe40229eebeb2e2c473880cd4cdc66d99d1394d37e46cb01cfc75e41c8914ca725c8c39078ec1
7
+ data.tar.gz: 4c01ed9ce85496b9daca4a8dfab49b377490017aec8ad4c8cf9020aca368a2fb25abe7c2df5671591ab3d78787a2e05cb2b88f0bcfa418ec6c58d2dfdc215746
@@ -14,7 +14,6 @@ script:
14
14
  rvm:
15
15
  - 2.4.0
16
16
  - 2.3.3
17
- - 2.2.6
18
17
  - jruby-9.1.6.0
19
18
  env:
20
19
  global:
@@ -1,3 +1,14 @@
1
+ # 0.8.0 - 2017-10-26
2
+
3
+ ### Changed
4
+
5
+ In generated projects:
6
+
7
+ - Work with dry-system 0.8 (timriley)
8
+ - Use dry-systems own settings component in `boot/settings.rb` for project configuration (timriley)
9
+ - Rename `:rom` bootable component to `:persistence` so it can be automatically resolved and lazily loaded (timriley)
10
+ - Use rom-rb 4.0 (timriley)
11
+
1
12
  # 0.7.5 - 2017-07-25
2
13
 
3
14
  ### Added
data/Gemfile CHANGED
@@ -7,23 +7,23 @@ gem 'byebug', platform: :mri
7
7
  gem 'codeclimate-test-reporter', platform: :rbx
8
8
 
9
9
  # Generated application dependencies
10
- gem "dry-system", ">= 0.7.1"
11
- gem "dry-web", ">= 0.7.0"
10
+ gem "dry-system", "~> 0.8"
11
+ gem "dry-web", "~> 0.7"
12
12
  gem "puma"
13
13
  gem "rack_csrf"
14
14
  gem "rack", ">= 2.0"
15
15
  gem "shotgun", ">= 0.9.2"
16
16
  gem "pg"
17
- gem "rom-factory"
18
- gem "rom-repository"
19
- gem "rom-sql"
20
- gem "dry-matcher"
21
- gem "dry-monads"
22
- gem "dry-struct"
23
- gem "dry-transaction", ">= 0.10.0"
24
- gem "dry-types"
25
- gem "dry-validation"
26
- gem "dry-view", ">= 0.3.0"
17
+ gem "rom", "~> 4.0"
18
+ gem "rom-factory", "~> 0.5"
19
+ gem "rom-sql", "~> 2.1"
20
+ gem "dry-matcher", "~> 0.6.0"
21
+ gem "dry-monads", "~> 0.3"
22
+ gem "dry-struct", "~> 0.3"
23
+ gem "dry-transaction", "~> 0.10"
24
+ gem "dry-types", "~> 0.12"
25
+ gem "dry-validation", "~> 0.11"
26
+ gem "dry-view", "~> 0.3"
27
27
  gem "slim"
28
28
  gem "pry-byebug", platform: :mri
29
29
  gem "capybara"
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.required_ruby_version = '>= 2.2.0'
21
+ spec.required_ruby_version = '>= 2.3.0'
22
22
 
23
23
  spec.add_runtime_dependency "dry-configurable", "~> 0.2"
24
24
  spec.add_runtime_dependency "inflecto", "~> 0.0"
@@ -94,13 +94,12 @@ module Dry
94
94
  def add_system_lib
95
95
  add_template("container.rb.tt", "system/#{underscored_project_name}/container.rb")
96
96
  add_template("import.rb.tt", "system/#{underscored_project_name}/import.rb")
97
- add_template("settings.rb.tt", "system/#{underscored_project_name}/settings.rb")
98
97
  end
99
98
 
100
99
  def add_system_boot
101
100
  add_template("monitor.rb.tt", "system/boot/monitor.rb")
102
- add_template("rom.rb.tt", "system/boot/rom.rb")
103
- add_template("boot__settings.rb.tt", "system/boot/settings.rb")
101
+ add_template("persistence.rb.tt", "system/boot/persistence.rb")
102
+ add_template("settings.rb.tt", "system/boot/settings.rb")
104
103
  end
105
104
 
106
105
  def add_config_files
@@ -3,9 +3,9 @@ source "https://rubygems.org"
3
3
  gem "rake"
4
4
 
5
5
  # Web framework
6
- gem "dry-system", ">= 0.7.1"
7
- gem "dry-web", ">= 0.7.0"
8
- gem "dry-web-roda", ">= 0.6.0"
6
+ gem "dry-system", "~> 0.8"
7
+ gem "dry-web", "~> 0.7"
8
+ gem "dry-web-roda", "~> 0.7"
9
9
  gem "puma"
10
10
  gem "rack_csrf"
11
11
 
@@ -14,18 +14,17 @@ gem "shotgun", ">= 0.9.2"
14
14
 
15
15
  # Database persistence
16
16
  gem "pg"
17
- gem "rom", ">= 3.1.0"
18
- gem "rom-repository"
19
- gem "rom-sql", ">= 1.1.0"
17
+ gem "rom", "~> 4.0"
18
+ gem "rom-sql", "~> 2.1"
20
19
 
21
20
  # Application dependencies
22
- gem "dry-matcher"
23
- gem "dry-monads"
24
- gem "dry-struct"
25
- gem "dry-transaction", ">= 0.10.0"
26
- gem "dry-types"
27
- gem "dry-validation"
28
- gem "dry-view", ">= 0.3.0"
21
+ gem "dry-matcher", "~> 0.6.0"
22
+ gem "dry-monads", "~> 0.3"
23
+ gem "dry-struct", "~> 0.3"
24
+ gem "dry-transaction", "~> 0.10"
25
+ gem "dry-types", "~> 0.12"
26
+ gem "dry-validation", "~> 0.11"
27
+ gem "dry-view", "~> 0.3"
29
28
  gem "slim"
30
29
 
31
30
  group :development, :test do
@@ -38,5 +37,5 @@ group :test do
38
37
  gem "database_cleaner"
39
38
  gem "poltergeist"
40
39
  gem "rspec"
41
- gem "rom-factory"
40
+ gem "rom-factory", "~> 0.5"
42
41
  end
@@ -6,7 +6,7 @@ Welcome! You’ve generated an app using dry-web-roda.
6
6
 
7
7
  1. Run `bundle`
8
8
  1. Review `.env` & `.env.test` (and make a copy to e.g. `.example.env` if you want example settings checked in)
9
- 1. Create a `blog_development` database
9
+ 1. Run `bundle exec rake db:create`
10
10
  1. Add your own steps to `bin/setup`
11
11
  1. Run the app with `bundle exec shotgun -p 3000 -o 0.0.0.0 config.ru`
12
12
  1. Initialize git with `git init` and make your initial commit
@@ -1,5 +1,5 @@
1
1
  require "bundler/setup"
2
- require "byebug" unless ENV["RACK_ENV"] == "production"
2
+ require "pry-byebug" unless ENV["RACK_ENV"] == "production"
3
3
  require "rom/sql/rake_task"
4
4
  require "shellwords"
5
5
  require_relative "system/<%= config[:underscored_project_name] %>/container"
@@ -35,11 +35,7 @@ end
35
35
 
36
36
  namespace :db do
37
37
  task :setup do
38
- <%= config[:camel_cased_app_name] %>::Container.boot :rom
39
- end
40
-
41
- task :settings do
42
- <%= config[:camel_cased_app_name] %>::Container.boot :settings
38
+ <%= config[:camel_cased_app_name] %>::Container.init :persistence
43
39
  end
44
40
 
45
41
  desc "Print current database schema version"
@@ -55,7 +51,7 @@ namespace :db do
55
51
  end
56
52
 
57
53
  desc "Create database"
58
- task create: :settings do
54
+ task :create do
59
55
  if system("which createdb", out: File::NULL)
60
56
  uri = database_uri
61
57
  system(postgres_env_vars(uri), "createdb #{Shellwords.escape(uri.path[1..-1])}")
@@ -66,7 +62,7 @@ namespace :db do
66
62
  end
67
63
 
68
64
  desc "Drop database"
69
- task drop: :settings do
65
+ task :drop do
70
66
  if system("which dropdb", out: File::NULL)
71
67
  uri = database_uri
72
68
  system(postgres_env_vars(uri), "dropdb #{Shellwords.escape(uri.path[1..-1])}")
@@ -1,4 +1,5 @@
1
1
  require "dry/web/container"
2
+ require "dry/system/components"
2
3
 
3
4
  module <%= config[:camel_cased_app_name] %>
4
5
  class Container < Dry::Web::Container
@@ -1,4 +1,4 @@
1
- <%= config[:camel_cased_app_name] %>::Container.finalize :monitor do |_container|
1
+ <%= config[:camel_cased_app_name] %>::Container.boot :monitor do
2
2
  init do
3
3
  require "dry/monitor"
4
4
  end
@@ -0,0 +1,36 @@
1
+ <%= config[:camel_cased_app_name] %>::Container.boot :persistence, namespace: true do |system|
2
+ init do
3
+ require "sequel"
4
+ require "rom"
5
+ require "rom/sql"
6
+
7
+ use :monitor, :settings
8
+
9
+ ROM::SQL.load_extensions :postgres
10
+
11
+ Sequel.database_timezone = :utc
12
+ Sequel.application_timezone = :local
13
+
14
+ rom_config = ROM::Configuration.new(
15
+ :sql,
16
+ system[:settings].database_url,
17
+ extensions: %i[error_sql pg_array pg_json],
18
+ )
19
+
20
+ rom_config.plugin :sql, relations: :instrumentation do |plugin_config|
21
+ plugin_config.notifications = notifications
22
+ end
23
+
24
+ rom_config.plugin :sql, relations: :auto_restrictions
25
+
26
+ register "config", rom_config
27
+ register "db", rom_config.gateways[:default].connection
28
+ end
29
+
30
+ start do
31
+ config = container["persistence.config"]
32
+ config.auto_registration system.root.join("lib/persistence")
33
+
34
+ register "rom", ROM.container(config)
35
+ end
36
+ end
@@ -4,8 +4,6 @@ require "rom-repository"
4
4
  require "<%= config[:underscored_project_name] %>/container"
5
5
  require "<%= config[:underscored_project_name] %>/import"
6
6
 
7
- <%= config[:camel_cased_app_name] %>::Container.boot! :rom
8
-
9
7
  module <%= config[:camel_cased_app_name] %>
10
8
  class Repository < ROM::Repository::Root
11
9
  include <%= config[:camel_cased_app_name] %>::Import.args["persistence.rom"]
@@ -1,9 +1,10 @@
1
- require "dry/web/settings"
2
- require "types"
1
+ <%= config[:camel_cased_app_name] %>::Container.boot :settings, from: :system do
2
+ before :init do
3
+ ::Kernel.require "types"
4
+ end
3
5
 
4
- module <%= config[:camel_cased_app_name] %>
5
- class Settings < Dry::Web::Settings
6
- setting :database_url, Types::Strict::String.constrained(filled: true)
7
- setting :session_secret, Types::Strict::String.constrained(filled: true)
6
+ settings do
7
+ key :session_secret, Types::Strict::String.constrained(filled: true)
8
+ key :database_url, Types::Strict::String.constrained(filled: true)
8
9
  end
9
10
  end
@@ -1,6 +1,6 @@
1
1
  require_relative "spec_helper"
2
2
 
3
- <%= config[:camel_cased_app_name] %>::Container.boot! :rom
3
+ <%= config[:camel_cased_app_name] %>::Container.start :persistence
4
4
 
5
5
  Dir[SPEC_ROOT.join("support/db/*.rb").to_s].each(&method(:require))
6
6
  Dir[SPEC_ROOT.join("shared/db/*.rb").to_s].each(&method(:require))
@@ -1,5 +1,6 @@
1
1
  require "pathname"
2
2
  require "dry/web/container"
3
+ require "dry/system/components"
3
4
 
4
5
  module <%= config[:camel_cased_app_name] %>
5
6
  class Container < Dry::Web::Container
@@ -1,5 +1,3 @@
1
- # auto_register: false
2
-
3
1
  module <%= config[:camel_cased_app_name] %>
4
2
  module View
5
3
  class Context
@@ -1,7 +1,7 @@
1
1
  module Dry
2
2
  module Web
3
3
  module Roda
4
- VERSION = "0.7.5".freeze
4
+ VERSION = "0.8.0".freeze
5
5
  end
6
6
  end
7
7
  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.7.5
4
+ version: 0.8.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: 2017-07-25 00:00:00.000000000 Z
11
+ date: 2017-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-configurable
@@ -203,7 +203,6 @@ files:
203
203
  - lib/dry/web/roda/templates/README.md.tt
204
204
  - lib/dry/web/roda/templates/Rakefile.tt
205
205
  - lib/dry/web/roda/templates/application.html.slim
206
- - lib/dry/web/roda/templates/boot__settings.rb.tt
207
206
  - lib/dry/web/roda/templates/config.ru.tt
208
207
  - lib/dry/web/roda/templates/console.tt
209
208
  - lib/dry/web/roda/templates/container.rb.tt
@@ -213,8 +212,8 @@ files:
213
212
  - lib/dry/web/roda/templates/import.rb.tt
214
213
  - lib/dry/web/roda/templates/monitor.rb.tt
215
214
  - lib/dry/web/roda/templates/operation.rb.tt
215
+ - lib/dry/web/roda/templates/persistence.rb.tt
216
216
  - lib/dry/web/roda/templates/repository.rb.tt
217
- - lib/dry/web/roda/templates/rom.rb.tt
218
217
  - lib/dry/web/roda/templates/sample_data.rb
219
218
  - lib/dry/web/roda/templates/seed.rb
220
219
  - lib/dry/web/roda/templates/settings.rb.tt
@@ -268,7 +267,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
268
267
  requirements:
269
268
  - - ">="
270
269
  - !ruby/object:Gem::Version
271
- version: 2.2.0
270
+ version: 2.3.0
272
271
  required_rubygems_version: !ruby/object:Gem::Requirement
273
272
  requirements:
274
273
  - - ">="
@@ -276,7 +275,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
276
275
  version: '0'
277
276
  requirements: []
278
277
  rubyforge_project:
279
- rubygems_version: 2.6.9
278
+ rubygems_version: 2.6.11
280
279
  signing_key:
281
280
  specification_version: 4
282
281
  summary: Roda integration for dry-web apps
@@ -1,10 +0,0 @@
1
- <%= config[:camel_cased_app_name] %>::Container.finalize :settings do |container|
2
- init do
3
- require "<%= config[:underscored_project_name] %>/settings"
4
- end
5
-
6
- start do
7
- settings = <%= config[:camel_cased_app_name] %>::Settings.load(container.config.root, container.config.env)
8
- container.register "settings", settings
9
- end
10
- end
@@ -1,39 +0,0 @@
1
- <%= config[:camel_cased_app_name] %>::Container.namespace "persistence" do |container|
2
- container.finalize :rom do
3
- init do
4
- require "sequel"
5
- require "rom"
6
- require "rom/sql"
7
-
8
- use :settings
9
- use :monitor
10
-
11
- ROM::SQL.load_extensions :postgres
12
-
13
- Sequel.database_timezone = :utc
14
- Sequel.application_timezone = :local
15
-
16
- rom_config = ROM::Configuration.new(
17
- :sql,
18
- container["settings"].database_url,
19
- extensions: %i[error_sql pg_array pg_json],
20
- )
21
-
22
- rom_config.plugin :sql, relations: :instrumentation do |plugin_config|
23
- plugin_config.notifications = notifications
24
- end
25
-
26
- rom_config.plugin :sql, relations: :auto_restrictions
27
-
28
- container.register "config", rom_config
29
- container.register "db", rom_config.gateways[:default].connection
30
- end
31
-
32
- start do
33
- config = container["persistence.config"]
34
- config.auto_registration container.root.join("lib/persistence")
35
-
36
- container.register "rom", ROM.container(config)
37
- end
38
- end
39
- end