dry-web-roda 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +7 -1
- data/.rspec +1 -2
- data/.travis.yml +14 -8
- data/CHANGELOG.md +22 -0
- data/Gemfile +26 -15
- data/README.md +22 -4
- data/dry-web-roda.gemspec +3 -1
- data/lib/dry/web/roda/application.rb +3 -3
- data/lib/dry/web/roda/cli.rb +9 -2
- data/lib/dry/web/roda/cli/generate.rb +4 -4
- data/lib/dry/web/roda/generators/flat_project.rb +31 -0
- data/lib/dry/web/roda/generators/{app.rb → sub_app.rb} +2 -2
- data/lib/dry/web/roda/generators/{umbrella.rb → umbrella_project.rb} +6 -6
- data/lib/dry/web/roda/skeletons/{umbrella → flat_project}/Gemfile +3 -3
- data/lib/dry/web/roda/skeletons/{umbrella → flat_project}/README.md.tt +0 -0
- data/lib/dry/web/roda/skeletons/{umbrella → flat_project}/Rakefile.tt +0 -0
- data/lib/dry/web/roda/skeletons/{umbrella → flat_project}/bin/console.tt +0 -0
- data/lib/dry/web/roda/skeletons/{umbrella → flat_project}/bin/setup +0 -0
- data/lib/dry/web/roda/skeletons/{umbrella → flat_project}/config.ru.tt +0 -0
- data/lib/dry/web/roda/skeletons/{umbrella → flat_project}/config/settings.yml.tt +0 -0
- data/lib/dry/web/roda/skeletons/{umbrella → flat_project}/db/sample_data.rb +0 -0
- data/lib/dry/web/roda/skeletons/{umbrella → flat_project}/db/seed.rb +0 -0
- data/lib/dry/web/roda/skeletons/{app → flat_project}/lib/__underscored_app_name__/.keep +0 -0
- data/lib/dry/web/roda/skeletons/{app → flat_project}/lib/__underscored_app_name__/views/welcome.rb.tt +0 -0
- data/lib/dry/web/roda/skeletons/{umbrella → flat_project}/lib/persistence/commands/.keep +0 -0
- data/lib/dry/web/roda/skeletons/{umbrella → flat_project}/lib/persistence/relations/.keep +0 -0
- data/lib/dry/web/roda/skeletons/flat_project/lib/rom/instrumentation.rb.tt +22 -0
- data/lib/dry/web/roda/skeletons/{umbrella → flat_project}/lib/types.rb +0 -0
- data/lib/dry/web/roda/skeletons/{umbrella → flat_project}/log/.keep +0 -0
- data/lib/dry/web/roda/skeletons/{umbrella → flat_project}/spec/app_helper.rb +0 -0
- data/lib/dry/web/roda/skeletons/{umbrella → flat_project}/spec/db_helper.rb.tt +0 -0
- data/lib/dry/web/roda/skeletons/{umbrella → flat_project}/spec/spec_helper.rb.tt +0 -0
- data/lib/dry/web/roda/skeletons/{umbrella → flat_project}/spec/support/db/test_factories.rb +0 -0
- data/lib/dry/web/roda/skeletons/{umbrella → flat_project}/spec/support/test_helpers.rb.tt +0 -0
- data/lib/dry/web/roda/skeletons/flat_project/system/__underscored_app_name__/application.rb.tt +29 -0
- data/lib/dry/web/roda/skeletons/flat_project/system/__underscored_app_name__/container.rb.tt +23 -0
- data/lib/dry/web/roda/skeletons/{app → flat_project}/system/__underscored_app_name__/import.rb.tt +0 -0
- data/lib/dry/web/roda/skeletons/{umbrella/lib → flat_project/system}/__underscored_app_name__/repository.rb.tt +0 -0
- data/lib/dry/web/roda/skeletons/{umbrella → flat_project}/system/__underscored_app_name__/settings.rb.tt +0 -0
- data/lib/dry/web/roda/skeletons/flat_project/system/__underscored_app_name__/transactions.rb.tt +34 -0
- data/lib/dry/web/roda/skeletons/{umbrella/lib → flat_project/system}/__underscored_app_name__/view_context.rb.tt +0 -0
- data/lib/dry/web/roda/skeletons/{app → flat_project}/system/__underscored_app_name__/view_controller.rb.tt +0 -0
- data/lib/dry/web/roda/skeletons/flat_project/system/boot.rb.tt +11 -0
- data/lib/dry/web/roda/skeletons/flat_project/system/boot/monitor.rb.tt +10 -0
- data/lib/dry/web/roda/skeletons/{umbrella → flat_project}/system/boot/rom.rb.tt +0 -0
- data/lib/dry/web/roda/skeletons/{app → flat_project}/system/boot/view.rb.tt +0 -0
- data/lib/dry/web/roda/skeletons/flat_project/transactions/example.rb.tt +10 -0
- data/lib/dry/web/roda/skeletons/{app → flat_project}/web/routes/example.rb.tt +0 -0
- data/lib/dry/web/roda/skeletons/{app → flat_project}/web/templates/layouts/application.html.slim +0 -0
- data/lib/dry/web/roda/skeletons/{app → flat_project}/web/templates/welcome.html.slim +0 -0
- data/lib/dry/web/roda/skeletons/sub_app/lib/__underscored_app_name__/.keep +0 -0
- data/lib/dry/web/roda/skeletons/sub_app/lib/__underscored_app_name__/views/welcome.rb.tt +11 -0
- data/lib/dry/web/roda/skeletons/{app → sub_app}/system/__underscored_app_name__/application.rb.tt +1 -1
- data/lib/dry/web/roda/skeletons/{app → sub_app}/system/__underscored_app_name__/container.rb.tt +2 -0
- data/lib/dry/web/roda/skeletons/{umbrella → sub_app}/system/__underscored_app_name__/import.rb.tt +0 -0
- data/lib/dry/web/roda/skeletons/{app → sub_app}/system/__underscored_app_name__/transactions.rb.tt +0 -0
- data/lib/dry/web/roda/skeletons/{app → sub_app}/system/__underscored_app_name__/view_context.rb.tt +0 -0
- data/lib/dry/web/roda/skeletons/sub_app/system/__underscored_app_name__/view_controller.rb.tt +13 -0
- data/lib/dry/web/roda/skeletons/{app → sub_app}/system/boot.rb.tt +1 -2
- data/lib/dry/web/roda/skeletons/sub_app/system/boot/view.rb.tt +3 -0
- data/lib/dry/web/roda/skeletons/{app → sub_app}/transactions/example.rb.tt +0 -0
- data/lib/dry/web/roda/skeletons/sub_app/web/routes/example.rb.tt +7 -0
- data/lib/dry/web/roda/skeletons/sub_app/web/templates/layouts/application.html.slim +3 -0
- data/lib/dry/web/roda/skeletons/sub_app/web/templates/welcome.html.slim +1 -0
- data/lib/dry/web/roda/skeletons/{umbrella → umbrella_project}/.gitignore +0 -0
- data/lib/dry/web/roda/skeletons/umbrella_project/Gemfile +39 -0
- data/lib/dry/web/roda/skeletons/umbrella_project/README.md.tt +12 -0
- data/lib/dry/web/roda/skeletons/umbrella_project/Rakefile.tt +81 -0
- data/lib/dry/web/roda/skeletons/umbrella_project/bin/console.tt +7 -0
- data/lib/dry/web/roda/skeletons/umbrella_project/bin/setup +7 -0
- data/lib/dry/web/roda/skeletons/umbrella_project/config.ru.tt +2 -0
- data/lib/dry/web/roda/skeletons/umbrella_project/config/settings.yml.tt +8 -0
- data/lib/dry/web/roda/skeletons/umbrella_project/db/sample_data.rb +1 -0
- data/lib/dry/web/roda/skeletons/umbrella_project/db/seed.rb +1 -0
- data/lib/dry/web/roda/skeletons/umbrella_project/lib/__underscored_app_name__/repository.rb.tt +11 -0
- data/lib/dry/web/roda/skeletons/{umbrella → umbrella_project}/lib/__underscored_app_name__/transactions.rb.tt +0 -0
- data/lib/dry/web/roda/skeletons/umbrella_project/lib/__underscored_app_name__/view_context.rb.tt +39 -0
- data/lib/dry/web/roda/skeletons/umbrella_project/lib/persistence/commands/.keep +0 -0
- data/lib/dry/web/roda/skeletons/umbrella_project/lib/persistence/relations/.keep +0 -0
- data/lib/dry/web/roda/skeletons/umbrella_project/lib/rom/instrumentation.rb.tt +22 -0
- data/lib/dry/web/roda/skeletons/umbrella_project/lib/types.rb +6 -0
- data/lib/dry/web/roda/skeletons/umbrella_project/log/.keep +0 -0
- data/lib/dry/web/roda/skeletons/umbrella_project/spec/app_helper.rb +35 -0
- data/lib/dry/web/roda/skeletons/umbrella_project/spec/db_helper.rb.tt +24 -0
- data/lib/dry/web/roda/skeletons/umbrella_project/spec/spec_helper.rb.tt +61 -0
- data/lib/dry/web/roda/skeletons/umbrella_project/spec/support/db/test_factories.rb +3 -0
- data/lib/dry/web/roda/skeletons/umbrella_project/spec/support/test_helpers.rb.tt +15 -0
- data/lib/dry/web/roda/skeletons/umbrella_project/system/__underscored_app_name__/application.rb.tt +14 -0
- data/lib/dry/web/roda/skeletons/{umbrella → umbrella_project}/system/__underscored_app_name__/container.rb.tt +1 -0
- data/lib/dry/web/roda/skeletons/umbrella_project/system/__underscored_app_name__/import.rb.tt +5 -0
- data/lib/dry/web/roda/skeletons/umbrella_project/system/__underscored_app_name__/settings.rb.tt +17 -0
- data/lib/dry/web/roda/skeletons/{umbrella → umbrella_project}/system/boot.rb.tt +0 -0
- data/lib/dry/web/roda/skeletons/umbrella_project/system/boot/monitor.rb.tt +10 -0
- data/lib/dry/web/roda/skeletons/umbrella_project/system/boot/rom.rb.tt +26 -0
- data/lib/dry/web/roda/version.rb +1 -1
- data/script/ci +67 -0
- data/script/setup +47 -0
- data/script/teardown +42 -0
- data/spec/integration/new_app_spec.rb +21 -0
- data/spec/spec_helper.rb +14 -16
- data/spec/support/app.rb +64 -0
- data/spec/support/bundler.rb +113 -0
- data/spec/support/cli.rb +47 -0
- data/spec/support/directories.rb +37 -0
- data/spec/support/env.rb +84 -0
- data/spec/support/files.rb +59 -0
- data/spec/support/project.rb +60 -0
- data/spec/support/requests.rb +5 -0
- data/spec/support/silently.rb +28 -0
- metadata +139 -49
- data/lib/dry/web/roda/skeletons/umbrella/system/__underscored_app_name__/application.rb.tt +0 -7
- data/lib/dry/web/roda/skeletons/umbrella/system/boot/logger.rb.tt +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2687d6c62fe47551a7f1d73de05dfbe8350e60a2
|
4
|
+
data.tar.gz: a94145d9896fa2ac5059f0aa372f3df86d0b1005
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f32d05abe77ab8d0b687e091cfa0f4c0384bc5558ae76d909eaf4f6a6e2eeb0431f5b8c3af4b487537a71ad097ca68cdbfaa9a076e3cc7bd4aebcb00b90514a7
|
7
|
+
data.tar.gz: c8547744187747d7c505f8cb3f9ac294d52edd305ae428428683fff964b13e35adc8665865c7028feb7035fe0de56a9923bfee9b8a5f21cce50e5ad50589575c
|
data/.gitignore
CHANGED
@@ -4,11 +4,14 @@
|
|
4
4
|
/coverage/
|
5
5
|
/InstalledFiles
|
6
6
|
/pkg/
|
7
|
-
/spec/reports/
|
8
7
|
/test/tmp/
|
9
8
|
/test/version_tmp/
|
10
9
|
/tmp/
|
11
10
|
|
11
|
+
## Testing
|
12
|
+
/spec/reports/
|
13
|
+
/spec/examples.txt
|
14
|
+
|
12
15
|
## Documentation cache and generated files:
|
13
16
|
/.yardoc/
|
14
17
|
/_yardoc/
|
@@ -27,3 +30,6 @@ Gemfile.lock
|
|
27
30
|
|
28
31
|
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
29
32
|
.rvmrc
|
33
|
+
|
34
|
+
.byebug_history
|
35
|
+
/vendor/cache/
|
data/.rspec
CHANGED
data/.travis.yml
CHANGED
@@ -1,21 +1,27 @@
|
|
1
1
|
language: ruby
|
2
|
+
dist: trusty
|
2
3
|
sudo: false
|
4
|
+
services:
|
5
|
+
- postgresql
|
3
6
|
cache: bundler
|
4
|
-
|
7
|
+
install: true
|
8
|
+
before_install:
|
9
|
+
- gem update --system
|
10
|
+
before_script:
|
11
|
+
- psql -c 'create database sandbox_test;' -U postgres
|
5
12
|
script:
|
6
|
-
-
|
13
|
+
- ./script/ci
|
7
14
|
rvm:
|
8
|
-
- 2.
|
9
|
-
- 2.
|
10
|
-
- 2.
|
11
|
-
-
|
12
|
-
- jruby-9000
|
15
|
+
- 2.4.0
|
16
|
+
- 2.3.3
|
17
|
+
- 2.2.6
|
18
|
+
- jruby-9.1.6.0
|
13
19
|
env:
|
14
20
|
global:
|
15
21
|
- JRUBY_OPTS='--dev -J-Xmx1024M'
|
16
22
|
matrix:
|
17
23
|
allow_failures:
|
18
|
-
- rvm:
|
24
|
+
- rvm: jruby-9.1.6.0
|
19
25
|
notifications:
|
20
26
|
email: false
|
21
27
|
webhooks:
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,25 @@
|
|
1
|
+
# 0.6.1 - 2017-02-08
|
2
|
+
|
3
|
+
### Added
|
4
|
+
|
5
|
+
- In generated projects, set up dry-monitor for request logging (timriley)
|
6
|
+
- In generated projects, use dry-monitor to log SQL queries (timriley)
|
7
|
+
- Add new flat project generator: `dry-web-roda new <your_app> --arch=flat` (timriley)
|
8
|
+
|
9
|
+
### Changed
|
10
|
+
|
11
|
+
- Renamed sub-app generator from `dry-web-roda generate app` to `dry-web-roda generate sub_app` (timriley)
|
12
|
+
|
13
|
+
### Fixed
|
14
|
+
|
15
|
+
- Ensure dry-monitor is set up in `Application` regardless of the order in which the application's configs are applied (timriley)
|
16
|
+
|
17
|
+
# 0.6.1 - 2017-02-03
|
18
|
+
|
19
|
+
### Added
|
20
|
+
|
21
|
+
- In generated projects, integrate with dry-monitor (via dry-web) for centralized application logging and error reporting (solnic)
|
22
|
+
|
1
23
|
# 0.5.1 - 2016-12-27
|
2
24
|
|
3
25
|
### Fixed
|
data/Gemfile
CHANGED
@@ -1,20 +1,31 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
2
|
|
3
|
-
# Specify your gem's dependencies in rodakase.gemspec
|
4
3
|
gemspec
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
gem 'rack-test'
|
10
|
-
gem 'dry-monads'
|
11
|
-
gem 'dry-transaction'
|
12
|
-
gem 'dry-view'
|
13
|
-
gem 'slim'
|
5
|
+
gem 'pry'
|
6
|
+
gem 'byebug', platform: :mri
|
7
|
+
gem 'codeclimate-test-reporter', platform: :rbx
|
14
8
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
9
|
+
# Generated application dependencies
|
10
|
+
gem "dry-web", ">= 0.6.0"
|
11
|
+
gem "puma"
|
12
|
+
gem "rack_csrf"
|
13
|
+
gem "rack", ">= 2.0"
|
14
|
+
gem "shotgun", ">= 0.9.2"
|
15
|
+
gem "pg"
|
16
|
+
gem "rom-repository"
|
17
|
+
gem "rom-sql"
|
18
|
+
gem "dry-matcher"
|
19
|
+
gem "dry-monads"
|
20
|
+
gem "dry-struct"
|
21
|
+
gem "dry-transaction"
|
22
|
+
gem "dry-types"
|
23
|
+
gem "dry-validation"
|
24
|
+
gem "dry-view", ">= 0.2.2"
|
25
|
+
gem "slim"
|
26
|
+
gem "pry-byebug", platform: :mri
|
27
|
+
gem "capybara"
|
28
|
+
gem "capybara-screenshot"
|
29
|
+
gem "database_cleaner"
|
30
|
+
gem "poltergeist"
|
31
|
+
gem "rspec"
|
data/README.md
CHANGED
@@ -13,16 +13,28 @@
|
|
13
13
|
|
14
14
|
Integration between dry-web and roda.
|
15
15
|
|
16
|
-
dry-web-roda offers a CLI for generating new projects
|
16
|
+
dry-web-roda offers a CLI for generating new projects.
|
17
|
+
|
18
|
+
### Umbrella projects
|
19
|
+
|
20
|
+
To generate a new _umbrella project_ (functionality divided into sub-apps):
|
17
21
|
|
18
22
|
```sh
|
19
|
-
$ dry-web-roda new <
|
23
|
+
$ dry-web-roda new <your_project_name>
|
20
24
|
```
|
21
25
|
|
22
|
-
And
|
26
|
+
And to generate sub-apps within your project:
|
23
27
|
|
24
28
|
```sh
|
25
|
-
$ dry-web-roda generate
|
29
|
+
$ dry-web-roda generate sub_app <your_sub_app_name> --umbrella=<your_project_name>
|
30
|
+
```
|
31
|
+
|
32
|
+
### Flat projects
|
33
|
+
|
34
|
+
To generate a new _flat project_ (a simpler architecture, with a single module for your entire app):
|
35
|
+
|
36
|
+
```sh
|
37
|
+
$ dry-web-roda new <your_project_name> --arch=flat
|
26
38
|
```
|
27
39
|
|
28
40
|
## LICENSE
|
@@ -32,3 +44,9 @@ See `LICENSE` file.
|
|
32
44
|
## Contributing
|
33
45
|
|
34
46
|
Bug reports and pull requests are welcome on GitHub at https://github.com/dry-rb/dry-web-roda.
|
47
|
+
|
48
|
+
## Acknowledgements
|
49
|
+
|
50
|
+
The support code for testing the CLI and generated app are derived from
|
51
|
+
[hanami/hanami](https://github.com/hanami/hanami). Thank you to Luca and the
|
52
|
+
Hanami team!
|
data/dry-web-roda.gemspec
CHANGED
@@ -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.
|
21
|
+
spec.required_ruby_version = '>= 2.2.0'
|
22
22
|
|
23
23
|
spec.add_runtime_dependency "dry-web", "~> 0.6", ">= 0.6.0"
|
24
24
|
spec.add_runtime_dependency "dry-monitor"
|
@@ -28,8 +28,10 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_runtime_dependency "roda-flow", "~> 0.3"
|
29
29
|
spec.add_runtime_dependency "thor", "~> 0.19"
|
30
30
|
|
31
|
+
spec.add_development_dependency "aruba"
|
31
32
|
spec.add_development_dependency "bundler", "~> 1.7"
|
32
33
|
spec.add_development_dependency "rake", "~> 11.0"
|
33
34
|
spec.add_development_dependency "rspec", "~> 3.4"
|
34
35
|
spec.add_development_dependency "capybara", "~> 2.5"
|
36
|
+
spec.add_development_dependency "waitutil"
|
35
37
|
end
|
data/lib/dry/web/roda/cli.rb
CHANGED
@@ -5,9 +5,16 @@ module Dry
|
|
5
5
|
module Roda
|
6
6
|
class CLI < Thor
|
7
7
|
desc "new APP", "Generate a new dry-web-roda project"
|
8
|
+
option :arch, required: false, default: "umbrella", enum: %w[umbrella flat], banner: "ARCH", desc: "Project architecture (umbrella/flat)"
|
8
9
|
def new(app_name)
|
9
|
-
|
10
|
-
|
10
|
+
case options[:arch]
|
11
|
+
when "umbrella"
|
12
|
+
require "dry/web/roda/generators/umbrella_project"
|
13
|
+
Generators::UmbrellaProject.new.(app_name)
|
14
|
+
when "flat"
|
15
|
+
require "dry/web/roda/generators/flat_project"
|
16
|
+
Generators::FlatProject.new.(app_name)
|
17
|
+
end
|
11
18
|
end
|
12
19
|
|
13
20
|
desc "generate GENERATOR", "Generate a new component for an existing dry-web-roda project"
|
@@ -5,11 +5,11 @@ module Dry
|
|
5
5
|
module Roda
|
6
6
|
class CLI
|
7
7
|
class Generate < Thor
|
8
|
-
desc "generate
|
8
|
+
desc "generate sub_app APP", "Generate a sub-app within a dry-web umbrella app"
|
9
9
|
option :umbrella, required: true, banner: "UMBRELLA_NAME", desc: "Provide the name of the umbrella app, e.g. my_project"
|
10
|
-
def
|
11
|
-
require "dry/web/roda/generators/
|
12
|
-
Dry::Web::Roda::Generators::
|
10
|
+
def sub_app(app_name)
|
11
|
+
require "dry/web/roda/generators/sub_app"
|
12
|
+
Dry::Web::Roda::Generators::SubApp.new.(app_name, umbrella: options[:umbrella])
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require "inflecto"
|
2
|
+
require "dry/web/roda/generate"
|
3
|
+
|
4
|
+
module Dry
|
5
|
+
module Web
|
6
|
+
module Roda
|
7
|
+
module Generators
|
8
|
+
class FlatProject
|
9
|
+
attr_reader :generate
|
10
|
+
|
11
|
+
def initialize
|
12
|
+
@generate = Generate.new("flat_project")
|
13
|
+
end
|
14
|
+
|
15
|
+
def call(target_dir)
|
16
|
+
generate.(target_dir, prepare_scope(target_dir))
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def prepare_scope(target_dir)
|
22
|
+
{
|
23
|
+
underscored_app_name: Inflecto.underscore(target_dir),
|
24
|
+
camel_cased_app_name: Inflecto.camelize(target_dir)
|
25
|
+
}
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -5,11 +5,11 @@ module Dry
|
|
5
5
|
module Web
|
6
6
|
module Roda
|
7
7
|
module Generators
|
8
|
-
class
|
8
|
+
class SubApp
|
9
9
|
attr_reader :generate
|
10
10
|
|
11
11
|
def initialize
|
12
|
-
@generate = Dry::Web::Roda::Generate.new("
|
12
|
+
@generate = Dry::Web::Roda::Generate.new("sub_app")
|
13
13
|
end
|
14
14
|
|
15
15
|
def call(target_dir, options = {})
|
@@ -1,25 +1,25 @@
|
|
1
1
|
require "inflecto"
|
2
2
|
require "securerandom"
|
3
3
|
require "dry/web/roda/generate"
|
4
|
-
require "dry/web/roda/generators/
|
4
|
+
require "dry/web/roda/generators/sub_app"
|
5
5
|
|
6
6
|
module Dry
|
7
7
|
module Web
|
8
8
|
module Roda
|
9
9
|
module Generators
|
10
|
-
class
|
11
|
-
attr_reader :generate, :
|
10
|
+
class UmbrellaProject
|
11
|
+
attr_reader :generate, :sub_app_generator
|
12
12
|
|
13
13
|
def initialize
|
14
|
-
@generate = Generate.new("
|
15
|
-
@
|
14
|
+
@generate = Generate.new("umbrella_project")
|
15
|
+
@sub_app_generator = Generators::SubApp.new
|
16
16
|
end
|
17
17
|
|
18
18
|
def call(target_dir)
|
19
19
|
generate.(target_dir, prepare_scope(target_dir))
|
20
20
|
|
21
21
|
Dir.chdir(target_dir) do
|
22
|
-
|
22
|
+
sub_app_generator.("main", umbrella: target_dir)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -3,8 +3,8 @@ source "https://rubygems.org"
|
|
3
3
|
gem "rake"
|
4
4
|
|
5
5
|
# Web framework
|
6
|
-
gem "dry-web", ">= 0.
|
7
|
-
gem "dry-web-roda", ">= 0.
|
6
|
+
gem "dry-web", ">= 0.6.0"
|
7
|
+
gem "dry-web-roda", ">= 0.6.0"
|
8
8
|
gem "puma"
|
9
9
|
gem "rack_csrf"
|
10
10
|
|
@@ -27,7 +27,7 @@ gem "dry-view", ">= 0.2.2"
|
|
27
27
|
gem "slim"
|
28
28
|
|
29
29
|
group :development, :test do
|
30
|
-
gem "pry-byebug"
|
30
|
+
gem "pry-byebug", platform: :mri
|
31
31
|
end
|
32
32
|
|
33
33
|
group :test do
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require "rom-sql"
|
2
|
+
|
3
|
+
module ROM
|
4
|
+
class Relation
|
5
|
+
# Monkey patch ROM::SQL to support query logs until an official API is available
|
6
|
+
module Instrumentation
|
7
|
+
def self.included(klass)
|
8
|
+
klass.option :notifications, reader: true, optional: false, default: proc {
|
9
|
+
<%= config[:camel_cased_app_name] %>::Container[:notifications]
|
10
|
+
}
|
11
|
+
end
|
12
|
+
|
13
|
+
def to_a
|
14
|
+
notifications.instrument(:sql, name: name.relation, query: dataset.sql) do
|
15
|
+
super
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
SQL::Relation.include(Instrumentation)
|
21
|
+
end
|
22
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/dry/web/roda/skeletons/flat_project/system/__underscored_app_name__/application.rb.tt
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require "dry/web/roda/application"
|
2
|
+
require_relative "container"
|
3
|
+
|
4
|
+
module <%= config[:camel_cased_app_name] %>
|
5
|
+
class Application < Dry::Web::Roda::Application
|
6
|
+
configure do |config|
|
7
|
+
config.container = Container
|
8
|
+
config.routes = "web/routes".freeze
|
9
|
+
end
|
10
|
+
|
11
|
+
opts[:root] = Pathname(__FILE__).join("../..").realpath.dirname
|
12
|
+
|
13
|
+
use Rack::Session::Cookie, key: "<%= config[:underscored_app_name] %>.session", secret: <%= config[:camel_cased_app_name] %>::Container.settings.session_secret
|
14
|
+
|
15
|
+
plugin :csrf, raise: true
|
16
|
+
plugin :flash
|
17
|
+
plugin :dry_view
|
18
|
+
|
19
|
+
route do |r|
|
20
|
+
r.multi_route
|
21
|
+
|
22
|
+
r.root do
|
23
|
+
r.view "welcome"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
load_routes!
|
28
|
+
end
|
29
|
+
end
|