From dc65bfbe5434325b15eda6dfb4ca007a8b5488fa Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 7 Feb 2017 07:09:23 -0800 Subject: [PATCH] Put a Phage skeleton command on the Arcanist experimental branch Summary: Ref T2794. This doesn't do anything useful, but since I'm planning to start using this stuff to do real deployments I don't want to lose it if my laptop gets hit by a bus. This just adds a skeletal `bin/phage` with enough code that I can add actual workflows to Phacility repositories and get `bin/phage remote --hosts ...` working without the code only existing on my laptop. Test Plan: Ran `bin/phage`, saw nothin'. Reviewers: chad Reviewed By: chad Maniphest Tasks: T2794 Differential Revision: https://secure.phabricator.com/D17379 --- bin/phage | 1 + scripts/phage.php | 29 ++++++++++++++++++++++++++++ src/__phutil_library_map__.php | 2 ++ src/phage/workflow/PhageWorkflow.php | 10 ++++++++++ 4 files changed, 42 insertions(+) create mode 120000 bin/phage create mode 100755 scripts/phage.php create mode 100644 src/phage/workflow/PhageWorkflow.php diff --git a/bin/phage b/bin/phage new file mode 120000 index 00000000..0817a287 --- /dev/null +++ b/bin/phage @@ -0,0 +1 @@ +../scripts/phage.php \ No newline at end of file diff --git a/scripts/phage.php b/scripts/phage.php new file mode 100755 index 00000000..1aa5c8f7 --- /dev/null +++ b/scripts/phage.php @@ -0,0 +1,29 @@ +#!/usr/bin/env php +parseStandardArguments(); + +$args->parsePartial(array()); + + +// TODO: This is pretty minimal and should be shared with "arc". +$working_directory = getcwd(); +$working_copy = ArcanistWorkingCopyIdentity::newFromPath($working_directory); +$config = id(new ArcanistConfigurationManager()) + ->setWorkingCopyIdentity($working_copy); + +foreach ($config->getProjectConfig('load') as $load) { + $load = Filesystem::resolvePath($working_copy->getProjectRoot().'/'.$load); + phutil_load_library($load); +} + + +$workflows = id(new PhutilClassMapQuery()) + ->setAncestorClass('PhageWorkflow') + ->execute(); +$workflows[] = new PhutilHelpArgumentWorkflow(); +$args->parseWorkflows($workflows); diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 44494ba0..73b8d638 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -437,6 +437,7 @@ phutil_register_library_map(array( 'ArcanistXUnitTestResultParser' => 'unit/parser/ArcanistXUnitTestResultParser.php', 'CSharpToolsTestEngine' => 'unit/engine/CSharpToolsTestEngine.php', 'NoseTestEngine' => 'unit/engine/NoseTestEngine.php', + 'PhageWorkflow' => 'phage/workflow/PhageWorkflow.php', 'PhpunitTestEngine' => 'unit/engine/PhpunitTestEngine.php', 'PhpunitTestEngineTestCase' => 'unit/engine/__tests__/PhpunitTestEngineTestCase.php', 'PhutilTestCase' => 'unit/engine/phutil/PhutilTestCase.php', @@ -879,6 +880,7 @@ phutil_register_library_map(array( 'ArcanistXUnitTestResultParser' => 'Phobject', 'CSharpToolsTestEngine' => 'XUnitTestEngine', 'NoseTestEngine' => 'ArcanistUnitTestEngine', + 'PhageWorkflow' => 'PhutilArgumentWorkflow', 'PhpunitTestEngine' => 'ArcanistUnitTestEngine', 'PhpunitTestEngineTestCase' => 'PhutilTestCase', 'PhutilTestCase' => 'Phobject', diff --git a/src/phage/workflow/PhageWorkflow.php b/src/phage/workflow/PhageWorkflow.php new file mode 100644 index 00000000..2506f79a --- /dev/null +++ b/src/phage/workflow/PhageWorkflow.php @@ -0,0 +1,10 @@ +