dry-web-roda 0.6.3 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -0
- data/CONTRIBUTING.md +29 -0
- data/Gemfile +4 -3
- data/README.md +1 -1
- data/dry-web-roda.gemspec +0 -2
- data/lib/dry/web/roda/cli.rb +2 -2
- data/lib/dry/web/roda/cli/generate.rb +1 -1
- data/lib/dry/web/roda/generate.rb +32 -34
- data/lib/dry/web/roda/generators/abstract_generator.rb +54 -0
- data/lib/dry/web/roda/generators/abstract_project.rb +118 -0
- data/lib/dry/web/roda/generators/flat_project.rb +20 -14
- data/lib/dry/web/roda/generators/sub_app.rb +34 -13
- data/lib/dry/web/roda/generators/umbrella_project.rb +10 -19
- data/lib/dry/web/roda/templates/.env.test.tt +1 -0
- data/lib/dry/web/roda/templates/.env.tt +2 -0
- data/lib/dry/web/roda/templates/.gitignore +8 -0
- data/lib/dry/web/roda/{skeletons/flat_project/lib/__underscored_app_name__ → templates}/.keep +0 -0
- data/lib/dry/web/roda/templates/.rspec +2 -0
- data/lib/dry/web/roda/{skeletons/flat_project → templates}/Gemfile +4 -3
- data/lib/dry/web/roda/{skeletons/umbrella_project → templates}/README.md.tt +2 -2
- data/lib/dry/web/roda/templates/Rakefile.tt +66 -0
- data/lib/dry/web/roda/{skeletons/flat_project/web/templates/layouts → templates}/application.html.slim +0 -0
- data/lib/dry/web/roda/templates/boot__settings.rb.tt +10 -0
- data/lib/dry/web/roda/{skeletons/flat_project → templates}/config.ru.tt +0 -0
- data/lib/dry/web/roda/{skeletons/flat_project/bin → templates}/console.tt +0 -0
- data/lib/dry/web/roda/templates/container.rb.tt +14 -0
- data/lib/dry/web/roda/{skeletons/flat_project/web/routes/example.rb.tt → templates/example_routes.rb.tt} +0 -0
- data/lib/dry/web/roda/{skeletons/flat_project/system/__underscored_app_name__ → templates/flat_project}/application.rb.tt +6 -1
- data/lib/dry/web/roda/templates/flat_project/boot.rb.tt +10 -0
- data/lib/dry/web/roda/{skeletons/flat_project/system/__underscored_app_name__ → templates}/import.rb.tt +0 -0
- data/lib/dry/web/roda/{skeletons/flat_project/system/boot → templates}/monitor.rb.tt +0 -0
- data/lib/dry/web/roda/templates/operation.rb.tt +9 -0
- data/lib/dry/web/roda/{skeletons/flat_project/system/__underscored_app_name__ → templates}/repository.rb.tt +4 -2
- data/lib/dry/web/roda/templates/rom.rb.tt +39 -0
- data/lib/dry/web/roda/{skeletons/flat_project/db → templates}/sample_data.rb +0 -0
- data/lib/dry/web/roda/{skeletons/flat_project/db → templates}/seed.rb +0 -0
- data/lib/dry/web/roda/templates/settings.rb.tt +9 -0
- data/lib/dry/web/roda/{skeletons/flat_project/bin → templates}/setup +0 -0
- data/lib/dry/web/roda/{skeletons/umbrella_project/spec/db_helper.rb.tt → templates/spec/db_spec_helper.rb.tt} +2 -3
- data/lib/dry/web/roda/templates/spec/factories/example.rb +9 -0
- data/lib/dry/web/roda/{skeletons/flat_project → templates}/spec/spec_helper.rb.tt +1 -1
- data/lib/dry/web/roda/templates/spec/support/db/factory.rb +8 -0
- data/lib/dry/web/roda/templates/spec/support/db/helpers.rb.tt +13 -0
- data/lib/dry/web/roda/templates/spec/support/web/helpers.rb.tt +9 -0
- data/lib/dry/web/roda/{skeletons/umbrella_project/spec/app_helper.rb → templates/spec/web_spec_helper.rb} +8 -6
- data/lib/dry/web/roda/{skeletons/sub_app/system/__underscored_app_name__ → templates/subapp}/application.rb.tt +6 -1
- data/lib/dry/web/roda/templates/subapp/boot.rb.tt +5 -0
- data/lib/dry/web/roda/{skeletons/sub_app/system/__underscored_app_name__ → templates/subapp}/container.rb.tt +6 -9
- data/lib/dry/web/roda/{skeletons/sub_app/system/__underscored_app_name__ → templates/subapp}/transactions.rb.tt +2 -3
- data/lib/dry/web/roda/templates/subapp/view_context.rb.tt +8 -0
- data/lib/dry/web/roda/templates/subapp/view_controller.rb.tt +17 -0
- data/lib/dry/web/roda/{skeletons/flat_project/lib → templates}/types.rb +0 -0
- data/lib/dry/web/roda/{skeletons/umbrella_project/system/__underscored_app_name__ → templates/umbrella_project}/application.rb.tt +6 -1
- data/lib/dry/web/roda/templates/umbrella_project/boot.rb.tt +16 -0
- data/lib/dry/web/roda/templates/view_context.rb.tt +43 -0
- data/lib/dry/web/roda/templates/view_controller.rb.tt +17 -0
- data/lib/dry/web/roda/{skeletons/flat_project/web/templates → templates}/welcome.html.slim +0 -0
- data/lib/dry/web/roda/{skeletons/flat_project/lib/__underscored_app_name__/views → templates}/welcome.rb.tt +2 -2
- data/lib/dry/web/roda/version.rb +1 -1
- data/lib/roda/plugins/dry_view.rb +1 -1
- data/spec/support/project.rb +1 -1
- metadata +51 -116
- data/lib/dry/web/roda/skeletons/flat_project/README.md.tt +0 -12
- data/lib/dry/web/roda/skeletons/flat_project/Rakefile.tt +0 -81
- data/lib/dry/web/roda/skeletons/flat_project/config/settings.yml.tt +0 -8
- data/lib/dry/web/roda/skeletons/flat_project/lib/persistence/commands/.keep +0 -0
- data/lib/dry/web/roda/skeletons/flat_project/lib/persistence/relations/.keep +0 -0
- data/lib/dry/web/roda/skeletons/flat_project/log/.keep +0 -0
- data/lib/dry/web/roda/skeletons/flat_project/spec/app_helper.rb +0 -35
- data/lib/dry/web/roda/skeletons/flat_project/spec/db_helper.rb.tt +0 -24
- data/lib/dry/web/roda/skeletons/flat_project/spec/support/db/test_factories.rb +0 -3
- data/lib/dry/web/roda/skeletons/flat_project/spec/support/test_helpers.rb.tt +0 -15
- data/lib/dry/web/roda/skeletons/flat_project/system/__underscored_app_name__/container.rb.tt +0 -23
- data/lib/dry/web/roda/skeletons/flat_project/system/__underscored_app_name__/settings.rb.tt +0 -17
- data/lib/dry/web/roda/skeletons/flat_project/system/__underscored_app_name__/transactions.rb.tt +0 -34
- data/lib/dry/web/roda/skeletons/flat_project/system/__underscored_app_name__/view_context.rb.tt +0 -39
- data/lib/dry/web/roda/skeletons/flat_project/system/__underscored_app_name__/view_controller.rb.tt +0 -13
- data/lib/dry/web/roda/skeletons/flat_project/system/boot.rb.tt +0 -11
- data/lib/dry/web/roda/skeletons/flat_project/system/boot/rom.rb.tt +0 -32
- data/lib/dry/web/roda/skeletons/flat_project/system/boot/view.rb.tt +0 -3
- data/lib/dry/web/roda/skeletons/flat_project/transactions/example.rb.tt +0 -10
- 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 +0 -11
- data/lib/dry/web/roda/skeletons/sub_app/system/__underscored_app_name__/import.rb.tt +0 -5
- data/lib/dry/web/roda/skeletons/sub_app/system/__underscored_app_name__/view_context.rb.tt +0 -6
- data/lib/dry/web/roda/skeletons/sub_app/system/__underscored_app_name__/view_controller.rb.tt +0 -13
- data/lib/dry/web/roda/skeletons/sub_app/system/boot.rb.tt +0 -8
- data/lib/dry/web/roda/skeletons/sub_app/system/boot/view.rb.tt +0 -3
- data/lib/dry/web/roda/skeletons/sub_app/transactions/example.rb.tt +0 -9
- data/lib/dry/web/roda/skeletons/sub_app/web/routes/example.rb.tt +0 -7
- data/lib/dry/web/roda/skeletons/sub_app/web/templates/layouts/application.html.slim +0 -3
- data/lib/dry/web/roda/skeletons/sub_app/web/templates/welcome.html.slim +0 -1
- data/lib/dry/web/roda/skeletons/umbrella_project/.gitignore +0 -8
- data/lib/dry/web/roda/skeletons/umbrella_project/Gemfile +0 -40
- data/lib/dry/web/roda/skeletons/umbrella_project/Rakefile.tt +0 -81
- data/lib/dry/web/roda/skeletons/umbrella_project/bin/console.tt +0 -7
- data/lib/dry/web/roda/skeletons/umbrella_project/bin/setup +0 -7
- data/lib/dry/web/roda/skeletons/umbrella_project/config.ru.tt +0 -2
- data/lib/dry/web/roda/skeletons/umbrella_project/config/settings.yml.tt +0 -8
- data/lib/dry/web/roda/skeletons/umbrella_project/db/sample_data.rb +0 -1
- data/lib/dry/web/roda/skeletons/umbrella_project/db/seed.rb +0 -1
- data/lib/dry/web/roda/skeletons/umbrella_project/lib/__underscored_app_name__/repository.rb.tt +0 -11
- data/lib/dry/web/roda/skeletons/umbrella_project/lib/__underscored_app_name__/transactions.rb.tt +0 -33
- data/lib/dry/web/roda/skeletons/umbrella_project/lib/__underscored_app_name__/view_context.rb.tt +0 -39
- 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/types.rb +0 -6
- data/lib/dry/web/roda/skeletons/umbrella_project/log/.keep +0 -0
- data/lib/dry/web/roda/skeletons/umbrella_project/spec/spec_helper.rb.tt +0 -61
- data/lib/dry/web/roda/skeletons/umbrella_project/spec/support/db/test_factories.rb +0 -3
- data/lib/dry/web/roda/skeletons/umbrella_project/spec/support/test_helpers.rb.tt +0 -15
- data/lib/dry/web/roda/skeletons/umbrella_project/system/__underscored_app_name__/container.rb.tt +0 -18
- data/lib/dry/web/roda/skeletons/umbrella_project/system/__underscored_app_name__/import.rb.tt +0 -5
- data/lib/dry/web/roda/skeletons/umbrella_project/system/__underscored_app_name__/settings.rb.tt +0 -17
- data/lib/dry/web/roda/skeletons/umbrella_project/system/boot.rb.tt +0 -12
- data/lib/dry/web/roda/skeletons/umbrella_project/system/boot/monitor.rb.tt +0 -9
- data/lib/dry/web/roda/skeletons/umbrella_project/system/boot/rom.rb.tt +0 -32
@@ -1,81 +0,0 @@
|
|
1
|
-
require "bundler/setup"
|
2
|
-
|
3
|
-
require "byebug" unless ENV["RACK_ENV"] == "production"
|
4
|
-
|
5
|
-
begin
|
6
|
-
require "rspec/core/rake_task"
|
7
|
-
RSpec::Core::RakeTask.new :spec
|
8
|
-
task default: [:spec]
|
9
|
-
rescue LoadError
|
10
|
-
end
|
11
|
-
|
12
|
-
require_relative "system/<%= config[:underscored_app_name] %>/container"
|
13
|
-
|
14
|
-
require "rom/sql/rake_task"
|
15
|
-
require "sequel"
|
16
|
-
namespace :db do
|
17
|
-
task :setup do
|
18
|
-
<%= config[:camel_cased_app_name] %>::Container.boot! :rom
|
19
|
-
end
|
20
|
-
|
21
|
-
# The following migration tasks are adapted from https://gist.github.com/kalmbach/4471560
|
22
|
-
Sequel.extension :migration
|
23
|
-
DB = Sequel.connect(<%= config[:camel_cased_app_name] %>::Container.settings.database_url)
|
24
|
-
|
25
|
-
desc "Prints current schema version"
|
26
|
-
task :version do
|
27
|
-
version = if DB.tables.include?(:schema_migrations)
|
28
|
-
DB[:schema_migrations].order(:filename).last[:filename]
|
29
|
-
end || "not available"
|
30
|
-
|
31
|
-
puts "Current schema version: #{version}"
|
32
|
-
end
|
33
|
-
|
34
|
-
namespace :structure do
|
35
|
-
desc "Dump database structure to db/structure.sql"
|
36
|
-
task :dump do
|
37
|
-
require "uri"
|
38
|
-
uri = URI(DB.url)
|
39
|
-
|
40
|
-
dump = `pg_dump -h #{uri.hostname} -s -x -O #{uri.path.tr("/", "")}`
|
41
|
-
File.open "db/structure.sql", "w" do |file|
|
42
|
-
file.write dump
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
task :check_migrations_exist do
|
48
|
-
unless Dir["db/migrate/*.rb"].any?
|
49
|
-
puts "No migrations found"
|
50
|
-
exit 1
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
# Enhance the migration task provided by ROM
|
55
|
-
desc "Perform migration up to latest migration available"
|
56
|
-
task :migrate => [:check_migrations_exist] do
|
57
|
-
# Once db:migrate finishes, dump the db structure:
|
58
|
-
Rake::Task["db:structure:dump"].execute
|
59
|
-
|
60
|
-
# And print the current migration version:
|
61
|
-
Rake::Task["db:version"].execute
|
62
|
-
end
|
63
|
-
|
64
|
-
desc "Perform rollback to specified target"
|
65
|
-
task :rollback, :target do |t, args|
|
66
|
-
Sequel::Migrator.run(DB, "db/migrate", :target => args[:target].to_i)
|
67
|
-
Rake::Task["db:version"].execute
|
68
|
-
end
|
69
|
-
|
70
|
-
desc "Load seed data into the database"
|
71
|
-
task :seed do
|
72
|
-
seed_data = File.join("db", "seed.rb")
|
73
|
-
load(seed_data) if File.exist?(seed_data)
|
74
|
-
end
|
75
|
-
|
76
|
-
desc "Load a small, representative set of data so that the application can start in a useful state (for development)."
|
77
|
-
task :sample_data do
|
78
|
-
sample_data = File.join("db", "sample_data.rb")
|
79
|
-
load(sample_data) if File.exist?(sample_data)
|
80
|
-
end
|
81
|
-
end
|
@@ -1,8 +0,0 @@
|
|
1
|
-
development: &base
|
2
|
-
database_url: 'postgres://localhost/<%= config[:underscored_app_name] %>_development'
|
3
|
-
session_secret: '<%= SecureRandom.hex %>'
|
4
|
-
test:
|
5
|
-
<<: *base
|
6
|
-
database_url: 'postgres://localhost/<%= config[:underscored_app_name] %>_test'
|
7
|
-
production:
|
8
|
-
<<: *base
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require_relative "db_helper"
|
2
|
-
|
3
|
-
require "rack/test"
|
4
|
-
require "capybara/rspec"
|
5
|
-
require "capybara-screenshot/rspec"
|
6
|
-
require "capybara/poltergeist"
|
7
|
-
|
8
|
-
Dir[SPEC_ROOT.join("support/app/*.rb").to_s].each(&method(:require))
|
9
|
-
Dir[SPEC_ROOT.join("shared/app/*.rb").to_s].each(&method(:require))
|
10
|
-
|
11
|
-
require SPEC_ROOT.join("../system/boot").realpath
|
12
|
-
|
13
|
-
Capybara.app = TestHelpers.app
|
14
|
-
Capybara.server_port = 3001
|
15
|
-
Capybara.save_and_open_page_path = "#{File.dirname(__FILE__)}/../tmp/capybara-screenshot"
|
16
|
-
Capybara.javascript_driver = :poltergeist
|
17
|
-
Capybara::Screenshot.prune_strategy = {keep: 10}
|
18
|
-
|
19
|
-
Capybara.register_driver :poltergeist do |app|
|
20
|
-
Capybara::Poltergeist::Driver.new(
|
21
|
-
app,
|
22
|
-
js_errors: false,
|
23
|
-
phantomjs_logger: File.open(SPEC_ROOT.join("../log/phantomjs.log"), "w"),
|
24
|
-
phantomjs_options: %w(--load-images=no)
|
25
|
-
)
|
26
|
-
end
|
27
|
-
|
28
|
-
RSpec.configure do |config|
|
29
|
-
config.include Rack::Test::Methods, type: :request
|
30
|
-
config.include Rack::Test::Methods, Capybara::DSL, type: :feature
|
31
|
-
|
32
|
-
config.before :suite do
|
33
|
-
TestHelpers.app.freeze
|
34
|
-
end
|
35
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require_relative "spec_helper"
|
2
|
-
|
3
|
-
<%= config[:camel_cased_app_name] %>::Container.boot! :rom
|
4
|
-
|
5
|
-
Dir[SPEC_ROOT.join("support/db/*.rb").to_s].each(&method(:require))
|
6
|
-
Dir[SPEC_ROOT.join("shared/db/*.rb").to_s].each(&method(:require))
|
7
|
-
|
8
|
-
require "database_cleaner"
|
9
|
-
DatabaseCleaner[:sequel, connection: TestHelpers.db_connection].strategy = :truncation
|
10
|
-
|
11
|
-
RSpec.configure do |config|
|
12
|
-
config.include TestHelpers
|
13
|
-
config.include TestFactories
|
14
|
-
|
15
|
-
config.before :suite do
|
16
|
-
DatabaseCleaner.clean_with :truncation
|
17
|
-
end
|
18
|
-
|
19
|
-
config.around :each do |example|
|
20
|
-
DatabaseCleaner.cleaning do
|
21
|
-
example.run
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module TestHelpers
|
2
|
-
module_function
|
3
|
-
|
4
|
-
def app
|
5
|
-
<%= config[:camel_cased_app_name] %>::Application.app
|
6
|
-
end
|
7
|
-
|
8
|
-
def rom
|
9
|
-
<%= config[:camel_cased_app_name] %>::Container["persistence.rom"]
|
10
|
-
end
|
11
|
-
|
12
|
-
def db_connection
|
13
|
-
rom.gateways[:default].connection
|
14
|
-
end
|
15
|
-
end
|
data/lib/dry/web/roda/skeletons/flat_project/system/__underscored_app_name__/container.rb.tt
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
require "dry/web/umbrella"
|
2
|
-
require_relative "settings"
|
3
|
-
|
4
|
-
module <%= config[:camel_cased_app_name] %>
|
5
|
-
class Container < Dry::Web::Umbrella
|
6
|
-
configure do
|
7
|
-
config.name = :<%= config[:underscored_app_name] %>
|
8
|
-
config.default_namespace = "<%= config[:underscored_app_name] %>"
|
9
|
-
config.settings_loader = <%= config[:camel_cased_app_name] %>::Settings
|
10
|
-
config.listeners = true
|
11
|
-
|
12
|
-
config.auto_register = %w[
|
13
|
-
lib/<%= config[:underscored_app_name] %>
|
14
|
-
]
|
15
|
-
end
|
16
|
-
|
17
|
-
load_paths! "lib", "system"
|
18
|
-
|
19
|
-
def self.settings
|
20
|
-
config.settings
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require "dry/web/settings"
|
2
|
-
require "dry-types"
|
3
|
-
|
4
|
-
module <%= config[:camel_cased_app_name] %>
|
5
|
-
class Settings < Dry::Web::Settings
|
6
|
-
module Types
|
7
|
-
include Dry::Types.module
|
8
|
-
|
9
|
-
module Required
|
10
|
-
String = Types::Strict::String.constrained(min_size: 1)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
setting :database_url, Types::Required::String
|
15
|
-
setting :session_secret, Types::Required::String
|
16
|
-
end
|
17
|
-
end
|
data/lib/dry/web/roda/skeletons/flat_project/system/__underscored_app_name__/transactions.rb.tt
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
require "dry-configurable"
|
2
|
-
require "dry-transaction"
|
3
|
-
require "<%= config[:underscored_app_name] %>/container"
|
4
|
-
|
5
|
-
module <%= config[:camel_cased_app_name] %>
|
6
|
-
class Transactions
|
7
|
-
extend Dry::Configurable
|
8
|
-
|
9
|
-
attr_reader :options
|
10
|
-
|
11
|
-
setting :container, <%= config[:camel_cased_app_name] %>::Container
|
12
|
-
setting :options, {}
|
13
|
-
|
14
|
-
def self.define(&block)
|
15
|
-
yield(new(options))
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.options
|
19
|
-
{container: config.container}.merge(config.options)
|
20
|
-
end
|
21
|
-
|
22
|
-
def initialize(options)
|
23
|
-
@options = options
|
24
|
-
end
|
25
|
-
|
26
|
-
def container
|
27
|
-
options[:container]
|
28
|
-
end
|
29
|
-
|
30
|
-
def define(name, &block)
|
31
|
-
container.register(name, Dry.Transaction(options, &block))
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
data/lib/dry/web/roda/skeletons/flat_project/system/__underscored_app_name__/view_context.rb.tt
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
module <%= config[:camel_cased_app_name] %>
|
2
|
-
class ViewContext
|
3
|
-
attr_reader :attrs
|
4
|
-
|
5
|
-
def initialize(attrs = {})
|
6
|
-
@attrs = attrs
|
7
|
-
end
|
8
|
-
|
9
|
-
def csrf_token
|
10
|
-
self[:csrf_token]
|
11
|
-
end
|
12
|
-
|
13
|
-
def csrf_metatag
|
14
|
-
self[:csrf_metatag]
|
15
|
-
end
|
16
|
-
|
17
|
-
def csrf_tag
|
18
|
-
self[:csrf_tag]
|
19
|
-
end
|
20
|
-
|
21
|
-
def flash
|
22
|
-
self[:flash]
|
23
|
-
end
|
24
|
-
|
25
|
-
def flash?
|
26
|
-
%i[notice alert].any? { |type| flash[type] }
|
27
|
-
end
|
28
|
-
|
29
|
-
def with(new_attrs)
|
30
|
-
self.class.new(attrs.merge(new_attrs))
|
31
|
-
end
|
32
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
def [](name)
|
36
|
-
attrs.fetch(name)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
data/lib/dry/web/roda/skeletons/flat_project/system/__underscored_app_name__/view_controller.rb.tt
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require "slim"
|
2
|
-
require "dry-view"
|
3
|
-
require "<%= config[:underscored_app_name] %>/container"
|
4
|
-
|
5
|
-
module <%= config[:camel_cased_app_name] %>
|
6
|
-
class ViewController < Dry::View::Controller
|
7
|
-
configure do |config|
|
8
|
-
config.paths = [Container.root.join("web/templates")]
|
9
|
-
config.context = Container["view_context"]
|
10
|
-
config.layout = "application"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
require "byebug" if ENV["RACK_ENV"] == "development"
|
2
|
-
require "pry" if ENV["RACK_ENV"] == "development"
|
3
|
-
|
4
|
-
require_relative "<%= config[:underscored_app_name] %>/container"
|
5
|
-
|
6
|
-
<%= config[:camel_cased_app_name] %>::Container.finalize!
|
7
|
-
|
8
|
-
require "<%= config[:underscored_app_name] %>/application"
|
9
|
-
|
10
|
-
require "<%= config[:underscored_app_name] %>/transactions"
|
11
|
-
<%= config[:camel_cased_app_name] %>::Container.require "transactions/**/*.rb"
|
@@ -1,32 +0,0 @@
|
|
1
|
-
<%= config[:camel_cased_app_name] %>::Container.namespace "persistence" do |persistence|
|
2
|
-
persistence.finalize(:rom) do
|
3
|
-
init do
|
4
|
-
require "sequel"
|
5
|
-
require "rom"
|
6
|
-
|
7
|
-
use :monitor
|
8
|
-
|
9
|
-
Sequel.database_timezone = :utc
|
10
|
-
Sequel.application_timezone = :local
|
11
|
-
|
12
|
-
rom_config = ROM::Configuration.new(
|
13
|
-
:sql,
|
14
|
-
persistence.settings.database_url,
|
15
|
-
extensions: [:error_sql]
|
16
|
-
)
|
17
|
-
|
18
|
-
rom_config.plugin(:sql, relations: :instrumentation) do |p|
|
19
|
-
p.notifications = notifications
|
20
|
-
end
|
21
|
-
|
22
|
-
persistence.register("config", rom_config)
|
23
|
-
end
|
24
|
-
|
25
|
-
start do
|
26
|
-
config = persistence["persistence.config"]
|
27
|
-
config.auto_registration(persistence.root.join("lib/persistence"))
|
28
|
-
|
29
|
-
persistence.register("rom", ROM.container(config))
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
require "<%= config[:underscored_app_name] %>/transactions"
|
2
|
-
|
3
|
-
<%= config[:camel_cased_app_name] %>::Transactions.define do |t|
|
4
|
-
# Define your dry-transaction objects here:
|
5
|
-
#
|
6
|
-
# t.define "transactions.users.sign_up" do
|
7
|
-
# step :persist, with: "users.operations.sign_up"
|
8
|
-
# # other steps here
|
9
|
-
# end
|
10
|
-
end
|
File without changes
|
@@ -1,11 +0,0 @@
|
|
1
|
-
require "<%= config[:underscored_app_name] %>/view_controller"
|
2
|
-
|
3
|
-
module <%= config[:camel_cased_app_name] %>
|
4
|
-
module Views
|
5
|
-
class Welcome < <%= config[:camel_cased_app_name] %>::ViewController
|
6
|
-
configure do |config|
|
7
|
-
config.template = "welcome"
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
data/lib/dry/web/roda/skeletons/sub_app/system/__underscored_app_name__/view_controller.rb.tt
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require "slim"
|
2
|
-
require "dry-view"
|
3
|
-
require "<%= config[:underscored_app_name] %>/container"
|
4
|
-
|
5
|
-
module <%= config[:camel_cased_app_name] %>
|
6
|
-
class ViewController < Dry::View::Controller
|
7
|
-
configure do |config|
|
8
|
-
config.paths = [Container.root.join("web/templates")]
|
9
|
-
config.context = Container["view_context"]
|
10
|
-
config.layout = "application"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,8 +0,0 @@
|
|
1
|
-
require_relative "<%= config[:underscored_app_name] %>/container"
|
2
|
-
|
3
|
-
<%= config[:camel_cased_app_name] %>::Container.finalize!
|
4
|
-
|
5
|
-
require "<%= config[:underscored_app_name] %>/application"
|
6
|
-
require "<%= config[:underscored_app_name] %>/transactions"
|
7
|
-
|
8
|
-
<%= config[:camel_cased_app_name] %>::Container.require "transactions/**/*.rb"
|