Skip to content

Commit

Permalink
Merge 94052c0 into 8c73ab6
Browse files Browse the repository at this point in the history
  • Loading branch information
frankdejonge committed Apr 5, 2020
2 parents 8c73ab6 + 94052c0 commit ce5a864
Show file tree
Hide file tree
Showing 70 changed files with 514 additions and 303 deletions.
5 changes: 4 additions & 1 deletion .gitattributes
@@ -1,6 +1,7 @@
* text=auto

/.github export-ignore
/build export-ignore
.php_cs export-ignore
.gitattributes export-ignore
.gitignore export-ignore
Expand All @@ -11,7 +12,9 @@ phpstan.neon export-ignore
phpunit.xml.dist export-ignore
README.md export-ignore
/src/Integration/ export-ignore
/src/CodeGeneration/Fixtures/ export-ignore
/src/TestUtilities/ export-ignore
/src/CodeGeneration/ export-ignore
**/*Test.php export-ignore
**/*Stub.php export-ignore
**/Dummy*.php export-ignore
/docs export-ignore
3 changes: 2 additions & 1 deletion .gitignore
@@ -1,6 +1,7 @@
vendor/
.php_cs.cache
.phpunit.result.cache
coverage/
coverage.xml
composer.lock
.idea/
.idea/
4 changes: 4 additions & 0 deletions .php_cs
Expand Up @@ -14,6 +14,10 @@ return PhpCsFixer\Config::create()
'return_type_declaration' => true,
'phpdoc_to_return_type' => true,
'void_return' => true,
'ordered_imports' => [
'sort_algorithm' => 'alpha',
'imports_order' => ['const', 'class', 'function'],
],
])
->setRiskyAllowed(true)
->setFinder($finder);
41 changes: 31 additions & 10 deletions .travis.yml
@@ -1,15 +1,36 @@
language: php

php:
- 7.2
- 7.3
- 7.4snapshot
- nightly

matrix:
allow_failures:
- php: 7.4snapshot
- php: nightly
include:
- php: 7.2
dist: bionic
env: COMPOSER_OPTS=""
- php: 7.2
dist: bionic
env: COMPOSER_OPTS="--prefer-lowest"
- php: 7.3
dist: bionic
env: COMPOSER_OPTS=""
- php: 7.3
dist: bionic
env: COMPOSER_OPTS="--prefer-lowest"
- php: 7.4
dist: bionic
env: COMPOSER_OPTS=""
- php: 7.4
dist: bionic
env: COMPOSER_OPTS="--prefer-lowest"
- php: nightly
dist: bionic
env: COMPOSER_OPTS="--ignore-platform-reqs"
- php: nightly
dist: bionic
env: COMPOSER_OPTS="--ignore-platform-reqs --prefer-lowest"
allow_failures:
- php: nightly
env: COMPOSER_OPTS="--ignore-platform-reqs"
- php: nightly
env: COMPOSER_OPTS="--ignore-platform-reqs --prefer-lowest"

cache:
directories:
Expand All @@ -18,7 +39,7 @@ cache:
sudo: false

install:
- travis_retry composer install
- travis_retry composer update --prefer-dist $COMPOSER_OPTS

script:
- if [[ "${TRAVIS_PHP_VERSION}" == "7.3" ]]; then vendor/bin/php-cs-fixer fix -v --dry-run --using-cache=no; fi
Expand Down
1 change: 1 addition & 0 deletions build/.gitignore
@@ -0,0 +1 @@
splitsh-lite
22 changes: 22 additions & 0 deletions build/install-split.sh
@@ -0,0 +1,22 @@
unameOut="$(uname -s)"
version="v1.0.1"

case "${unameOut}" in
Linux*) url="https://github.com/splitsh/lite/releases/download/${version}/lite_linux_amd64.tar.gz";;
Darwin*) url="https://github.com/splitsh/lite/releases/download/${version}/lite_darwin_amd64.tar.gz";;
*) url=unknown
esac

if [ "${url}" == "unknown" ]; then
echo "FAILED";
exit 1;
fi

wget -O build/split-lite.tar.gz "${url}"
tar -zxpf build/split-lite.tar.gz --directory ./build/
chmod +x build/splitsh-lite
rm build/split-lite.tar.gz




7 changes: 7 additions & 0 deletions build/readme.md
@@ -0,0 +1,7 @@
If you can't run this file on Catalina, run:

```bash
xattr -d com.apple.quarantine ./build/splitsh-lite
```

For more information, checkout https://github.com/splitsh/lite
72 changes: 72 additions & 0 deletions build/release.sh
@@ -0,0 +1,72 @@
#!/usr/bin/env bash

set -e

# Make sure the release tag is provided.
if (( "$#" != 1 ))
then
echo "Tag has to be provided."
exit 1
fi

RELEASE_BRANCH="2.x"
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
VERSION=$1

# Make sure current branch and release branch match.
if [[ "$RELEASE_BRANCH" != "$CURRENT_BRANCH" ]]
then
echo "Release branch ($RELEASE_BRANCH) does not match the current active branch ($CURRENT_BRANCH)."
exit 1
fi

# Make sure the working directory is clear.
if [[ ! -z "$(git status --porcelain)" ]]
then
echo "Your working directory is dirty. Did you forget to commit your changes?"
exit 1
fi

# Make sure latest changes are fetched first.
git fetch origin

# Make sure that release branch is in sync with origin.
if [[ $(git rev-parse HEAD) != $(git rev-parse origin/$RELEASE_BRANCH) ]]
then
echo "Your branch is out of date with its upstream. Did you forget to pull or push any changes before releasing?"
exit 1
fi

# Strip prepended "v", if present
if [[ $VERSION == v* || $VERSION == V* ]]
then
VERSION="${VERSION:1}"
fi

# Tag Core
git tag $VERSION
git push origin --tags

# Tag Components
for REMOTE in CodeGeneration TestUtilities
do
echo ""
echo ""
echo "Releasing $REMOTE";

TMP_DIR="/tmp/eventsauce-split"
REMOTE_URL="git@github.com:EventSaucePHP/$REMOTE.git"

rm -rf $TMP_DIR;
mkdir $TMP_DIR;

(
cd $TMP_DIR;

git clone $REMOTE_URL .
git checkout "$RELEASE_BRANCH";

git tag $VERSION
git push origin --tags
)
done
30 changes: 30 additions & 0 deletions build/split.sh
@@ -0,0 +1,30 @@
#!/usr/bin/env bash

set -e
set -x


if [ ! -f "./build/splitsh-lite" ]; then
bash build/install-split.sh
fi

CURRENT_BRANCH="master"

function split()
{
SHA1=`./build/splitsh-lite --prefix=$1 --origin=origin/$CURRENT_BRANCH`
git push $2 "$SHA1:refs/heads/$CURRENT_BRANCH" -f
}

function remote()
{
git remote add $1 $2 || true
}

git pull origin $CURRENT_BRANCH

remote CodeGeneration git@github.com:EventSaucePHP/CodeGeneration.git
remote TestUtilities git@github.com:EventSaucePHP/TestUtilities.git

split 'src/CodeGeneration' CodeGeneration
split 'src/TestUtilities' TestUtilities
12 changes: 8 additions & 4 deletions composer.json
Expand Up @@ -9,14 +9,18 @@
"email": "info@frenky.net"
}
],
"suggest": {
"eventsauce/code-generation": "Code generation for EventSauce",
"eventsauce/test-utilities": "Base test tooling for testing aggregates",
"eventsauce/doctrine-message-repository": "Doctrine implementation of the message repository"
},
"require": {
"php": "^7.2",
"ramsey/uuid": "^3.6",
"symfony/yaml": "^3.2|^4.0|^5.0"
"php": "^7.2"
},
"require-dev": {
"phpstan/phpstan": "^0.11.16",
"phpunit/phpunit": "^7.0|^8.0",
"phpunit/phpunit": "^7.0|^8.0|^9.0",
"symfony/yaml": "^3.2|^4.0|^5.0",
"friendsofphp/php-cs-fixer": "^2.15"
},
"autoload": {
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/architecture.md
Expand Up @@ -21,7 +21,7 @@ The core of EventSauce revolves around a set of **3** interfaces:
The `AggregateRootRepository` is the main interface. It is responsible for
retrieving and persisting aggregate root objects. It uses the other two
parts for retrieving and storing `Message` objects (in which events are transported)
and dispatching messages to `Consumer`s. Because EventSauce is based around these
and dispatching messages to `MessageConsumer`s. Because EventSauce is based around these
interfaces it's very easy to modify how the library behaves. The interfaces also
make EventSauce highly customizable without the need for inheritance.

Expand Down Expand Up @@ -93,7 +93,7 @@ object. This object allows you to store additional metadata alongside the event

### Message Dispatcher

The message dispatcher is responsible for sending messages to `Consumer`s. The core
The message dispatcher is responsible for sending messages to `MessageConsumer`s. The core
library ships with a `SynchronousMessageDispatcher` for when you don't need to process
messages asynchronously. If you do want to process events in the background there are
multiple options available.
Expand Down
18 changes: 16 additions & 2 deletions docs/docs/changelog.md
Expand Up @@ -5,9 +5,23 @@ published_at: 2018-03-14
updated_at: 2019-12-10
---

## Unreleased

### Changes

- The `EventSauce\EventSourcing\Consumer` interface was renamed to `EventSauce\EventSourcing\MessageConsumer`.
- The dependency on `ramsey/uuid` was removed.
- The `EventSauce\EventSourcing\UuidAggregateRootId` was removed.
- The `CodeGeneration` module was extracted into a separate package `eventsauce/code-generation`.
- The test utilities were extracted into a separate package `eventsauce/test-utilities`.

### Added

- `Message::timeOfRecording` was added.

## 0.8.0 - 2019-12-21

### New Features
### Added

- `EventDispatcher` was added:<br/>
Dispatch events with ease! The default MessageDispatchingEventDispatcher allows you to
Expand All @@ -23,7 +37,7 @@ updated_at: 2019-12-10

## 0.7.0

### New Features
### Added

- Snapshotting 🤩
- Code Generation supports user defined interfaces for generated classes.
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/event-sourcing/3-configure-persistence.md
Expand Up @@ -9,7 +9,7 @@ updated_at: 2019-12-07
EventSauce has _two_ connections to persistence.

* The `MessageRepository` which contains `Message`s for reconstituting aggregates.
* The `MessageDispatcher` which is used to communicate `Message`s with `Consumer`s.
* The `MessageDispatcher` which is used to communicate `Message`s with `MessageConsumer`s.

Because of EventSauce's design it's possible to use traditional tools
to work like an event store. Databases like [Event Store](https://eventstore.org/)
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/installation.md
Expand Up @@ -22,7 +22,7 @@ composer require eventsauce/doctrine-message-repository

There's also a RabbitMQ dispatcher available. This package is an extension to the php-amqplib/rabbitmq-bundle package.
This is a Symfony specific package which offers a solid integration with the framework. This package provides an
implementation of the `EventSauce\EventSourcing\Consumer` interface, binding it to the
implementation of the `EventSauce\EventSourcing\MessageConsumer` interface, binding it to the
`OldSound\RabbitMqBundle\RabbitMq\ConsumerInterface` which ties into the bundle.

```bash
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/lifecycle.md
Expand Up @@ -116,17 +116,17 @@ When you persist the events from an aggregate root the following things happen:

Responding to messages is the final step of the event sourcing lifecycle.
The `MessageDispatcher` is responsible for passing `Message`s on to
`Consumer`s.
`MessageConsumer`s.

Typical consumer types are:

* Projections: processes events to update "read models".
* Process Managers: listen to events and then perform actions.

```php
use EventSauce\EventSourcing\Consumer;
use EventSauce\EventSourcing\MessageConsumer;

class SomeConsumer implements Consumer
class SomeConsumer implements MessageConsumer
{
public function handle(Message $message)
{
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/reacting-to-events/process-managers.md
Expand Up @@ -6,7 +6,7 @@ updated_at: 2019-06-12
---

In EventSauce process managers are nothing more than an implementation of
the `Consumer` interface. Unlike projections, which feed read models, process
the `MessageConsumer` interface. Unlike projections, which feed read models, process
managers do more than just respond to something that happened. Process
managers **act**. How the process manager interacts with your system depends
on how you've chosen to model this interaction. You can dispatch commands or
Expand All @@ -28,11 +28,11 @@ dispatch new commands:
```php
<?php

use EventSauce\EventSourcing\Consumer;
use EventSauce\EventSourcing\MessageConsumer;
use EventSauce\EventSourcing\Message;
Use League\Tactician\CommandBus;

class ProductRestocker implements Consumer
class ProductRestocker implements MessageConsumer
{
public function __construct(CommandBus $commandBus)
{
Expand Down

0 comments on commit ce5a864

Please sign in to comment.