Differential D8600 Diff 20391 src/applications/harbormaster/step/PublishFragmentBuildStepImplementation.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/harbormaster/step/PublishFragmentBuildStepImplementation.php
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | if ($fragment === null) { | ||||
if ($file->getMimeType() === "application/zip") { | if ($file->getMimeType() === "application/zip") { | ||||
$fragment->updateFromZIP(PhabricatorUser::getOmnipotentUser(), $file); | $fragment->updateFromZIP(PhabricatorUser::getOmnipotentUser(), $file); | ||||
} else { | } else { | ||||
$fragment->updateFromFile(PhabricatorUser::getOmnipotentUser(), $file); | $fragment->updateFromFile(PhabricatorUser::getOmnipotentUser(), $file); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
public function validateSettings() { | |||||
$settings = $this->getSettings(); | |||||
if ($settings['path'] === null || !is_string($settings['path'])) { | |||||
return false; | |||||
} | |||||
if ($settings['artifact'] === null || | |||||
!is_string($settings['artifact'])) { | |||||
return false; | |||||
} | |||||
// TODO: Check if the file artifact is provided by previous build steps. | |||||
return true; | |||||
} | |||||
public function getArtifactInputs() { | public function getArtifactInputs() { | ||||
return array( | return array( | ||||
array( | array( | ||||
'name' => pht('Publishes File'), | 'name' => pht('Publishes File'), | ||||
'key' => $this->getSetting('artifact'), | 'key' => $this->getSetting('artifact'), | ||||
'type' => HarbormasterBuildArtifact::TYPE_FILE, | 'type' => HarbormasterBuildArtifact::TYPE_FILE, | ||||
), | ), | ||||
); | ); | ||||
} | } | ||||
public function getSettingDefinitions() { | public function getFieldSpecifications() { | ||||
return array( | return array( | ||||
'path' => array( | 'path' => array( | ||||
'name' => 'Path', | 'name' => pht('Path'), | ||||
'description' => | 'type' => 'text', | ||||
'The path of the fragment that will be published.', | 'required' => true, | ||||
'type' => BuildStepImplementation::SETTING_TYPE_STRING), | ), | ||||
'artifact' => array( | 'artifact' => array( | ||||
'name' => 'File Artifact', | 'name' => pht('File Artifact'), | ||||
'description' => | 'type' => 'text', | ||||
'The file artifact that will be published to Phragment.', | 'required' => true, | ||||
'type' => BuildStepImplementation::SETTING_TYPE_ARTIFACT, | ), | ||||
'artifact_type' => HarbormasterBuildArtifact::TYPE_FILE)); | ); | ||||
} | } | ||||
} | } |