3 final class HarbormasterManagementPublishWorkflow
4 extends HarbormasterManagementWorkflow
{
6 protected function didConstruct() {
9 ->setExamples(pht('**publish** __buildable__ ...'))
12 'Publish a buildable. This is primarily useful for developing '.
13 'and debugging applications which have buildable objects.'))
17 'name' => 'buildable',
23 public function execute(PhutilArgumentParser
$args) {
24 $viewer = $this->getViewer();
26 $buildable_names = $args->getArg('buildable');
27 if (!$buildable_names) {
28 throw new PhutilArgumentUsageException(
30 'Name one or more buildables to publish, like "B123".'));
33 $query = id(new PhabricatorObjectQuery())
35 ->withNames($buildable_names);
39 $result_map = $query->getNamedResults();
41 foreach ($buildable_names as $name) {
42 if (!isset($result_map[$name])) {
43 throw new PhutilArgumentUsageException(
45 'Argument "%s" does not name a buildable. Provide one or more '.
46 'valid buildable monograms or PHIDs.',
51 foreach ($result_map as $name => $result) {
52 if (!($result instanceof HarbormasterBuildable
)) {
53 throw new PhutilArgumentUsageException(
55 'Object "%s" is not a HarbormasterBuildable (it is a "%s"). '.
56 'Name one or more buildables to publish, like "B123".',
62 foreach ($result_map as $buildable) {
67 $buildable->getMonogram()));
69 // Reload the buildable to pick up builds.
70 $buildable = id(new HarbormasterBuildableQuery())
72 ->withIDs(array($buildable->getID()))
76 $engine = id(new HarbormasterBuildEngine())
78 ->publishBuildable($buildable, $buildable);