Skip to content

Commit

Permalink
Adding data for v4 (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hackwar authored Oct 9, 2024
1 parent 9251437 commit 5665cae
Show file tree
Hide file tree
Showing 9 changed files with 2,186 additions and 1,307 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.59",
"squizlabs/php_codesniffer": "~3.10",
"maximebf/debugbar": "^1.22.3"
"maximebf/debugbar": "^1.22.3",
"phpstan/phpstan": "^1.12"
},
"replace": {
"paragonie/random_compat": "*"
Expand Down
733 changes: 399 additions & 334 deletions composer.lock

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions etc/migrations/20241008231400_add_v4_info.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

use Phinx\Migration\AbstractMigration;

class Addv4Info extends AbstractMigration
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$this->table('packages')
->addColumn('has_v4', 'boolean', ['default' => true])
->update();
}
}
2,677 changes: 1,709 additions & 968 deletions package-lock.json

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ packages:
deprecated: true
has_v2: false
has_v3: false
has_v4: false
compat:
deprecated: true
has_v2: false
has_v3: false
has_v4: false
console:
has_v1: false
controller: ~
Expand All @@ -21,6 +23,7 @@ packages:
deprecated: true
has_v2: false
has_v3: false
has_v4: false
datetime:
abandoned: true
display: DateTime
Expand All @@ -34,6 +37,7 @@ packages:
deprecated: true
has_v2: false
has_v3: false
has_v4: false
filesystem: ~
filter: ~
form:
Expand All @@ -46,12 +50,14 @@ packages:
deprecated: true
has_v2: false
has_v3: false
has_v4: false
http:
display: HTTP
image:
deprecated: true
has_v2: false
has_v3: false
has_v4: false
input: ~
keychain: ~
language: ~
Expand All @@ -60,16 +66,19 @@ packages:
deprecated: true
has_v2: false
has_v3: false
has_v4: false
linkedin:
display: LinkedIn
repo: linkedin-api
deprecated: true
has_v2: false
has_v3: false
has_v4: false
log:
deprecated: true
has_v2: false
has_v3: false
has_v4: false
mediawiki:
display: MediaWiki
repo: mediawiki-api
Expand All @@ -85,6 +94,7 @@ packages:
deprecated: true
has_v2: false
has_v3: false
has_v4: false
preload:
has_v1: false
profiler: ~
Expand All @@ -105,6 +115,7 @@ packages:
deprecated: true
has_v2: false
has_v3: false
has_v4: false
uri:
display: URI
utilities: ~
Expand Down
6 changes: 4 additions & 2 deletions src/Command/Package/SyncCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ protected function doExecute(InputInterface $input, OutputInterface $output): in
$this->helper->getPackageAbandoned($packageName),
$this->helper->getPackageHasVersion1($packageName),
$this->helper->getPackageHasVersion2($packageName),
$this->helper->getPackageHasVersion3($packageName)
$this->helper->getPackageHasVersion3($packageName),
$this->helper->getPackageHasVersion4($packageName)
);
$symfonyStyle->comment("Updated $displayName package data.");
} else {
Expand All @@ -99,7 +100,8 @@ protected function doExecute(InputInterface $input, OutputInterface $output): in
$this->helper->getPackageAbandoned($packageName),
$this->helper->getPackageHasVersion1($packageName),
$this->helper->getPackageHasVersion2($packageName),
$this->helper->getPackageHasVersion3($packageName)
$this->helper->getPackageHasVersion3($packageName),
$this->helper->getPackageHasVersion4($packageName)
);
$symfonyStyle->comment("$displayName package added to the database.");
}
Expand Down
12 changes: 12 additions & 0 deletions src/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,16 @@ public function getPackageHasVersion3(string $package): bool
{
return $this->getPackages()->get("packages.$package.has_v3", true);
}

/**
* Utility method to retrieve whether a package has a 4.x branch
*
* @param string $package Package name
*
* @return boolean
*/
public function getPackageHasVersion4(string $package): bool
{
return $this->getPackages()->get("packages.$package.has_v4", true);
}
}
8 changes: 6 additions & 2 deletions src/Model/PackageModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ public function addPackage(
bool $isAbandoned,
bool $hasV1,
bool $hasV2,
bool $hasV3
bool $hasV3,
bool $hasV4
): void {
$db = $this->getDb();

Expand All @@ -69,6 +70,7 @@ public function addPackage(
'has_v1' => (int) $hasV1,
'has_v2' => (int) $hasV2,
'has_v3' => (int) $hasV3,
'has_v4' => (int) $hasV4,
];

$db->insertObject('#__packages', $data);
Expand Down Expand Up @@ -198,7 +200,8 @@ public function updatePackage(
bool $isAbandoned,
bool $hasV1,
bool $hasV2,
bool $hasV3
bool $hasV3,
bool $hasV4
): void {
$db = $this->getDb();

Expand All @@ -213,6 +216,7 @@ public function updatePackage(
'has_v1' => (int) $hasV1,
'has_v2' => (int) $hasV2,
'has_v3' => (int) $hasV3,
'has_v4' => (int) $hasV4,
];

$db->updateObject('#__packages', $data, 'id');
Expand Down
9 changes: 9 additions & 0 deletions templates/status.twig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<th scope="col">1.x Series</th>
<th scope="col">2.x Series</th>
<th scope="col">3.x Series</th>
<th scope="col">4.x Series</th>
<th scope="col">PRs</th>
</tr>
</thead>
Expand Down Expand Up @@ -56,6 +57,14 @@
<a href="https://ci.joomla.org/joomla-framework/{{ release.package.repo }}"><img src="https://ci.joomla.org/api/badges/joomla-framework/{{ release.package.repo }}/status.svg?ref=refs/heads/3.x-dev" alt="Build Status" /></a>
{% endif %}
</td>
<td data-label="4.x Series">
{% if not release.package.has_v4 %}
N/A
{% else %}
{{ release.v4.version }}
<a href="https://ci.joomla.org/joomla-framework/{{ release.package.repo }}"><img src="https://ci.joomla.org/api/badges/joomla-framework/{{ release.package.repo }}/status.svg?ref=refs/heads/4.x-dev" alt="Build Status" /></a>
{% endif %}
</td>
<td data-label="PRs">
<a href="https://github.com/joomla-framework/{{ release.package.repo }}/pulls">{{ release.package.pullcount }}</a>
</td>
Expand Down

0 comments on commit 5665cae

Please sign in to comment.