1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 06:42:42 +01:00

Make all bin/* scripts locate their workflows dynamically

Summary:
Ref T2015. Not directly related to Drydock, but I bumped into this. All these scripts currently enumerate their workflows explicitly.

Instead, use `PhutilSymbolLoader` to automatically discover workflows. This reduces code duplication and errors (see all the bad `extends` this diff fixes) and lets third parties add new workflows (not clearly valuable?).

Test Plan: Ran `bin/x help` for each modified script.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2015

Differential Revision: https://secure.phabricator.com/D7840
This commit is contained in:
epriestley 2013-12-27 13:15:48 -08:00
parent e397103bf2
commit ce78bf1de4
24 changed files with 73 additions and 120 deletions

View file

@ -14,9 +14,8 @@ EOHELP
); );
$args->parseStandardArguments(); $args->parseStandardArguments();
$args->parseWorkflows( $workflows = id(new PhutilSymbolLoader())
array( ->setAncestorClass('DivinerWorkflow')
new DivinerGenerateWorkflow(), ->loadObjects();
new DivinerAtomizeWorkflow(), $workflows[] = new PhutilHelpArgumentWorkflow();
new PhutilHelpArgumentWorkflow(), $args->parseWorkflows($workflows);
));

View file

@ -14,12 +14,8 @@ EOSYNOPSIS
); );
$args->parseStandardArguments(); $args->parseStandardArguments();
$workflows = array( $workflows = id(new PhutilSymbolLoader())
new DrydockManagementLeaseWorkflow(), ->setAncestorClass('DrydockManagementWorkflow')
new DrydockManagementCloseWorkflow(), ->loadObjects();
new DrydockManagementReleaseWorkflow(), $workflows[] = new PhutilHelpArgumentWorkflow();
new DrydockManagementCreateResourceWorkflow(),
new PhutilHelpArgumentWorkflow(),
);
$args->parseWorkflows($workflows); $args->parseWorkflows($workflows);

View file

@ -15,13 +15,8 @@ EOSYNOPSIS
); );
$args->parseStandardArguments(); $args->parseStandardArguments();
$workflows = array( $workflows = id(new PhutilSymbolLoader())
new PhabricatorFactManagementDestroyWorkflow(), ->setAncestorClass('PhabricatorFactManagementWorkflow')
new PhabricatorFactManagementAnalyzeWorkflow(), ->loadObjects();
new PhabricatorFactManagementStatusWorkflow(), $workflows[] = new PhutilHelpArgumentWorkflow();
new PhabricatorFactManagementListWorkflow(),
new PhabricatorFactManagementCursorsWorkflow(),
new PhutilHelpArgumentWorkflow(),
);
$args->parseWorkflows($workflows); $args->parseWorkflows($workflows);

View file

@ -14,12 +14,8 @@ EOSYNOPSIS
); );
$args->parseStandardArguments(); $args->parseStandardArguments();
$workflows = array( $workflows = id(new PhutilSymbolLoader())
new PhabricatorFilesManagementEnginesWorkflow(), ->setAncestorClass('PhabricatorFilesManagementWorkflow')
new PhabricatorFilesManagementMigrateWorkflow(), ->loadObjects();
new PhabricatorFilesManagementRebuildWorkflow(), $workflows[] = new PhutilHelpArgumentWorkflow();
new PhabricatorFilesManagementPurgeWorkflow(),
new PhutilHelpArgumentWorkflow(),
);
$args->parseWorkflows($workflows); $args->parseWorkflows($workflows);

View file

@ -14,9 +14,8 @@ EOSYNOPSIS
); );
$args->parseStandardArguments(); $args->parseStandardArguments();
$workflows = array( $workflows = id(new PhutilSymbolLoader())
new PhabricatorLipsumGenerateWorkflow(), ->setAncestorClass('PhabricatorLipsumManagementWorkflow')
new PhutilHelpArgumentWorkflow(), ->loadObjects();
); $workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows); $args->parseWorkflows($workflows);

View file

@ -14,15 +14,9 @@ EOSYNOPSIS
); );
$args->parseStandardArguments(); $args->parseStandardArguments();
$workflows = array( $workflows = id(new PhutilSymbolLoader())
new PhutilHelpArgumentWorkflow(), ->setAncestorClass('PhabricatorMailManagementWorkflow')
new PhabricatorMailManagementResendWorkflow(), ->loadObjects();
new PhabricatorMailManagementShowOutboundWorkflow(), $workflows[] = new PhutilHelpArgumentWorkflow();
new PhabricatorMailManagementShowInboundWorkflow(),
new PhabricatorMailManagementSendTestWorkflow(),
new PhabricatorMailManagementReceiveTestWorkflow(),
new PhabricatorMailManagementListInboundWorkflow(),
new PhabricatorMailManagementListOutboundWorkflow(),
);
$args->parseWorkflows($workflows); $args->parseWorkflows($workflows);

View file

@ -15,16 +15,8 @@ EOSYNOPSIS
); );
$args->parseStandardArguments(); $args->parseStandardArguments();
$workflows = array( $workflows = id(new PhutilSymbolLoader())
new PhabricatorRepositoryManagementPullWorkflow(), ->setAncestorClass('PhabricatorRepositoryManagementWorkflow')
new PhabricatorRepositoryManagementDiscoverWorkflow(), ->loadObjects();
new PhabricatorRepositoryManagementEditWorkflow(), $workflows[] = new PhutilHelpArgumentWorkflow();
new PhabricatorRepositoryManagementListWorkflow(),
new PhabricatorRepositoryManagementDeleteWorkflow(),
new PhabricatorRepositoryManagementMarkImportedWorkflow(),
new PhabricatorRepositoryManagementLookupUsersWorkflow(),
new PhabricatorRepositoryManagementImportingWorkflow(),
new PhutilHelpArgumentWorkflow(),
);
$args->parseWorkflows($workflows); $args->parseWorkflows($workflows);

View file

@ -14,9 +14,8 @@ EOSYNOPSIS
); );
$args->parseStandardArguments(); $args->parseStandardArguments();
$workflows = array( $workflows = id(new PhutilSymbolLoader())
new PhabricatorSearchManagementIndexWorkflow(), ->setAncestorClass('PhabricatorSearchManagementWorkflow')
new PhutilHelpArgumentWorkflow(), ->loadObjects();
); $workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows); $args->parseWorkflows($workflows);

View file

@ -14,9 +14,8 @@ EOSYNOPSIS
); );
$args->parseStandardArguments(); $args->parseStandardArguments();
$workflows = array( $workflows = id(new PhutilSymbolLoader())
new PhabricatorAuditManagementDeleteWorkflow(), ->setAncestorClass('PhabricatorAuditManagementWorkflow')
new PhutilHelpArgumentWorkflow(), ->loadObjects();
); $workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows); $args->parseWorkflows($workflows);

View file

@ -14,11 +14,8 @@ EOSYNOPSIS
); );
$args->parseStandardArguments(); $args->parseStandardArguments();
$workflows = array( $workflows = id(new PhutilSymbolLoader())
new PhabricatorAuthManagementRecoverWorkflow(), ->setAncestorClass('PhabricatorAuthManagementWorkflow')
new PhabricatorAuthManagementRefreshWorkflow(), ->loadObjects();
new PhabricatorAuthManagementLDAPWorkflow(), $workflows[] = new PhutilHelpArgumentWorkflow();
new PhutilHelpArgumentWorkflow(),
);
$args->parseWorkflows($workflows); $args->parseWorkflows($workflows);

View file

@ -14,12 +14,8 @@ EOSYNOPSIS
); );
$args->parseStandardArguments(); $args->parseStandardArguments();
$workflows = array( $workflows = id(new PhutilSymbolLoader())
new PhabricatorConfigManagementListWorkflow(), ->setAncestorClass('PhabricatorConfigManagementWorkflow')
new PhabricatorConfigManagementSetWorkflow(), ->loadObjects();
new PhabricatorConfigManagementGetWorkflow(), $workflows[] = new PhutilHelpArgumentWorkflow();
new PhabricatorConfigManagementDeleteWorkflow(),
new PhutilHelpArgumentWorkflow(),
);
$args->parseWorkflows($workflows); $args->parseWorkflows($workflows);

View file

@ -14,9 +14,8 @@ EOSYNOPSIS
); );
$args->parseStandardArguments(); $args->parseStandardArguments();
$workflows = array( $workflows = id(new PhutilSymbolLoader())
new PhabricatorFeedManagementRepublishWorkflow(), ->setAncestorClass('PhabricatorFeedManagementWorkflow')
new PhutilHelpArgumentWorkflow(), ->loadObjects();
); $workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows); $args->parseWorkflows($workflows);

View file

@ -18,5 +18,4 @@ $workflows = id(new PhutilSymbolLoader())
->setAncestorClass('HarbormasterManagementWorkflow') ->setAncestorClass('HarbormasterManagementWorkflow')
->loadObjects(); ->loadObjects();
$workflows[] = new PhutilHelpArgumentWorkflow(); $workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows); $args->parseWorkflows($workflows);

View file

@ -14,10 +14,8 @@ EOSYNOPSIS
); );
$args->parseStandardArguments(); $args->parseStandardArguments();
$workflows = array( $workflows = id(new PhutilSymbolLoader())
new PhabricatorPolicyManagementShowWorkflow(), ->setAncestorClass('PhabricatorPolicyManagementWorkflow')
new PhabricatorPolicyManagementUnlockWorkflow(), ->loadObjects();
new PhutilHelpArgumentWorkflow(), $workflows[] = new PhutilHelpArgumentWorkflow();
);
$args->parseWorkflows($workflows); $args->parseWorkflows($workflows);

View file

@ -99,14 +99,9 @@ try {
exit(1); exit(1);
} }
$workflows = array( $workflows = id(new PhutilSymbolLoader())
new PhabricatorStorageManagementDatabasesWorkflow(), ->setAncestorClass('PhabricatorStorageManagementWorkflow')
new PhabricatorStorageManagementDestroyWorkflow(), ->loadObjects();
new PhabricatorStorageManagementDumpWorkflow(),
new PhabricatorStorageManagementStatusWorkflow(),
new PhabricatorStorageManagementProbeWorkflow(),
new PhabricatorStorageManagementUpgradeWorkflow(),
);
$patches = PhabricatorSQLPatchList::buildAllPatches(); $patches = PhabricatorSQLPatchList::buildAllPatches();

View file

@ -3740,7 +3740,7 @@ phutil_register_library_map(array(
'PhabricatorBuiltinPatchList' => 'PhabricatorSQLPatchList', 'PhabricatorBuiltinPatchList' => 'PhabricatorSQLPatchList',
'PhabricatorBusyExample' => 'PhabricatorUIExample', 'PhabricatorBusyExample' => 'PhabricatorUIExample',
'PhabricatorCacheDAO' => 'PhabricatorLiskDAO', 'PhabricatorCacheDAO' => 'PhabricatorLiskDAO',
'PhabricatorCacheManagementPurgeWorkflow' => 'PhabricatorSearchManagementWorkflow', 'PhabricatorCacheManagementPurgeWorkflow' => 'PhabricatorCacheManagementWorkflow',
'PhabricatorCacheManagementWorkflow' => 'PhabricatorManagementWorkflow', 'PhabricatorCacheManagementWorkflow' => 'PhabricatorManagementWorkflow',
'PhabricatorCalendarBrowseController' => 'PhabricatorCalendarController', 'PhabricatorCalendarBrowseController' => 'PhabricatorCalendarController',
'PhabricatorCalendarController' => 'PhabricatorController', 'PhabricatorCalendarController' => 'PhabricatorController',
@ -4113,13 +4113,13 @@ phutil_register_library_map(array(
'PhabricatorMailImplementationPHPMailerLiteAdapter' => 'PhabricatorMailImplementationAdapter', 'PhabricatorMailImplementationPHPMailerLiteAdapter' => 'PhabricatorMailImplementationAdapter',
'PhabricatorMailImplementationSendGridAdapter' => 'PhabricatorMailImplementationAdapter', 'PhabricatorMailImplementationSendGridAdapter' => 'PhabricatorMailImplementationAdapter',
'PhabricatorMailImplementationTestAdapter' => 'PhabricatorMailImplementationAdapter', 'PhabricatorMailImplementationTestAdapter' => 'PhabricatorMailImplementationAdapter',
'PhabricatorMailManagementListInboundWorkflow' => 'PhabricatorSearchManagementWorkflow', 'PhabricatorMailManagementListInboundWorkflow' => 'PhabricatorMailManagementWorkflow',
'PhabricatorMailManagementListOutboundWorkflow' => 'PhabricatorSearchManagementWorkflow', 'PhabricatorMailManagementListOutboundWorkflow' => 'PhabricatorMailManagementWorkflow',
'PhabricatorMailManagementReceiveTestWorkflow' => 'PhabricatorSearchManagementWorkflow', 'PhabricatorMailManagementReceiveTestWorkflow' => 'PhabricatorMailManagementWorkflow',
'PhabricatorMailManagementResendWorkflow' => 'PhabricatorSearchManagementWorkflow', 'PhabricatorMailManagementResendWorkflow' => 'PhabricatorMailManagementWorkflow',
'PhabricatorMailManagementSendTestWorkflow' => 'PhabricatorSearchManagementWorkflow', 'PhabricatorMailManagementSendTestWorkflow' => 'PhabricatorMailManagementWorkflow',
'PhabricatorMailManagementShowInboundWorkflow' => 'PhabricatorSearchManagementWorkflow', 'PhabricatorMailManagementShowInboundWorkflow' => 'PhabricatorMailManagementWorkflow',
'PhabricatorMailManagementShowOutboundWorkflow' => 'PhabricatorSearchManagementWorkflow', 'PhabricatorMailManagementShowOutboundWorkflow' => 'PhabricatorMailManagementWorkflow',
'PhabricatorMailManagementWorkflow' => 'PhabricatorManagementWorkflow', 'PhabricatorMailManagementWorkflow' => 'PhabricatorManagementWorkflow',
'PhabricatorMailReceiverTestCase' => 'PhabricatorTestCase', 'PhabricatorMailReceiverTestCase' => 'PhabricatorTestCase',
'PhabricatorMailingListPHIDTypeList' => 'PhabricatorPHIDType', 'PhabricatorMailingListPHIDTypeList' => 'PhabricatorPHIDType',

View file

@ -1,7 +1,7 @@
<?php <?php
final class PhabricatorCacheManagementPurgeWorkflow final class PhabricatorCacheManagementPurgeWorkflow
extends PhabricatorSearchManagementWorkflow { extends PhabricatorCacheManagementWorkflow {
protected function didConstruct() { protected function didConstruct() {
$this $this

View file

@ -1,7 +1,7 @@
<?php <?php
final class PhabricatorMailManagementListInboundWorkflow final class PhabricatorMailManagementListInboundWorkflow
extends PhabricatorSearchManagementWorkflow { extends PhabricatorMailManagementWorkflow {
protected function didConstruct() { protected function didConstruct() {
$this $this

View file

@ -1,7 +1,7 @@
<?php <?php
final class PhabricatorMailManagementListOutboundWorkflow final class PhabricatorMailManagementListOutboundWorkflow
extends PhabricatorSearchManagementWorkflow { extends PhabricatorMailManagementWorkflow {
protected function didConstruct() { protected function didConstruct() {
$this $this

View file

@ -1,7 +1,7 @@
<?php <?php
final class PhabricatorMailManagementReceiveTestWorkflow final class PhabricatorMailManagementReceiveTestWorkflow
extends PhabricatorSearchManagementWorkflow { extends PhabricatorMailManagementWorkflow {
protected function didConstruct() { protected function didConstruct() {
$this $this

View file

@ -1,7 +1,7 @@
<?php <?php
final class PhabricatorMailManagementResendWorkflow final class PhabricatorMailManagementResendWorkflow
extends PhabricatorSearchManagementWorkflow { extends PhabricatorMailManagementWorkflow {
protected function didConstruct() { protected function didConstruct() {
$this $this

View file

@ -1,7 +1,7 @@
<?php <?php
final class PhabricatorMailManagementSendTestWorkflow final class PhabricatorMailManagementSendTestWorkflow
extends PhabricatorSearchManagementWorkflow { extends PhabricatorMailManagementWorkflow {
protected function didConstruct() { protected function didConstruct() {
$this $this

View file

@ -1,7 +1,7 @@
<?php <?php
final class PhabricatorMailManagementShowInboundWorkflow final class PhabricatorMailManagementShowInboundWorkflow
extends PhabricatorSearchManagementWorkflow { extends PhabricatorMailManagementWorkflow {
protected function didConstruct() { protected function didConstruct() {
$this $this

View file

@ -1,7 +1,7 @@
<?php <?php
final class PhabricatorMailManagementShowOutboundWorkflow final class PhabricatorMailManagementShowOutboundWorkflow
extends PhabricatorSearchManagementWorkflow { extends PhabricatorMailManagementWorkflow {
protected function didConstruct() { protected function didConstruct() {
$this $this