Skip to content
Open
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
9 changes: 9 additions & 0 deletions .docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: "3"

services:
php:
build: ./images/php
image: intraworlds/workshop-php
working_dir: /usr/src
volumes:
- ..:/usr/src
11 changes: 11 additions & 0 deletions .docker/images/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM php:7.2-cli-alpine

MAINTAINER Zdeněk Zahoř <zdenek.zahor@gmail.com>

RUN \
apk update && \
apk add autoconf g++ make && \
pecl install xdebug && \
docker-php-ext-enable xdebug && \
# TODO Optimalizovat image
curl --silent --location https://raw.githubusercontent.com/composer/getcomposer.org/master/web/installer | php -- --install-dir=/usr/local/bin --filename=composer
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### Zadání
Napiště "univerzální" program, který přečte libovolně dlouhý textový soubor.
Napište "univerzální" program, který přečte libovolně dlouhý textový soubor.
Řádek po řádku bude aplikovat uživatelské filtry a dekorátory. Výstupem programu
bude počet stejných (upravených) řádků a jejich četností.

Expand All @@ -15,11 +15,22 @@ Upravte program tak, aby vypisoval průběžný stav nekonečného streamu.
### Řešení
Bude zveřejněno během workshopu ve středu 28.3.2018. Přijďte :-)

### Příklad
### Příklady
```bash
php old.php example.log
```

```bash
cd .docker
docker-compose run --rm php composer install
docker-compose run --rm php php bin/console.php process-file example.log
```

#### Testy
```bash
docker-compose run --rm php composer tests
```

#### Vstupní soubor
```
[2018-03-13 12:16:10] test.DEBUG: Test message [] []
Expand Down
14 changes: 14 additions & 0 deletions bin/console.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env php
<?php
declare(strict_types=1);

use Symfony\Component\Console\Application;
use ZdenekZahor\IntraWorldsFileProcessor\Cli\Command\ProcessFileCommand;

require_once __DIR__ . '/../vendor/autoload.php';

$application = new Application();

$application->add(new ProcessFileCommand());

$application->run();
16 changes: 15 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
{
"scripts": {
"tests": [
"phpunit tests"
]
},
"require": {
"symfony/console": "~4.0.6"
},
"require-dev": {
"monolog/monolog": "^1.23"
"monolog/monolog": "^1.23",
"phpunit/phpunit": "^7"
},
"autoload": {
"psr-4": {
"ZdenekZahor\\IntraWorldsFileProcessor\\": "src/"
}
}
}
Loading