Skip to content
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

[WIP] Add hanami app #355

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
45 changes: 45 additions & 0 deletions hanami_application/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# 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 "hanami-view", "~> 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"
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
Loading