Skip to content

[WIP] Add hanami app #355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions ecommerce/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@

module Ecommerce
class Configuration
def initialize(number_generator: nil, payment_gateway: nil, available_vat_rates: [])
def initialize(number_generator: nil, payment_gateway: nil, available_vat_rates: [], event_store:, command_bus:)
@number_generator = number_generator
@payment_gateway = payment_gateway
@available_vat_rates = available_vat_rates
@event_store = event_store
@command_bus = command_bus
end

def call(event_store, command_bus)
Expand All @@ -24,9 +26,6 @@ def call(event_store, command_bus)
end

def configure_bounded_contexts
event_store = Rails.configuration.event_store
command_bus = Rails.configuration.command_bus

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙈

raise ArgumentError.new(
"Neither number_generator nor payment_gateway can be null"
) if @number_generator.nil? || @payment_gateway.nil?
Expand All @@ -41,11 +40,11 @@ def configure_bounded_contexts
Pricing::Configuration.new,
Taxes::Configuration.new(@available_vat_rates),
ProductCatalog::Configuration.new,
].each { |c| c.call(event_store, command_bus) }
].each { |c| c.call(@event_store, @command_bus) }
end

def configure_processes(event_store, command_bus)
Processes::Configuration.new.call(event_store, command_bus)
Processes::Configuration.new.call(@event_store, @command_bus)
end
end
end
2 changes: 2 additions & 0 deletions hanami_application/.bundle/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
BUNDLE_JOBS: "8"
1 change: 1 addition & 0 deletions hanami_application/.env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DATABASE_URL=postgresql://localhost:5432/ecommerce_hanami_dev
1 change: 1 addition & 0 deletions hanami_application/.env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DATABASE_URL=postgresql://localhost:5432/ecommerce_hanami_test
2 changes: 2 additions & 0 deletions hanami_application/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.env
log/*
1 change: 1 addition & 0 deletions hanami_application/.rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--require spec_helper
43 changes: 43 additions & 0 deletions hanami_application/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# frozen_string_literal: true

source "https://rubygems.org"

gem "hanami", "~> 2.0"
gem "hanami-router", "~> 2.0"
gem "hanami-controller", "~> 2.0"
gem "hanami-validations", "~> 2.0"

gem "dry-types", "~> 1.0", ">= 1.6.1"
gem "puma"
gem "rake"

gem "rom"
gem "rom-sql"
gem "pg"

gem "ruby_event_store"
gem "ruby_event_store-rom", require: "ruby_event_store/rom/sql"
gem "arkency-command_bus"

gem "infra", path: "../infra"

group :development, :test do
gem "dotenv"
gem "pry-byebug"
end

group :cli, :development do
gem "hanami-reloader"
end

group :cli, :development, :test do
gem "hanami-rspec"
end

group :development do
gem "guard-puma", "~> 0.8"
end

group :test do
gem "rack-test"
end
292 changes: 292 additions & 0 deletions hanami_application/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,292 @@
PATH
remote: ../infra
specs:
infra (1.0.0)
aggregate_root (~> 2.9.0)
arkency-command_bus
dry-struct
dry-types
rake
ruby_event_store (~> 2.9.0)
ruby_event_store-transformations
sidekiq

GEM
remote: https://rubygems.org/
specs:
activesupport (7.1.0)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
aggregate_root (2.9.1)
ruby_event_store (= 2.9.1)
arkency-command_bus (0.4.1)
concurrent-ruby
base64 (0.1.1)
bigdecimal (3.1.4)
byebug (11.1.3)
coderay (1.1.3)
concurrent-ruby (1.2.2)
connection_pool (2.4.1)
diff-lcs (1.5.0)
dotenv (2.8.1)
drb (2.1.1)
ruby2_keywords
dry-auto_inject (1.0.1)
dry-core (~> 1.0)
zeitwerk (~> 2.6)
dry-cli (1.0.0)
dry-configurable (1.1.0)
dry-core (~> 1.0, < 2)
zeitwerk (~> 2.6)
dry-container (0.11.0)
concurrent-ruby (~> 1.0)
dry-core (1.0.1)
concurrent-ruby (~> 1.0)
zeitwerk (~> 2.6)
dry-events (1.0.1)
concurrent-ruby (~> 1.0)
dry-core (~> 1.0, < 2)
dry-files (1.0.2)
dry-inflector (1.0.0)
dry-initializer (3.1.1)
dry-logger (1.0.3)
dry-logic (1.5.0)
concurrent-ruby (~> 1.0)
dry-core (~> 1.0, < 2)
zeitwerk (~> 2.6)
dry-monitor (1.0.1)
dry-configurable (~> 1.0, < 2)
dry-core (~> 1.0, < 2)
dry-events (~> 1.0, < 2)
dry-schema (1.13.3)
concurrent-ruby (~> 1.0)
dry-configurable (~> 1.0, >= 1.0.1)
dry-core (~> 1.0, < 2)
dry-initializer (~> 3.0)
dry-logic (>= 1.4, < 2)
dry-types (>= 1.7, < 2)
zeitwerk (~> 2.6)
dry-struct (1.6.0)
dry-core (~> 1.0, < 2)
dry-types (>= 1.7, < 2)
ice_nine (~> 0.11)
zeitwerk (~> 2.6)
dry-system (1.0.1)
dry-auto_inject (~> 1.0, < 2)
dry-configurable (~> 1.0, < 2)
dry-core (~> 1.0, < 2)
dry-inflector (~> 1.0, < 2)
dry-transformer (1.0.1)
zeitwerk (~> 2.6)
dry-types (1.7.1)
concurrent-ruby (~> 1.0)
dry-core (~> 1.0)
dry-inflector (~> 1.0)
dry-logic (~> 1.4)
zeitwerk (~> 2.6)
dry-validation (1.10.0)
concurrent-ruby (~> 1.0)
dry-core (~> 1.0, < 2)
dry-initializer (~> 3.0)
dry-schema (>= 1.12, < 2)
zeitwerk (~> 2.6)
ffi (1.16.3)
formatador (1.1.0)
guard (2.18.1)
formatador (>= 0.2.4)
listen (>= 2.7, < 4.0)
lumberjack (>= 1.0.12, < 2.0)
nenv (~> 0.1)
notiffany (~> 0.0)
pry (>= 0.13.0)
shellany (~> 0.0)
thor (>= 0.18.1)
guard-compat (1.2.1)
guard-puma (0.8.1)
guard (~> 2.14)
guard-compat (~> 1.2)
puma (>= 4.0, < 7)
hanami (2.1.0.beta2.1)
bundler (>= 1.16, < 3)
dry-configurable (~> 1.0, < 2)
dry-core (~> 1.0, < 2)
dry-inflector (~> 1.0, < 2)
dry-logger (~> 1.0, < 2)
dry-monitor (~> 1.0, >= 1.0.1, < 2)
dry-system (~> 1.0, < 2)
hanami-cli (~> 2.1.beta)
hanami-utils (~> 2.1.beta)
zeitwerk (~> 2.6)
hanami-cli (2.1.0.beta2)
bundler (~> 2.1)
dry-cli (~> 1.0, < 2)
dry-files (~> 1.0, >= 1.0.2, < 2)
dry-inflector (~> 1.0, < 2)
rake (~> 13.0)
zeitwerk (~> 2.6)
hanami-controller (2.0.2)
dry-configurable (~> 1.0, < 2)
dry-core (~> 1.0)
hanami-utils (~> 2.0)
rack (~> 2.0)
zeitwerk (~> 2.6)
hanami-reloader (2.0.2)
hanami-cli (~> 2.0)
zeitwerk (~> 2.6)
hanami-router (2.0.2)
mustermann (~> 3.0)
mustermann-contrib (~> 3.0)
rack (~> 2.0)
hanami-rspec (2.0.1)
hanami-cli (~> 2.0)
rake (~> 13.0)
rspec (~> 3.12)
zeitwerk (~> 2.6)
hanami-utils (2.1.0.beta1)
concurrent-ruby (~> 1.0)
dry-core (~> 1.0, < 2)
dry-transformer (~> 1.0, < 2)
hanami-validations (2.0.1)
dry-validation (>= 1.10, < 2)
zeitwerk (~> 2.6.0)
hansi (0.2.1)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
ice_nine (0.11.2)
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
lumberjack (1.2.9)
method_source (1.0.0)
minitest (5.20.0)
mustermann (3.0.0)
ruby2_keywords (~> 0.0.1)
mustermann-contrib (3.0.0)
hansi (~> 0.2.0)
mustermann (= 3.0.0)
mutex_m (0.1.2)
nenv (0.3.0)
nio4r (2.5.9)
notiffany (0.1.3)
nenv (~> 0.1)
shellany (~> 0.0)
pg (1.5.4)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.10.1)
byebug (~> 11.0)
pry (>= 0.13, < 0.15)
puma (6.4.0)
nio4r (~> 2.0)
rack (2.2.8)
rack-test (2.1.0)
rack (>= 1.3)
rake (13.0.6)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
redis-client (0.17.0)
connection_pool
rom (5.3.0)
rom-changeset (~> 5.3, >= 5.3.0)
rom-core (~> 5.3, >= 5.3.0)
rom-repository (~> 5.3, >= 5.3.0)
rom-changeset (5.3.0)
dry-core (~> 1.0)
rom-core (~> 5.3)
transproc (~> 1.0, >= 1.1.0)
rom-core (5.3.0)
concurrent-ruby (~> 1.1)
dry-configurable (~> 1.0)
dry-core (~> 1.0)
dry-inflector (~> 1.0)
dry-initializer (~> 3.0, >= 3.0.1)
dry-struct (~> 1.0)
dry-types (~> 1.6)
transproc (~> 1.0, >= 1.1.0)
rom-repository (5.3.0)
dry-core (~> 1.0)
dry-initializer (~> 3.0, >= 3.0.1)
rom-core (~> 5.3, >= 5.3.0)
rom-sql (3.6.1)
dry-core (~> 1.0)
dry-types (~> 1.0)
rom (~> 5.2, >= 5.2.1)
sequel (>= 4.49)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.1)
ruby2_keywords (0.0.5)
ruby_event_store (2.9.1)
concurrent-ruby (~> 1.0, >= 1.1.6)
ruby_event_store-rom (2.2.0)
dry-container (>= 0.6)
dry-initializer (>= 3.0)
dry-types (>= 1.0)
rom-changeset (>= 5.0)
rom-repository (>= 5.0)
rom-sql (>= 3.0)
ruby_event_store (>= 2.0.0, < 3.0.0)
sequel (>= 5.11.0)
ruby_event_store-transformations (0.1.0)
activesupport (>= 5.0)
ruby_event_store (>= 2.0.0, < 3.0.0)
sequel (5.73.0)
bigdecimal
shellany (0.0.1)
sidekiq (7.1.5)
concurrent-ruby (< 2)
connection_pool (>= 2.3.0)
rack (>= 2.2.4)
redis-client (>= 0.14.0)
thor (1.2.2)
transproc (1.1.1)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
zeitwerk (2.6.12)

PLATFORMS
arm64-darwin-20

DEPENDENCIES
arkency-command_bus
dotenv
dry-types (~> 1.0, >= 1.6.1)
guard-puma (~> 0.8)
hanami (~> 2.0)
hanami-controller (~> 2.0)
hanami-reloader
hanami-router (~> 2.0)
hanami-rspec
hanami-validations (~> 2.0)
infra!
pg
pry-byebug
puma
rack-test
rake
rom
rom-sql
ruby_event_store
ruby_event_store-rom

BUNDLED WITH
2.4.20
10 changes: 10 additions & 0 deletions hanami_application/Guardfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# frozen_string_literal: true

group :server do
guard "puma", port: ENV.fetch("HANAMI_PORT", 2300) do
watch(%r{config/*})
watch(%r{lib/*})
watch(%r{app/*})
watch(%r{slices/*})
end
end
Loading