Exemple #1
0
// TODO Add code here to check permissions on staged files.
//$files = file(nZEDb_ROOT . 'nzedb/build/git-hooks'), FILE_IGNORE_NEW_LINES);
//foreach ($files as $file) {
//	echo "Filename: $file\n";
//}
/**
 * Add all hooks BEFORE the versions are updated so they can be skipped on any errors
 */
if ($error === false) {
    $git = new Git();
    $branch = $git->active_branch();
    if (in_array($branch, $git->mainBranches())) {
        // Only update versions, etc. on specific branches to lessen conflicts
        if ($error === false) {
            try {
                $vers = new Versions();
                $vers->checkAll();
                $vers->save();
                $git->add(nZEDb_VERSIONS);
            } catch (\Exception $e) {
                $error = 1;
                echo "Error while checking versions!\n";
                echo $e->getMessage() . "\n";
            }
        }
    } else {
        echo "not 'dev', 'next-master', or 'master' branch, skipping version/patch updates\n";
    }
} else {
    echo "Error in pre-commit hooks!!\n";
}
Exemple #2
0
 *
 * You should have received a copy of the GNU General Public License
 * along with this program (see LICENSE.txt in the base directory.  If
 * not, see:
 *
 * @link <http://www.gnu.org/licenses/>.
 * @author niel
 * @copyright 2014 nZEDb
 */
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'www' . DIRECTORY_SEPARATOR . 'config.php';
use nzedb\utility\Utility;
use nzedb\utility\Versions;
if (!Utility::isCLI()) {
    exit;
}
$vers = new Versions();
if (isset($argc) && $argc > 1 && isset($argv[1]) && $argv[1] == true) {
    echo $vers->out->header("Checking versions...");
    if ($vers->checkAll()) {
        $vers->save();
    } else {
        echo "No changes detected.\n";
        output($vers);
    }
} else {
    $vers->checkAll(false);
    echo "Version info in file:\n";
    output($vers);
}
function output($vers)
{
Exemple #3
0
 public static function getValidVersionsFile()
 {
     $versions = new Versions();
     return $versions->getValidVersionsFile();
 }
Exemple #4
0
 public function version()
 {
     return $this->_versions === false ? '0.0.0' : $this->_versions->getTagVersion();
 }