private function updateComponentVersionConstant($version, $componentPath, $componentEntry)
    {
        if (is_null($componentEntry)) {
            return false;
        }

        $path = $this->rootPath() .'/'. $componentPath .'/'. $componentEntry;
        if (!file_exists($path)) {
            throw new \RuntimeException(sprintf(
                'Component entry file %s does not exist',
                $path
            ));
        }

        $entry = file_get_contents($path);

        $replacement = sprintf("const VERSION = '%s';", $version);

        $entry = preg_replace("/const VERSION = [\'\\\"]([0-9.]{0,}|master)[\'\\\"]\;/", $replacement, $entry);

        $result = file_put_contents($path, $entry);

        if (!$result) {
            throw new \RuntimeException('File write failed');
        }

        return true;
    }