add version number
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
parent
753a794e94
commit
65d6aff9a2
|
@ -1,4 +1,5 @@
|
|||
box
|
||||
lib/Version.php
|
||||
tests/data
|
||||
tests/vendor
|
||||
updater.phar
|
||||
|
|
4
Makefile
4
Makefile
|
@ -2,9 +2,11 @@ box:
|
|||
curl -L https://github.com/box-project/box2/releases/download/2.7.4/box-2.7.4.phar -o box
|
||||
chmod +x box
|
||||
|
||||
updater.phar: box updater.php lib/*.php
|
||||
updater.phar: box updater.php lib/*.php buildVersionFile.php
|
||||
php buildVersionFile.php
|
||||
./box build -c box.json
|
||||
chmod +x updater.phar
|
||||
rm lib/Version.php
|
||||
|
||||
clean:
|
||||
rm updater.phar
|
||||
|
|
1
box.json
1
box.json
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"chmod": "0755",
|
||||
"directories": ["lib"],
|
||||
"files": ["version.php"],
|
||||
"finder": [
|
||||
{
|
||||
"name": "*.php",
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
|
||||
$currentTag = trim(shell_exec('git describe --tags'));
|
||||
exec('git diff-files --quiet', $output, $returnValue);
|
||||
|
||||
$dirty = $returnValue === 0 ? '' : ' dirty';
|
||||
|
||||
|
||||
$content = '<?php
|
||||
|
||||
namespace NC\Updater;
|
||||
|
||||
class Version {
|
||||
function get() {
|
||||
return \'' . $currentTag . $dirty . '\';
|
||||
}
|
||||
}
|
||||
';
|
||||
|
||||
file_put_contents('lib/Version.php', $content);
|
|
@ -26,15 +26,25 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class UpdateCommand extends Command {
|
||||
protected function configure() {
|
||||
$this
|
||||
->setName('update-code')
|
||||
->setDescription('Updates the code of an Nextcloud instance')
|
||||
->setHelp("This command fetches the latest code that is announced via the updater server and safely replaces the existing code with the new one.")
|
||||
;
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output) {
|
||||
// TODO
|
||||
}
|
||||
protected function configure() {
|
||||
$this
|
||||
->setName('update-code')
|
||||
->setDescription('Updates the code of an Nextcloud instance')
|
||||
->setHelp("This command fetches the latest code that is announced via the updater server and safely replaces the existing code with the new one.");
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output) {
|
||||
if (class_exists('NC\Updater\Version')) {
|
||||
$versionClass = new Version();
|
||||
$version = $versionClass->get();
|
||||
} else {
|
||||
$version = 'directly run from git checkout';
|
||||
}
|
||||
$output->writeln('Nextcloud Updater - version: ' . $version);
|
||||
$output->writeln('');
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
}
|
|
@ -6,6 +6,9 @@ require __DIR__ . '/vendor/autoload.php';
|
|||
use Symfony\Component\Console\Application;
|
||||
use NC\Updater\UpdateCommand;
|
||||
|
||||
ini_set('display_errors', '0');
|
||||
ini_set('log_errors', '1');
|
||||
|
||||
$application = new Application();
|
||||
$application->add(new UpdateCommand());
|
||||
$application->setDefaultCommand('update');
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace NC\Updater;
|
||||
|
||||
function getUpdaterVersion() {
|
||||
return '0.0.1-test-4-gd1856c7 dirty';
|
||||
}
|
Loading…
Reference in New Issue