Skip to content

Commit 5c6d393

Browse files
committed
Merge branch 'develop'
* develop: (65 commits) specify next release fix ci badge add upgrade doc for the next major release remove irrelevant changelog entry update documentation with new APIs fix readme use Attempt<Str> as source of temporary files create the handler inside the wrapper to not expose implementation detail add missing internal flag rename Config::of() to ::new() to better identify it is brand new do not expose internal details of the config defer the access to the config in mappers to give access to the latest config simplify OperatingSystem::map() by only modifying the Config remove useless indirection make CurrentProcess a final class make Signals a final class make Filesystem a final class make Ports a final class make Remote a final class make Sockets a final class ...
2 parents a76ab9c + 987d571 commit 5c6d393

68 files changed

Lines changed: 1905 additions & 3153 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 10 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,16 @@
11
name: CI
22

3-
on: [push]
3+
on: [push, pull_request]
44

55
jobs:
6-
phpunit:
7-
runs-on: ${{ matrix.os }}
8-
strategy:
9-
matrix:
10-
os: [ubuntu-latest, macOS-latest]
11-
php-version: ['8.2', '8.3']
12-
dependencies: ['lowest', 'highest']
13-
name: 'PHPUnit'
14-
steps:
15-
- name: Checkout
16-
uses: actions/checkout@v4
17-
- name: Setup PHP
18-
uses: shivammathur/setup-php@v2
19-
with:
20-
php-version: ${{ matrix.php-version }}
21-
extensions: mbstring, intl
22-
coverage: xdebug
23-
- name: Composer
24-
uses: "ramsey/composer-install@v2"
25-
with:
26-
dependency-versions: ${{ matrix.dependencies }}
27-
- name: PHPUnit
28-
run: php -dmemory_limit=-1 vendor/bin/phpunit --coverage-clover=coverage.clover
29-
- uses: codecov/codecov-action@v3
30-
with:
31-
token: ${{ secrets.CODECOV_TOKEN }}
6+
blackbox:
7+
uses: innmind/github-workflows/.github/workflows/black-box-matrix.yml@main
8+
coverage:
9+
uses: innmind/github-workflows/.github/workflows/coverage-matrix.yml@main
10+
secrets: inherit
3211
psalm:
33-
runs-on: ubuntu-latest
34-
strategy:
35-
matrix:
36-
php-version: ['8.2', '8.3']
37-
dependencies: ['lowest', 'highest']
38-
name: 'Psalm'
39-
steps:
40-
- name: Checkout
41-
uses: actions/checkout@v4
42-
- name: Setup PHP
43-
uses: shivammathur/setup-php@v2
44-
with:
45-
php-version: ${{ matrix.php-version }}
46-
extensions: mbstring, intl
47-
- name: Composer
48-
uses: "ramsey/composer-install@v2"
49-
with:
50-
dependency-versions: ${{ matrix.dependencies }}
51-
- name: Psalm
52-
run: vendor/bin/psalm --shepherd
12+
uses: innmind/github-workflows/.github/workflows/psalm-matrix.yml@main
5313
cs:
54-
runs-on: ubuntu-latest
55-
strategy:
56-
matrix:
57-
php-version: ['8.2']
58-
name: 'CS'
59-
steps:
60-
- name: Checkout
61-
uses: actions/checkout@v4
62-
- name: Setup PHP
63-
uses: shivammathur/setup-php@v2
64-
with:
65-
php-version: ${{ matrix.php-version }}
66-
extensions: mbstring, intl
67-
- name: Composer
68-
uses: "ramsey/composer-install@v2"
69-
- name: CS
70-
run: vendor/bin/php-cs-fixer fix --diff --dry-run
14+
uses: innmind/github-workflows/.github/workflows/cs.yml@main
15+
with:
16+
php-version: '8.2'

.github/workflows/release.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: Create release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
release:
10+
uses: innmind/github-workflows/.github/workflows/release.yml@main
11+
secrets: inherit

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
composer.lock
22
vendor
3-
.phpunit.result.cache
4-
.phpunit.cache
53
.cache

CHANGELOG.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,80 @@
11
# Changelog
22

3+
## 6.0.0 - 2025-05-24
4+
5+
### Added
6+
7+
- `Innmind\OperatingSystem\Config::map()`
8+
- `Innmind\OperatingSystem\Config\Logger`
9+
- `Innmind\OperatingSystem\Config\Resilient`
10+
- `Innmind\OperatingSystem\Config::useHttpTransport()`
11+
- `Innmind\OperatingSystem\Config::mapHttpTransport()`
12+
- `Innmind\OperatingSystem\Config::openSQLConnectionVia()`
13+
- `Innmind\OperatingSystem\Config::mapSQLConnection()`
14+
- `Innmind\OperatingSystem\Config::mapServerControl()`
15+
- `Innmind\OperatingSystem\Config::mapServerStatus()`
16+
- `Innmind\OperatingSystem\Config::mapClock()`
17+
- `Innmind\OperatingSystem\Config::mapFileWatch()`
18+
- `Innmind\OperatingSystem\Config::mountFilesystemVia()`
19+
- `Innmind\OperatingSystem\Config::mapFilesystem()`
20+
21+
### Changed
22+
23+
- Requires `innmind/time-continuum:^4.1.1`
24+
- Requires `innmind/server-status:~5.0`
25+
- Requires `innmind/server-control:~6.0`
26+
- Requires `innmind/filesystem:~8.1`
27+
- Requires `innmind/file-watch:~5.0`
28+
- Requires `innmind/http-transport:~8.0`
29+
- Requires `innmind/time-warp:~4.0`
30+
- Requires `innmind/io:~3.2`
31+
- Requires `innmind/immutable:~5.15`
32+
- `Innmind\OperatingSystem\CurrentProcess::id()` now returns an `Innmind\Immutable\Attempt`
33+
- `Innmind\OperatingSystem\CurrentProcess::halt()` now returns `Innmind\Immutable\Attempt<Innmind\Immutable\SideEffect>`
34+
- `Innmind\OperatingSystem\Filesystem::mount()` now returns an `Innmind\Immutable\Attempt`
35+
- `Innmind\OperatingSystem\Filesystem::temporary()` now returns an `Innmind\Immutable\Attempt`
36+
- `Innmind\OperatingSystem\Ports::open()` now returns an `Innmind\Immutable\Attempt`
37+
- `Innmind\OperatingSystem\Remote::socket()` now returns an `Innmind\Immutable\Attempt`
38+
- `Innmind\OperatingSystem\Sockets::open()` now returns an `Innmind\Immutable\Attempt`
39+
- `Innmind\OperatingSystem\Sockets::takeOver()` now returns an `Innmind\Immutable\Attempt`
40+
- `Innmind\OperatingSystem\Sockets::connectTo()` now returns an `Innmind\Immutable\Attempt`
41+
- `Innmind\OperatingSystem\OperatingSystem` is now a final class
42+
- `Innmind\OperatingSystem\Sockets` is now a final class
43+
- `Innmind\OperatingSystem\Remote` is now a final class
44+
- `Innmind\OperatingSystem\Ports` is now a final class
45+
- `Innmind\OperatingSystem\Filesystem` is now a final class
46+
- `Innmind\OperatingSystem\CurrentProcess\Signals` is now a final class
47+
- `Innmind\OperatingSystem\CurrentProcess` is now a final class
48+
- `Innmind\OperatingSystem\OperatingSystem::map()` callable must now return a `Config`
49+
- `Innmind\OperatingSystem\Config::of()` has been renamed `::new()`
50+
- `Innmind\OperatingSystem\Filesystem::temporary()` now expects a `Innmind\Immutable\Sequence<Innmind\Immutable\Attempt<Innmind\Immutable\Str>>`
51+
52+
### Fixed
53+
54+
- PHP `8.4` deprecations
55+
56+
### Removed
57+
58+
- `Innmind\OperatingSystem\Config::useStreamCapabilities()`
59+
- `Innmind\OperatingSystem\Sockets::watch()`
60+
- `Innmind\OperatingSystem\OperatingSystem\Resilient`
61+
- `Innmind\OperatingSystem\OperatingSystem\Logger`
62+
- `Innmind\OperatingSystem\Config::limitHttpConcurrencyTo()` use `::useHttpTransport()` instead
63+
- `Innmind\OperatingSystem\Config::withHttpHeartbeat()` use `::useHttpTransport()` instead
64+
- `Innmind\OperatingSystem\Config::disableSSLVerification()` use `::useHttpTransport()` instead
65+
- `Innmind\OperatingSystem\Config::caseInsensitiveFilesystem()` use `::mountFilesystemVia()` instead
66+
- The following informations are no longer logged:
67+
- the current process id
68+
- the current process memory
69+
- the signals listener being added/removed
70+
- the signals received by the current process
71+
- temporary files being created
72+
- opened ports
73+
- opened remote sockets
74+
- opened sockets
75+
- if a file/directory exists or not
76+
- when a PHP file is loaded in memory
77+
378
## 5.2.0 - 2024-07-14
479

580
### Changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2018
3+
Copyright (c) 2018-present
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# OperatingSystem
22

3-
[![Build Status](https://github.com/innmind/operatingsystem/workflows/CI/badge.svg?branch=master)](https://github.com/innmind/operatingsystem/actions?query=workflow%3ACI)
3+
[![CI](https://github.com/Innmind/OperatingSystem/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/Innmind/OperatingSystem/actions/workflows/ci.yml)
44
[![codecov](https://codecov.io/gh/innmind/operatingsystem/branch/develop/graph/badge.svg)](https://codecov.io/gh/innmind/operatingsystem)
55
[![Type Coverage](https://shepherd.dev/github/innmind/operatingsystem/coverage.svg)](https://shepherd.dev/github/innmind/operatingsystem)
66

@@ -38,7 +38,10 @@ $os = Factory::build();
3838
```php
3939
use Innmind\Url\Path;
4040

41-
$adapter = $os->filesystem()->mount(Path::of('/var/data/'));
41+
$adapter = $os
42+
->filesystem()
43+
->mount(Path::of('/var/data/'))
44+
->unwrap();
4245
```
4346

4447
`$adater` is an instance of [`Innmind\Filesystem\Adapter`](http://innmind.github.io/Filesystem/).
@@ -55,7 +58,8 @@ use Innmind\Server\Control\Server\Command;
5558
$process = $os
5659
->control()
5760
->processes()
58-
->execute(Command::foreground('echo foo'));
61+
->execute(Command::foreground('echo foo'))
62+
->unwrap();
5963
```
6064

6165
`$process` is an instance of [`Innmind\Server\Control\Server\Process`](https://github.com/innmind/servercontrol#usage).
@@ -74,39 +78,36 @@ $server = $os
7478
IPv4::localhost(),
7579
Port::of(1337),
7680
)
77-
->match(
78-
static fn($server) => $server->unwrap(),
79-
static fn() => throw new \RuntimeException('Cannot open the socket'),
80-
);
81+
->unwrap();
8182
```
8283

83-
`$server` is an instance of [`Innmind\Socket\Server`](https://github.com/innmind/socket#internet-socket).
84+
`$server` is an instance of [`Innmind\IO\Sockets\Servers\Server`](https://innmind.org/io/sockets/).
8485

8586
### Want to open a local socket ?
8687

8788
```php
8889
# process A
8990
use Innmind\Socket\Address\Unix;
9091

91-
$server = $os->sockets()->open(Unix::of('/tmp/foo.sock'))->match(
92-
static fn($server) => $server->unwrap(),
93-
static fn() => throw new \RuntimeException('Cannot open the socket'),
94-
);
92+
$server = $os
93+
->sockets()
94+
->open(Unix::of('/tmp/foo.sock'))
95+
->unwrap();
9596
```
9697

97-
`$server` is an instance of [`Innmind\Socket\Server`](https://github.com/innmind/socket#unix-socket).
98+
`$server` is an instance of [`Innmind\IO\Sockets\Servers\Server`](https://innmind.org/io/sockets/).
9899

99100
```php
100101
# process B
101102
use Innmind\Socket\Address\Unix;
102103

103-
$client = $os->sockets()->connectTo(Unix::of('/tmp/foo.sock'))->match(
104-
static fn($client) => $client->unwrap(),
105-
static fn() => throw new \RuntimeException('Cannot connect to the socket'),
106-
);
104+
$client = $os
105+
->sockets()
106+
->connectTo(Unix::of('/tmp/foo.sock'))
107+
->unwrap();
107108
```
108109

109-
`$client` is an instance of `Innmind\Socket\Client`.
110+
`$client` is an instance of [`Innmind\IO\Sockets\Clients\Client`](https://innmind.org/io/sockets/#clients).
110111

111112
### Want to execute commands on a remote server ?
112113

@@ -118,7 +119,8 @@ $process = $os
118119
->remote()
119120
->ssh(Url::of('ssh://user@server-address:1337'))
120121
->processes()
121-
->execute(Command::foreground('ls'));
122+
->execute(Command::foreground('ls'))
123+
->unwrap();
122124
```
123125

124126
`$process` is an instance of [`Innmind\Server\Control\Server\Process`](https://github.com/innmind/servercontrol#usage).
@@ -127,15 +129,15 @@ $process = $os
127129

128130
```php
129131
use Innmind\Http\{
130-
Message\Request\Request,
131-
Message\Method,
132+
Request,
133+
Method,
132134
ProtocolVersion,
133135
};
134136
use Innmind\Url\Url;
135137

136138
$response = $os
137139
->remote()
138-
->http()(new Request(
140+
->http()(Request::of(
139141
Url::of('http://example.com'),
140142
Method::get,
141143
ProtocolVersion::v20,
@@ -145,15 +147,15 @@ $response = $os
145147
### Want to access current process id ?
146148

147149
```php
148-
$os->process()->id();
150+
$os->process()->id()->unwrap();
149151
```
150152

151153
### Want to pause the current process ?
152154

153155
```php
154-
use Innmind\TimeContinuum\Earth\Period\Minute;
156+
use Innmind\TimeContinuum\Period;
155157

156-
$os->process()->halt(new Minute(1));
158+
$os->process()->halt(Period::minute(1));
157159
```
158160

159161
### Want to listen for a signal ?

blackbox.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
declare(strict_types = 1);
3+
4+
require 'vendor/autoload.php';
5+
6+
use Innmind\BlackBox\{
7+
Application,
8+
PHPUnit\Load,
9+
Runner\CodeCoverage,
10+
};
11+
12+
Application::new($argv)
13+
->when(
14+
\getenv('ENABLE_COVERAGE') !== false,
15+
static fn(Application $app) => $app
16+
->codeCoverage(
17+
CodeCoverage::of(
18+
__DIR__.'/src/',
19+
__DIR__.'/tests/',
20+
)
21+
->dumpTo('coverage.clover')
22+
->enableWhen(true),
23+
)
24+
->scenariiPerProof(1),
25+
)
26+
->tryToProve(Load::directory(__DIR__.'/tests/'))
27+
->exit();

composer.json

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,17 @@
1616
},
1717
"require": {
1818
"php": "~8.2",
19-
"innmind/time-continuum": "~3.0",
20-
"innmind/server-status": "~4.0",
21-
"innmind/server-control": "~5.0",
22-
"innmind/filesystem": "~7.1",
23-
"innmind/socket": "~6.0",
24-
"innmind/http-transport": "~7.2",
25-
"innmind/time-warp": "~3.0",
19+
"innmind/time-continuum": "^4.1.1",
20+
"innmind/server-status": "~5.0",
21+
"innmind/server-control": "~6.0",
22+
"innmind/filesystem": "~8.1",
23+
"innmind/http-transport": "~8.0",
24+
"innmind/time-warp": "~4.0",
2625
"innmind/signals": "~3.0",
27-
"innmind/file-watch": "~4.0",
28-
"innmind/stream": "~4.0",
26+
"innmind/file-watch": "~5.0",
2927
"formal/access-layer": "~4.0",
30-
"innmind/io": "~2.7"
28+
"innmind/io": "~3.2",
29+
"innmind/immutable": "~5.15"
3130
},
3231
"autoload": {
3332
"psr-4": {
@@ -40,11 +39,10 @@
4039
}
4140
},
4241
"require-dev": {
43-
"phpunit/phpunit": "~10.2",
4442
"innmind/url": "~4.0",
4543
"innmind/ip": "~3.0",
46-
"vimeo/psalm": "~5.15",
47-
"innmind/black-box": "~5.5",
44+
"innmind/static-analysis": "^1.2.1",
45+
"innmind/black-box": "~6.2",
4846
"innmind/coding-standard": "~2.0"
4947
}
5048
}

0 commit comments

Comments
 (0)