Skip to content

Commit 94153bc

Browse files
authored
Merge pull request #23: Fetch software versions
2 parents 01a8089 + 53d247c commit 94153bc

23 files changed

+1798
-37
lines changed

.gitattributes

+5-7
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,16 @@
22

33
.github export-ignore
44
.phive export-ignore
5-
tests export-ignore
65
.* export-ignore
7-
box.json.dist export-ignore
6+
*.dist export-ignore
7+
*.yaml export-ignore
8+
*.xml export-ignore
89
composer.lock export-ignore
910
composer-require-* export-ignore
10-
docker-compose.yaml export-ignore
1111
Makefile export-ignore
12-
phpunit.xml* export-ignore
13-
psalm.* export-ignore
14-
psalm-baseline.xml export-ignore
1512
infection.* export-ignore
16-
codecov.* export-ignore
13+
tests export-ignore
14+
docs export-ignore
1715
resources/mock export-ignore
1816

1917
*.http binary

README.md

+16-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ composer require internal/dload -W
4040

4141
## Command Line Usage
4242

43-
DLoad offers two main commands:
43+
DLoad offers three main commands:
4444

4545
### List Available Software
4646

@@ -54,6 +54,21 @@ This displays a list of all registered software packages with their IDs, names,
5454
DLoad comes with a pre-configured list of popular tools and software packages ready for download.
5555
You can contribute to this list by submitting issues or pull requests to the DLoad repository.
5656

57+
### Show Downloaded Software
58+
59+
```bash
60+
# View all downloaded software
61+
./vendor/bin/dload show
62+
63+
# Show detailed information about specific software
64+
./vendor/bin/dload show rr
65+
66+
# Show all available software, including those not downloaded
67+
./vendor/bin/dload show --all
68+
```
69+
70+
This command displays information about downloaded software.
71+
5772
### Download Software
5873

5974
```bash

bin/dload

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ use Symfony\Component\Console\CommandLoader\FactoryCommandLoader;
4343
new FactoryCommandLoader([
4444
Command\Get::getDefaultName() => static fn() => new Command\Get(),
4545
Command\ListSoftware::getDefaultName() => static fn() => new Command\ListSoftware(),
46+
Command\Show::getDefaultName() => static fn() => new Command\Show(),
4647
]),
4748
);
4849
$application->setDefaultCommand(Command\Get::getDefaultName(), false);

psalm-baseline.xml

+30-8
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,26 @@
3737
<MoreSpecificReturnType>
3838
<code><![CDATA[list<DownloadConfig>]]></code>
3939
</MoreSpecificReturnType>
40-
<PropertyNotSetInConstructor>
41-
<code><![CDATA[Get]]></code>
42-
<code><![CDATA[Get]]></code>
43-
</PropertyNotSetInConstructor>
4440
</file>
4541
<file src="src/Command/ListSoftware.php">
46-
<PropertyNotSetInConstructor>
47-
<code><![CDATA[ListSoftware]]></code>
48-
<code><![CDATA[ListSoftware]]></code>
49-
</PropertyNotSetInConstructor>
5042
<RiskyTruthyFalsyComparison>
5143
<code><![CDATA[$software->homepage]]></code>
5244
</RiskyTruthyFalsyComparison>
5345
</file>
46+
<file src="src/Command/Show.php">
47+
<InvalidArrayOffset>
48+
<code><![CDATA[$units[$i]]]></code>
49+
</InvalidArrayOffset>
50+
<InvalidOperand>
51+
<code><![CDATA[$bytes /= 1024]]></code>
52+
</InvalidOperand>
53+
<MixedArgument>
54+
<code><![CDATA[$units[$i]]]></code>
55+
</MixedArgument>
56+
<PossiblyFalseArgument>
57+
<code><![CDATA[$destinationPath]]></code>
58+
</PossiblyFalseArgument>
59+
</file>
5460
<file src="src/DLoad.php">
5561
<ArgumentTypeCoercion>
5662
<code><![CDATA[$files]]></code>
@@ -101,6 +107,22 @@
101107
<code><![CDATA[ZipPharArchive]]></code>
102108
</PropertyNotSetInConstructor>
103109
</file>
110+
<file src="src/Module/Binary/Internal/BinaryExecutor.php">
111+
<MixedArgumentTypeCoercion>
112+
<code><![CDATA[$output]]></code>
113+
<code><![CDATA[$output]]></code>
114+
</MixedArgumentTypeCoercion>
115+
</file>
116+
<file src="src/Module/Binary/Internal/VersionComparator.php">
117+
<PossiblyNullArgument>
118+
<code><![CDATA[$versionOnly]]></code>
119+
<code><![CDATA[\preg_replace('/[-+].*$/', '', $constraint)]]></code>
120+
</PossiblyNullArgument>
121+
<RedundantCondition>
122+
<code><![CDATA[!$hasPreB]]></code>
123+
<code><![CDATA[$bIsNum]]></code>
124+
</RedundantCondition>
125+
</file>
104126
<file src="src/Module/Common/Config/Action/Download.php">
105127
<MissingConstructor>
106128
<code><![CDATA[$software]]></code>

psalm.xml

+5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
<RedundantConditionGivenDocblockType errorLevel="suppress"/>
1313
<RedundantCastGivenDocblockType errorLevel="suppress"/>
1414
<MissingOverrideAttribute errorLevel="suppress"/>
15+
<PropertyNotSetInConstructor>
16+
<errorLevel type="suppress">
17+
<directory name="src/Command"/>
18+
</errorLevel>
19+
</PropertyNotSetInConstructor>
1520
</issueHandlers>
1621
<projectFiles>
1722
<directory name="src"/>

resources/software.json

+30-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"alias": "rr",
55
"binary": {
66
"name": "rr",
7-
"pattern": "/^(roadrunner|rr)(?:\\.exe)?$/"
7+
"pattern": "/^(roadrunner|rr)(?:\\.exe)?$/",
8+
"version-command": "--version"
89
},
910
"homepage": "https://roadrunner.dev",
1011
"description": "High-performance PHP application server, load-balancer and process manager written in Golang",
@@ -29,7 +30,8 @@
2930
}
3031
],
3132
"binary": {
32-
"name": "temporal"
33+
"name": "temporal",
34+
"version-command": "--version"
3335
}
3436
},
3537
{
@@ -45,7 +47,8 @@
4547
}
4648
],
4749
"binary": {
48-
"name": "dolt"
50+
"name": "dolt",
51+
"version-command": "--version"
4952
}
5053
},
5154
{
@@ -75,7 +78,8 @@
7578
}
7679
],
7780
"binary": {
78-
"name": "protoc"
81+
"name": "protoc",
82+
"version-command": "--version"
7983
}
8084
},
8185
{
@@ -91,11 +95,12 @@
9195
}
9296
],
9397
"binary": {
94-
"name": "tigerbeetle"
98+
"name": "tigerbeetle",
99+
"version-command": "version"
95100
}
96101
},
97102
{
98-
"name": "CTX ",
103+
"name": "CTX",
99104
"alias": "ctx",
100105
"description": "Context generator and MCP server",
101106
"homepage": "https://docs.ctxgithub.com/",
@@ -108,7 +113,25 @@
108113
],
109114
"binary": {
110115
"name": "ctx",
111-
"pattern": "/^ctx-.*$/"
116+
"pattern": "/^ctx-.*$/",
117+
"version-command": "--version"
118+
}
119+
},
120+
{
121+
"name": "Trap",
122+
"alias": "trap",
123+
"description": "A minimized version of the Buggregator Server that does not require Docker and is intended solely for local use.\n",
124+
"homepage": "https://buggregator.dev/",
125+
"repositories": [
126+
{
127+
"type": "github",
128+
"uri": "buggregator/trap",
129+
"asset-pattern": "/^trap-.*/"
130+
}
131+
],
132+
"binary": {
133+
"name": "trap",
134+
"version-command": "--version"
112135
}
113136
}
114137
]

src/Bootstrap.php

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace Internal\DLoad;
66

7+
use Internal\DLoad\Module\Binary\BinaryProvider;
8+
use Internal\DLoad\Module\Binary\Internal\BinaryProviderImpl;
79
use Internal\DLoad\Module\Common\Architecture;
810
use Internal\DLoad\Module\Common\Internal\Injection\ConfigLoader;
911
use Internal\DLoad\Module\Common\Internal\ObjectContainer;
@@ -100,6 +102,10 @@ public function withConfig(
100102
static fn(Container $container): RepositoryProvider => (new RepositoryProvider())
101103
->addRepositoryFactory($container->get(GithubRepositoryFactory::class)),
102104
);
105+
$this->container->bind(
106+
BinaryProvider::class,
107+
static fn(Container $c): BinaryProvider => $c->get(BinaryProviderImpl::class),
108+
);
103109

104110
return $this;
105111
}

src/Command/Base.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ protected function execute(
9191
*
9292
* @return non-empty-string|null Path to the configuration file
9393
*/
94-
private function getConfigFile(InputInterface $input): ?string
94+
protected function getConfigFile(InputInterface $input): ?string
9595
{
9696
/** @var string|null $config */
9797
$config = $input->getOption('config');

0 commit comments

Comments
 (0)