dry-web-web_pipe 0.1.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 +7 -0
- data/.gitignore +37 -0
- data/.rspec +2 -0
- data/.travis.yml +31 -0
- data/CHANGELOG.md +283 -0
- data/CONTRIBUTING.md +29 -0
- data/Gemfile +36 -0
- data/LICENSE +22 -0
- data/README.md +72 -0
- data/Rakefile +6 -0
- data/dry-web-web_pipe.gemspec +33 -0
- data/exe/dry-web-web_pipe +6 -0
- data/lib/dry/web/web_pipe/cli/generate.rb +18 -0
- data/lib/dry/web/web_pipe/cli.rb +26 -0
- data/lib/dry/web/web_pipe/generate.rb +52 -0
- data/lib/dry/web/web_pipe/generators/abstract_generator.rb +54 -0
- data/lib/dry/web/web_pipe/generators/abstract_project.rb +116 -0
- data/lib/dry/web/web_pipe/generators/flat_project.rb +43 -0
- data/lib/dry/web/web_pipe/generators/inflections.rb +21 -0
- data/lib/dry/web/web_pipe/generators/sub_app.rb +68 -0
- data/lib/dry/web/web_pipe/generators/umbrella_project.rb +29 -0
- data/lib/dry/web/web_pipe/templates/.env.test.tt +1 -0
- data/lib/dry/web/web_pipe/templates/.env.tt +2 -0
- data/lib/dry/web/web_pipe/templates/.gitignore.tt +11 -0
- data/lib/dry/web/web_pipe/templates/.keep +0 -0
- data/lib/dry/web/web_pipe/templates/.rspec +2 -0
- data/lib/dry/web/web_pipe/templates/Gemfile +47 -0
- data/lib/dry/web/web_pipe/templates/README.md.tt +15 -0
- data/lib/dry/web/web_pipe/templates/Rakefile.tt +109 -0
- data/lib/dry/web/web_pipe/templates/application.html.slim +3 -0
- data/lib/dry/web/web_pipe/templates/config.ru.tt +7 -0
- data/lib/dry/web/web_pipe/templates/console.tt +7 -0
- data/lib/dry/web/web_pipe/templates/container.rb.tt +17 -0
- data/lib/dry/web/web_pipe/templates/flat_project/boot.rb.tt +12 -0
- data/lib/dry/web/web_pipe/templates/flat_project/root.rb.tt +16 -0
- data/lib/dry/web/web_pipe/templates/flat_project/router.rb.tt +8 -0
- data/lib/dry/web/web_pipe/templates/flat_project/web.rb.tt +52 -0
- data/lib/dry/web/web_pipe/templates/import.rb.tt +5 -0
- data/lib/dry/web/web_pipe/templates/monitor.rb.tt +10 -0
- data/lib/dry/web/web_pipe/templates/operation.rb.tt +11 -0
- data/lib/dry/web/web_pipe/templates/persistence.rb.tt +36 -0
- data/lib/dry/web/web_pipe/templates/repository.rb.tt +11 -0
- data/lib/dry/web/web_pipe/templates/sample_data.rb +1 -0
- data/lib/dry/web/web_pipe/templates/seed.rb +1 -0
- data/lib/dry/web/web_pipe/templates/settings.rb.tt +10 -0
- data/lib/dry/web/web_pipe/templates/setup +7 -0
- data/lib/dry/web/web_pipe/templates/spec/db_spec_helper.rb.tt +23 -0
- data/lib/dry/web/web_pipe/templates/spec/factories/example.rb +9 -0
- data/lib/dry/web/web_pipe/templates/spec/spec_helper.rb.tt +61 -0
- data/lib/dry/web/web_pipe/templates/spec/support/db/factory.rb +8 -0
- data/lib/dry/web/web_pipe/templates/spec/support/db/helpers.rb.tt +13 -0
- data/lib/dry/web/web_pipe/templates/spec/support/web/helpers.rb.tt +9 -0
- data/lib/dry/web/web_pipe/templates/spec/web_spec_helper.rb +37 -0
- data/lib/dry/web/web_pipe/templates/subapp/boot.rb.tt +5 -0
- data/lib/dry/web/web_pipe/templates/subapp/container.rb.tt +21 -0
- data/lib/dry/web/web_pipe/templates/subapp/import.rb.tt +7 -0
- data/lib/dry/web/web_pipe/templates/subapp/root.rb.tt +18 -0
- data/lib/dry/web/web_pipe/templates/subapp/router.rb.tt +10 -0
- data/lib/dry/web/web_pipe/templates/subapp/view.rb.tt +17 -0
- data/lib/dry/web/web_pipe/templates/subapp/view_context.rb.tt +8 -0
- data/lib/dry/web/web_pipe/templates/subapp/web.rb.tt +54 -0
- data/lib/dry/web/web_pipe/templates/subapp/welcome.rb.tt +13 -0
- data/lib/dry/web/web_pipe/templates/types.rb +6 -0
- data/lib/dry/web/web_pipe/templates/umbrella_project/boot.rb.tt +18 -0
- data/lib/dry/web/web_pipe/templates/umbrella_project/router.rb.tt +8 -0
- data/lib/dry/web/web_pipe/templates/view.rb.tt +15 -0
- data/lib/dry/web/web_pipe/templates/view_context.rb.tt +31 -0
- data/lib/dry/web/web_pipe/templates/welcome.html.slim +1 -0
- data/lib/dry/web/web_pipe/templates/welcome.rb.tt +11 -0
- data/lib/dry/web/web_pipe/version.rb +7 -0
- data/lib/dry-web-web_pipe.rb +1 -0
- 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 +22 -0
- 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
- data/spec/unit/generators/inflections_spec.rb +33 -0
- metadata +268 -0
@@ -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
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# auto_register: false
|
2
|
+
|
3
|
+
require "rom-repository"
|
4
|
+
require "<%= config[:underscored_project_name] %>/container"
|
5
|
+
require "<%= config[:underscored_project_name] %>/import"
|
6
|
+
|
7
|
+
module <%= config[:camel_cased_app_name] %>
|
8
|
+
class Repository < ROM::Repository::Root
|
9
|
+
include Import.args["persistence.rom"]
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
# Build your sample data here
|
@@ -0,0 +1 @@
|
|
1
|
+
# Build your seed data here
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<%= config[:camel_cased_app_name] %>::Container.boot :settings, from: :system do
|
2
|
+
before :init do
|
3
|
+
require "types"
|
4
|
+
end
|
5
|
+
|
6
|
+
settings do
|
7
|
+
key :session_secret, Types::Strict::String.constrained(filled: true)
|
8
|
+
key :database_url, Types::Strict::String.constrained(filled: true)
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative "spec_helper"
|
2
|
+
|
3
|
+
<%= config[:camel_cased_app_name] %>::Container.start :persistence
|
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: Test::DatabaseHelpers.db].strategy = :truncation
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
config.include Test::DatabaseHelpers
|
13
|
+
|
14
|
+
config.before :suite do
|
15
|
+
DatabaseCleaner.clean_with :truncation
|
16
|
+
end
|
17
|
+
|
18
|
+
config.around :each do |example|
|
19
|
+
DatabaseCleaner.cleaning do
|
20
|
+
example.run
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# Define your factories here, e.g.
|
2
|
+
#
|
3
|
+
# Factory.define :article do |f|
|
4
|
+
# f.sequence(:slug) { |i| "article-#{i}" }
|
5
|
+
# f.title { fake(:lorem, :words, 5) }
|
6
|
+
# f.body { fake(:lorem, :paragraphs, 1) }
|
7
|
+
# end
|
8
|
+
#
|
9
|
+
# See https://github.com/rom-rb/rom-factory for more.
|
@@ -0,0 +1,61 @@
|
|
1
|
+
ENV["RACK_ENV"] = "test"
|
2
|
+
|
3
|
+
require "pry-byebug"
|
4
|
+
|
5
|
+
SPEC_ROOT = Pathname(__FILE__).dirname
|
6
|
+
|
7
|
+
Dir[SPEC_ROOT.join("support/*.rb").to_s].each(&method(:require))
|
8
|
+
Dir[SPEC_ROOT.join("shared/*.rb").to_s].each(&method(:require))
|
9
|
+
|
10
|
+
require SPEC_ROOT.join("../system/<%= config[:underscored_project_name] %>/container")
|
11
|
+
|
12
|
+
RSpec.configure do |config|
|
13
|
+
config.disable_monkey_patching!
|
14
|
+
|
15
|
+
config.expect_with :rspec do |expectations|
|
16
|
+
# This option will default to `true` in RSpec 4.
|
17
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
18
|
+
end
|
19
|
+
|
20
|
+
config.mock_with :rspec do |mocks|
|
21
|
+
# Prevents you from mocking or stubbing a method that does not exist on a
|
22
|
+
# real object. This is generally recommended, and will default to `true`
|
23
|
+
# in RSpec 4.
|
24
|
+
mocks.verify_partial_doubles = true
|
25
|
+
end
|
26
|
+
|
27
|
+
# These two settings work together to allow you to limit a spec run to
|
28
|
+
# individual examples or groups you care about by tagging them with `:focus`
|
29
|
+
# metadata. When nothing is tagged with `:focus`, all examples get run.
|
30
|
+
config.filter_run :focus
|
31
|
+
config.run_all_when_everything_filtered = true
|
32
|
+
|
33
|
+
# Allows RSpec to persist some state between runs in order to support the
|
34
|
+
# `--only-failures` and `--next-failure` CLI options.
|
35
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
36
|
+
|
37
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
38
|
+
# file, and it's useful to allow more verbose output when running an
|
39
|
+
# individual spec file.
|
40
|
+
if config.files_to_run.one?
|
41
|
+
# Use the documentation formatter for detailed output, unless a formatter
|
42
|
+
# has already been configured (e.g. via a command-line flag).
|
43
|
+
config.default_formatter = "doc"
|
44
|
+
end
|
45
|
+
|
46
|
+
# Print the 10 slowest examples and example groups at the end of the spec
|
47
|
+
# run, to help surface which specs are running particularly slow.
|
48
|
+
config.profile_examples = 10
|
49
|
+
|
50
|
+
# Run specs in random order to surface order dependencies. If you find an
|
51
|
+
# order dependency and want to debug it, you can fix the order by providing
|
52
|
+
# the seed, which is printed after each run.
|
53
|
+
# --seed 1234
|
54
|
+
config.order = :random
|
55
|
+
|
56
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
57
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
58
|
+
# test failures related to randomization by passing the same `--seed` value
|
59
|
+
# as the one that triggered the failure.
|
60
|
+
Kernel.srand config.seed
|
61
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require_relative "db_spec_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/web/*.rb").to_s].each(&method(:require))
|
9
|
+
Dir[SPEC_ROOT.join("shared/web/*.rb").to_s].each(&method(:require))
|
10
|
+
|
11
|
+
require SPEC_ROOT.join("../system/boot").realpath
|
12
|
+
|
13
|
+
Capybara.app = Test::WebHelpers.app
|
14
|
+
Capybara.server_port = 3001
|
15
|
+
Capybara.save_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
|
+
window_size: [1600, 768],
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
RSpec.configure do |config|
|
30
|
+
config.include Rack::Test::Methods, type: :request
|
31
|
+
config.include Rack::Test::Methods, Capybara::DSL, type: :feature
|
32
|
+
config.include Test::WebHelpers
|
33
|
+
|
34
|
+
config.before :suite do
|
35
|
+
Test::WebHelpers.app.freeze
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,5 @@
|
|
1
|
+
require_relative "<%= config[:underscored_umbrella_name] %>/<%= config[:underscored_project_name] %>/container"
|
2
|
+
|
3
|
+
<%= config[:camel_cased_umbrella_name] %>::<%= config[:camel_cased_app_name] %>::Container.finalize!
|
4
|
+
|
5
|
+
require "<%= config[:underscored_umbrella_name] %>/<%= config[:underscored_project_name] %>/router"
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "pathname"
|
2
|
+
require "dry/web/container"
|
3
|
+
require "dry/system/components"
|
4
|
+
|
5
|
+
module <%= config[:camel_cased_umbrella_name] %>
|
6
|
+
module <%= config[:camel_cased_app_name] %>
|
7
|
+
class Container < Dry::Web::Container
|
8
|
+
require root.join("system/<%= config[:underscored_umbrella_name] %>/container")
|
9
|
+
import core: <%= config[:camel_cased_umbrella_name] %>::Container
|
10
|
+
|
11
|
+
configure do |config|
|
12
|
+
config.root = Pathname(__FILE__).join("../../..").realpath.dirname.freeze
|
13
|
+
config.logger = <%= config[:camel_cased_umbrella_name] %>::Container[:logger]
|
14
|
+
config.default_namespace = "<%= config[:underscored_umbrella_name] %>.<%= config[:underscored_project_name] %>"
|
15
|
+
config.auto_register = %w[lib/<%= config[:underscored_umbrella_name] %>/<%= config[:underscored_project_name] %>]
|
16
|
+
end
|
17
|
+
|
18
|
+
load_paths! "lib"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "web_pipe"
|
2
|
+
require "<%= config[:underscored_umbrella_name] %>/<%= config[:underscored_project_name] %>/web"
|
3
|
+
|
4
|
+
module <%= config[:camel_cased_umbrella_name] %>
|
5
|
+
module <%= config[:camel_cased_app_name] %>
|
6
|
+
module Actions
|
7
|
+
class Root
|
8
|
+
include WebPipe
|
9
|
+
|
10
|
+
compose :web, Web.new
|
11
|
+
|
12
|
+
plug(:view) do |conn|
|
13
|
+
conn.view('views.welcome')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -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,54 @@
|
|
1
|
+
require "web_pipe"
|
2
|
+
require 'web_pipe/plugs/content_type'
|
3
|
+
require "web_pipe/plugs/config"
|
4
|
+
require "rack/csrf"
|
5
|
+
require "rack/session/cookie"
|
6
|
+
require 'rack-flash'
|
7
|
+
require "<%= config[:underscored_umbrella_name] %>/<%= config[:underscored_project_name] %>/container"
|
8
|
+
|
9
|
+
WebPipe.load_extensions(
|
10
|
+
:container,
|
11
|
+
:cookies,
|
12
|
+
:flash,
|
13
|
+
:dry_schema,
|
14
|
+
:dry_view,
|
15
|
+
:params,
|
16
|
+
:redirect,
|
17
|
+
:router_params,
|
18
|
+
:session,
|
19
|
+
:url
|
20
|
+
)
|
21
|
+
|
22
|
+
module <%= config[:camel_cased_umbrella_name] %>
|
23
|
+
module <%= config[:camel_cased_app_name] %>
|
24
|
+
class Web
|
25
|
+
include WebPipe
|
26
|
+
|
27
|
+
use :cookies, Rack::Session::Cookie, key: "<%= config[:underscored_project_name] %>.session", secret: Container["core.settings"].session_secret
|
28
|
+
use :csrf, Rack::Csrf, raise: true
|
29
|
+
use :flash, Rack::Flash
|
30
|
+
|
31
|
+
plug :config, WebPipe::Plugs::Config.(
|
32
|
+
container: Container,
|
33
|
+
|
34
|
+
view_context: lambda do |conn|
|
35
|
+
{
|
36
|
+
flash: conn.flash,
|
37
|
+
csrf_token: Rack::Csrf.token(conn.env),
|
38
|
+
csrf_metatag: Rack::Csrf.metatag(conn.env),
|
39
|
+
csrf_tag: Rack::Csrf.tag(conn.env)
|
40
|
+
}
|
41
|
+
end,
|
42
|
+
|
43
|
+
sanitization_handler: lambda do |conn, result|
|
44
|
+
conn.
|
45
|
+
set_status(500).
|
46
|
+
set_response_body("Params #{conn.params} do not conform with the schema: #{result.errors.inspect}").
|
47
|
+
halt
|
48
|
+
end
|
49
|
+
)
|
50
|
+
|
51
|
+
plug :content_type, WebPipe::Plugs::ContentType.('text/html')
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require "<%= config[:underscored_umbrella_name] %>/<%= config[:underscored_project_name] %>/view"
|
2
|
+
|
3
|
+
module <%= config[:camel_cased_umbrella_name] %>
|
4
|
+
module <%= config[:camel_cased_app_name] %>
|
5
|
+
module Views
|
6
|
+
class Welcome < View
|
7
|
+
configure do |config|
|
8
|
+
config.template = "welcome"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
|
3
|
+
begin
|
4
|
+
require "pry-byebug"
|
5
|
+
rescue LoadError
|
6
|
+
end
|
7
|
+
|
8
|
+
require_relative "<%= config[:underscored_project_name] %>/container"
|
9
|
+
|
10
|
+
<%= config[:camel_cased_app_name] %>::Container.finalize!
|
11
|
+
|
12
|
+
# Load sub-apps
|
13
|
+
app_paths = Pathname(__FILE__).dirname.join("../apps").realpath.join("*")
|
14
|
+
Dir[app_paths].each do |f|
|
15
|
+
require "#{f}/system/boot"
|
16
|
+
end
|
17
|
+
|
18
|
+
require_relative "<%= config[:underscored_project_name] %>/router"
|
@@ -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
|
@@ -0,0 +1 @@
|
|
1
|
+
h1 Welcome to dry-web-web_pipe!
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require "<%= config[:underscored_project_name] %>/view"
|
2
|
+
|
3
|
+
module <%= config[:camel_cased_app_name] %>
|
4
|
+
module Views
|
5
|
+
class Welcome < <%= config[:camel_cased_app_name] %>::View
|
6
|
+
configure do |config|
|
7
|
+
config.template = "welcome"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require "dry/web/web_pipe/application"
|
data/script/ci
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
set -euo pipefail
|
3
|
+
IFS=$'\n\t'
|
4
|
+
|
5
|
+
setup() {
|
6
|
+
./script/setup
|
7
|
+
}
|
8
|
+
|
9
|
+
teardown() {
|
10
|
+
./script/teardown
|
11
|
+
}
|
12
|
+
|
13
|
+
run_all() {
|
14
|
+
bundle exec rake
|
15
|
+
}
|
16
|
+
|
17
|
+
run_unit_tests() {
|
18
|
+
bundle exec rake spec:coverage
|
19
|
+
}
|
20
|
+
|
21
|
+
run_isolation_tests() {
|
22
|
+
local pwd=$PWD
|
23
|
+
local root="$pwd/spec/isolation"
|
24
|
+
|
25
|
+
run_tests $root
|
26
|
+
}
|
27
|
+
|
28
|
+
run_integration_tests() {
|
29
|
+
local pwd=$PWD
|
30
|
+
local root="$pwd/spec/integration"
|
31
|
+
|
32
|
+
run_tests $root
|
33
|
+
}
|
34
|
+
|
35
|
+
run_tests() {
|
36
|
+
local root=$1
|
37
|
+
|
38
|
+
for test in $(find $root -name '*_spec.rb')
|
39
|
+
do
|
40
|
+
run_test $test
|
41
|
+
|
42
|
+
if [ $? -ne 0 ]; then
|
43
|
+
local exit_code=$?
|
44
|
+
echo "Failing test: $test"
|
45
|
+
exit $exit_code
|
46
|
+
fi
|
47
|
+
done
|
48
|
+
}
|
49
|
+
|
50
|
+
run_test() {
|
51
|
+
local test=$1
|
52
|
+
|
53
|
+
printf "\n\n\nRunning: $test\n"
|
54
|
+
COVERAGE=true bundle exec rspec $test
|
55
|
+
}
|
56
|
+
|
57
|
+
main() {
|
58
|
+
setup &&
|
59
|
+
run_all
|
60
|
+
# run_unit_tests &&
|
61
|
+
# run_isolation_tests &&
|
62
|
+
# run_integration_tests
|
63
|
+
}
|
64
|
+
|
65
|
+
trap teardown EXIT
|
66
|
+
|
67
|
+
main
|
data/script/setup
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
set -euo pipefail
|
3
|
+
IFS=$'\n\t'
|
4
|
+
|
5
|
+
declare pwd=$PWD
|
6
|
+
declare cache="$pwd/vendor/cache"
|
7
|
+
|
8
|
+
cleanup() {
|
9
|
+
./script/teardown
|
10
|
+
}
|
11
|
+
|
12
|
+
bundle_package() {
|
13
|
+
bundle package --all
|
14
|
+
echo ""
|
15
|
+
}
|
16
|
+
|
17
|
+
# We may need something like this in future if we use github checkouts of gems
|
18
|
+
# (see `install_hanami_frameworks()` in hanami/hanami's setup script)
|
19
|
+
#
|
20
|
+
# install_from_git_checkouts() { }
|
21
|
+
|
22
|
+
install_base_gem() {
|
23
|
+
bundle exec rake build
|
24
|
+
local pkg=`ls $pwd/pkg/*.gem | sort -r | head -1`
|
25
|
+
|
26
|
+
gem install $pkg > /dev/null
|
27
|
+
mv $pkg $cache
|
28
|
+
|
29
|
+
echo "Installed $pkg (from $(git rev-parse HEAD))"
|
30
|
+
echo ""
|
31
|
+
}
|
32
|
+
|
33
|
+
generate_index() {
|
34
|
+
pushd $cache > /dev/null
|
35
|
+
gem generate_index
|
36
|
+
popd > /dev/null
|
37
|
+
echo ""
|
38
|
+
}
|
39
|
+
|
40
|
+
main() {
|
41
|
+
cleanup &&
|
42
|
+
bundle_package &&
|
43
|
+
install_base_gem &&
|
44
|
+
generate_index
|
45
|
+
}
|
46
|
+
|
47
|
+
main
|