{@inheritdoc}

@throws BuildException

@return boolean
7755
public function evaluate()
    {
        $this->validate();

        $free = disk_free_space($this->partition);
        return $free >= $this->parseHumanSizes($this->needed);
    }
682046
public function build()
    {
        $basePath = $this->getBasePath();
        $composerJson = file_get_contents($basePath . '/composer.json');
        $composerLock = file_get_contents($basePath . '/composer.lock');

        if (!$composerJson || !$composerLock) {
            throw new Exception('composer.json or composer.lock could not be found!');
        }

        $this->setJson(json_decode($composerJson));
        $this->setLock(json_decode($composerLock));

        $this->extend('onAfterBuild');
    }
456462
public function build()
    {
        $this->dataObject = array();
        foreach ($this->buildItems['collection'] as $builder) {
            if (!$builder->build()) {
                return false;
            } else {
                $this->dataObject[] = $builder->getResult();
            }
        }

        return true;
    }
1320829
public function canBuild()
    {
        $configuration = $this->getEmailConfiguration();
        $emailAddress = (string)$configuration['defaultMailFromAddress'];

        return \filter_var($emailAddress, FILTER_VALIDATE_EMAIL) !== false;
    }
622881
protected function checkParams()
    {
        if ((null === $this->jar) or !file_exists($this->jar)) {
            throw new BuildException(
                sprintf(
                    'Specify the name of the LiquiBase.jar. "%s" does not exist!',
                    $this->jar
                )
            );
        }

        $this->checkChangeLogFile();

        if (null === $this->classpathref) {
            throw new BuildException('Please provide a classpath!');
        }

        if (null === $this->username) {
            throw new BuildException('Please provide a username for database acccess!');
        }

        if (null === $this->password) {
            throw new BuildException('Please provide a password for database acccess!');
        }

        if (null === $this->url) {
            throw new BuildException('Please provide a url for database acccess!');
        }
    }
939182
public function main()
    {
        $clone = $this->getFactoryInstance('tag');
        $cwd = getcwd();

        if ($this->name === '') {
            throw new BuildException("Tag name must be set.");
        }
        if ($this->repository === '') {
            $prog = $this->getProject();
            $dir = $prog->getProperty('application.startdir');
        } else {
            $dir = $this->repository;
        }

        if ($this->revision !== '') {
            $clone->setRev($this->revision);
        }
        if ($this->user !== null) {
            $clone->setUser($this->user);
        }
        $message = $this->getMessage();
        $clone->setMessage($message);
        $name = $this->getName();
        if ($name == '') {
            throw new BuildException("Name attribute must be set.");
        }
        $clone->addName($name);

        $this->checkRepositoryIsDirAndExists($dir);
        chdir($dir);

        try {
            $this->log("Executing: " . $clone, Project::MSG_INFO);
            $output = $clone->execute();
            if ($output !== '') {
                $this->log($output);
            }
        } catch (Exception $ex) {
            $msg = $ex->getMessage();
            $p = strpos($msg, 'hg returned:');
            if ($p !== false) {
                $msg = substr($msg, $p + 13);
            }
            chdir($cwd);
            throw new BuildException($msg);
        }
        chdir($cwd);
    }
407449
public function main()
    {
        $message = $this->getMessage();
        if ($message === '') {
            throw new BuildException('"message" is a required parameter');
        }

        $user = $this->getUser();

        $clone = $this->getFactoryInstance('commit');
        $msg = sprintf("Commit: '%s'", $message);
        $this->log($msg, Project::MSG_INFO);
        $clone->setQuiet($this->getQuiet());
        $clone->setMessage($message);

        if (trim($user) === "") {
            throw new BuildException('"user" parameter can not be set to ""');
        }
        if ($user !== null) {
            $clone->setUser($user);
            $this->log("Commit: user = '$user'", Project::MSG_VERBOSE);
        }

        if ($this->repository === '') {
            $project = $this->getProject();
            $dir = $project->getProperty('application.startdir');
        } else {
            $dir = $this->repository;
        }
        $this->log('DIR:' . $dir, Project::MSG_INFO);
        $this->log('REPO: ' . $this->repository, Project::MSG_INFO);
        $cwd = getcwd();
        chdir($dir);

        try {
            $this->log("Executing: " . $clone->asString(), Project::MSG_INFO);
            $output = $clone->execute();
            if ($output !== '') {
                $this->log($output);
            }
        } catch (Exception $ex) {
            $msg = $ex->getMessage();
            $this->log("Exception: $msg", Project::MSG_INFO);
            $p = strpos($msg, 'hg returned:');
            if ($p !== false) {
                $msg = substr($msg, $p + 13);
            }
            chdir($cwd);
            throw new BuildException($msg);
        }
        chdir($cwd);
    }
627587
public function main()
    {
        if (!extension_loaded('zip')) {
            throw new BuildException("Zip extension is required");
        }

        if ($this->zipFile === null) {
            throw new BuildException("zipfile attribute must be set!", $this->getLocation());
        }

        if ($this->zipFile->exists() && $this->zipFile->isDirectory()) {
            throw new BuildException("zipfile is a directory!", $this->getLocation());
        }

        if ($this->zipFile->exists() && !$this->zipFile->canWrite()) {
            throw new BuildException("Can not write to the specified zipfile!", $this->getLocation());
        }

        try {
            if ($this->baseDir !== null) {
                if (!$this->baseDir->exists()) {
                    throw new BuildException(
                        "basedir '" . (string) $this->baseDir . "' does not exist!",
                        $this->getLocation()
                    );
                }

                if (empty($this->filesets)) {
                    // add the main fileset to the list of filesets to process.
                    $mainFileSet = $this->fileset;
                    $mainFileSet->setDir($this->baseDir);
                    $this->filesets[] = $mainFileSet;
                }
            }

            if (empty($this->filesets)) {
                throw new BuildException(
                    "You must supply either a basedir "
                    . "attribute or some nested filesets.",
                    $this->getLocation()
                );
            }

            // check if zip is out of date with respect to each
            // fileset
            if ($this->areFilesetsUpToDate()) {
                $this->log("Nothing to do: " . $this->zipFile->__toString() . " is up to date.", Project::MSG_INFO);

                return;
            }

            $this->log("Building zip: " . $this->zipFile->__toString(), Project::MSG_INFO);

            $zip = new ZipArchive();
            $res = $zip->open($this->zipFile->getAbsolutePath(), ZipArchive::CREATE);

            if ($res !== true) {
                throw new Exception("ZipArchive::open() failed with code " . $res);
            }

            if ($this->comment !== '') {
                $isCommented = $zip->setArchiveComment($this->comment);
                if ($isCommented === false) {
                    $this->log("Could not add a comment for the Archive.", Project::MSG_INFO);
                }
            }

            $this->addFilesetsToArchive($zip);

            $zip->close();
        } catch (IOException $ioe) {
            $msg = "Problem creating ZIP: " . $ioe->getMessage();
            throw new BuildException($msg, $ioe, $this->getLocation());
        }
    }
89699
protected function verifyConfiguration()
    {
        // Check that the zend encoder path is specified
        if (empty($this->zendsignPath)) {
            throw new BuildException("Zendenc_sign path must be specified");
        }
        // verify that the zend encoder binary exists
        if (!file_exists($this->zendsignPath)) {
            throw new BuildException("Zendenc_sign not found on path " . $this->zendsignPath);
        }

        // verify that the private key path is defined
        if (empty($this->privateKeyPath)) {
            throw new BuildException("You must define privateKeyPath.");
        }
        // verify that the private key file is readable
        if (!is_readable($this->privateKeyPath)) {
            throw new BuildException("Private key file is not readable: " . $this->privateKeyPath);
        }

        // if template is passed, verify that it is readable
        if (!empty($this->licenseTemplate)) {
            if (!is_readable($this->licenseTemplate)) {
                throw new BuildException("License template file is not readable " . $this->licenseTemplate);
            }
        }

        // check that output file path is defined
        if (empty($this->outputFile)) {
            throw new BuildException("Path where to store the result file needs to be defined in outputFile property");
        }

        // if license template is NOT provided check that all required parameters are defined
        if (empty($this->licenseTemplate)) {
            // check productName
            if (empty($this->productName)) {
                throw new BuildException("Property must be defined: productName");
            }

            // check expires
            if (null === $this->expires) {
                throw new BuildException("Property must be defined: expires");
            }

            // check registeredTo
            if (empty($this->registeredTo)) {
                throw new BuildException("Property must be defined: registeredTo");
            }

            // check hardwareLocked
            if (null === $this->hardwareLocked) {
                throw new BuildException("Property must be defined: hardwareLocked");
            }

            // if hardwareLocked is set to true, check that Host-ID is set
            if ($this->hardwareLocked) {
                if (empty($this->hostID)) {
                    throw new BuildException("If you set hardwareLocked to true hostID must be provided");
                }
            }
        }
    }
979483
private function loadProperties()
    {
        try {
            $properties = new Properties();
            $properties->load($this->file);
        } catch (IOException $ioe) {
            throw new BuildException($ioe);
        }
        return $properties;
    }
672504
public function main(){
        
        if(is_null($this->getDomain())){
            throw new \BuildException('the domain property is required');
        }

        if(is_null($this->getName())){
            throw new \BuildException('the name property is required');
        }

        if(is_null($this->getVersion())){
            throw new \BuildException('the version property is required');
        }

        if(is_null($this->getTasklist())){
            throw new \BuildException('the tasklist property is required');
        }

        try {
            $workflow = $this->getService()->describeWorkflowType([
                'domain' => $this->getDomain(),
                'workflowType' => [
                    'name' => $this->getName(),
                    'version' => $this->getVersion()
                ]
            ]);

            if ($workflow->get('typeInfo')['status'] != 'REGISTERED') {
                throw new \BuildException('the workflow "' . $this->getName() . '" is no more available');
            }

            $this->log('The workflow "' . $this->getName() . '" already exists');
        } catch (SwfException $e) {
            $this->log('Creating "' . $this->getName() . '" v.' . $this->getVersion() . ' workflow');

            $params = [
                'domain' => $this->getDomain(),
                'name' => $this->getName(),
                'version' => $this->getVersion(),
                'description' => $this->getDescription(),
                'defaultTaskStartToCloseTimeout' => $this->getTaskStartToCloseTimeout() ?: 'NONE',
                'defaultExecutionStartToCloseTimeout' => $this->getExecutionStartToCloseTimeout() ?: 'NONE',
                'defaultTaskList' => [
                    'name' => $this->getTasklist()
                ]
            ];

            if ($this->getChildPolicy()) {
                $params['defaultChildPolicy'] = $this->getChildPolicy();
            }

            $this->getService()->registerWorkflowType($params);

            $this->log('"' . $this->getName() . '" v.' . $this->getVersion() . ' workflow successfully created');
        }
    }
1194015
protected function checkBuildConditions()
    {
        /**
         * If the resolver is not shared, we need to build the instance
         */
        if ($this->shared === false) {
            /**
             * The build conditions are met
             */
            return true;
        }

        /**
         * If the resolver is shared, but the instance is not yet built,
         * we need to build it
         */
        if (!is_object($this->instance) || null === $this->instance) {
            /**
             * The build conditions are met
             */
            return true;
        }

        return false;
    }
350647
protected function buildStored()
    {
        return $this->files->exists($file_path = $this->config['build_metadata_path'])
            ? $this->files->get($file_path, $this->use_locking)
            : null;
    }
779040
private function checkParams()
    {
        if ($this->file === null && empty($this->filesets) && empty($this->dirsets)) {
            throw new BuildException(
                "Specify at least one source - a file, dirset or a fileset."
            );
        }

        if ($this->mode === null) {
            throw new BuildException("You have to specify an octal mode for chmod.");
        }

        // check for mode to be in the correct format
        if (!preg_match('/^([0-7]){3,4}$/', $this->mode)) {
            throw new BuildException("You have specified an invalid mode.");
        }
    }
653017
public function main(){
        
        if(is_null($this->getDomain())){
            throw new \BuildException('the domain property is required');
        }

        if(is_null($this->getName())){
            throw new \BuildException('the name property is required');
        }

        if(is_null($this->getVersion())){
            throw new \BuildException('the version property is required');
        }

        if(is_null($this->getTasklist())){
            throw new \BuildException('the tasklist property is required');
        }

        try {
            $activity = $this->getService()->describeActivityType([
                'domain' => $this->getDomain(),
                'activityType' => [
                    'name' => $this->getName(),
                    'version' => $this->getVersion()
                ]
            ]);

            if ($activity->get('typeInfo')['status'] != 'REGISTERED') {
                throw new \BuildException('the activity "' . $this->getName() . '" is no more available');
            }

            $this->log('The activity "' . $this->getName() . '" already exists');
        } catch (SwfException $e) {
            $this->log('Creating "' . $this->getName() . '" v.' . $this->getVersion() . ' activity');

            $params = [
                'domain' => $this->getDomain(),
                'name' => $this->getName(),
                'version' => $this->getVersion(),
                'description' => $this->getDescription(),
                'defaultTaskStartToCloseTimeout' => $this->getStartToCloseTimeout() ?: 'NONE',
                'defaultTaskHeartbeatTimeout' => $this->getHeartbeatTimeout() ?: 'NONE',
                'defaultTaskScheduleToStartTimeout' => $this->getScheduleToStartTimeout() ?: 'NONE',
                'defaultTaskScheduleToCloseTimeout' => $this->getScheduleToCloseTimeout() ?: 'NONE',
                'defaultTaskList' => [
                    'name' => $this->getTasklist()
                ]
            ];

            $this->getService()->registerActivityType($params);

            $this->log('"' . $this->getName() . '" v.' . $this->getVersion() . ' activity successfully created');
        }
    }
794073
public function getClient()
    {
        if ($this->_client === null) {
            try {
                $s3Client = new Aws\S3\S3Client(
                    [
                        'key' => $this->getKey(),
                        'secret' => $this->getSecret(),
                    ]
                );
            } catch (InvalidArgumentException $e) {
                throw new BuildException($e);
            }

            $this->_client = $s3Client;
        }

        return $this->_client;
    }
1116218
public function read($len = null)
    {
        if (FALSE === $this->getInitialized()) {
            $this->initialize();
            $this->setInitialized(TRUE);
        }

        $defaultConfiguration = '';

        if (-1 === version_compare($this->getTYPO3Version(), '0.0.0')) {
            throw new BuildException('You must pass a TYPO3 version via the corresponding parameter in your build file!');
        }

        while (($data = $this->in->read($len)) !== -1) {
            $defaultConfiguration .= $data;
        }

        if ('' === $defaultConfiguration) {
            return -1;
        }

        $this->setDefaultConfiguration($defaultConfiguration);

        $comments = $this->installTool->getDefaultConfigArrayComments($defaultConfiguration);

        $out = $this->createPropertyPathsFromCommentArray($comments);

        return $out;
    }