<?php $projDir = dirname($_SERVER['argv'][0]); $configPath = "{$projDir}/config.json"; $projectPath = "{$projDir}/project.json"; if (!is_readable("{$projDir}/custom.php")) { IO::STDERR("Missing required custom.php library!\n"); exit(1); } if (!is_readable($configPath)) { IO::STDERR("Required configuration file \"config.json\" is not found!\n"); exit(1); } require_once "{$projDir}/custom.php"; $config = PBTXJSON::FromJSON($configPath, TRUE); $project = @json_decode(@file_get_contents($projectPath), TRUE); if ($project !== NULL) { // Overwriting template information with project content if (($value = trim(@"{$project['project_id']}")) != "") { IO::STDOUT("App Id... done!\n"); $config->attr('id', $value); $config->addChild($_obj = new PBTXJSON('preference')); $_obj->attr('name', 'App-Identifier'); $_obj->attr('value', $value); } if (($value = trim(@"{$project['version']}")) != "") { IO::STDOUT("App Version... "); if (preg_match('/^(\\d).(\\d).(\\d)(-(\\d+)){0,1}$/', $value, $matches)) { $matches[4] = count($matches) > 4 ? $matches[5] : 0; foreach ($matches as &$value) { $value = @intval($value);