From 469bf52467ab5d58c53bd36a0d3eca99cb558e29 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 9 Apr 2021 09:00:58 +1000 Subject: [PATCH] self updater --- composer.json | 5 +- composer.lock | 84 ++++++++++++++++++++++- config/ninja.php | 1 + config/self-update.php | 147 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 234 insertions(+), 3 deletions(-) create mode 100644 config/self-update.php diff --git a/composer.json b/composer.json index 85a28203709e..07e68ad2ac1c 100644 --- a/composer.json +++ b/composer.json @@ -36,12 +36,12 @@ "checkout/checkout-sdk-php": "^1.0", "cleverit/ubl_invoice": "^1.3", "coconutcraig/laravel-postmark": "^2.10", + "codedge/laravel-selfupdater": "^3.2", "composer/composer": "^2", "czproject/git-php": "^3.17", - "turbo124/laravel-gmail": "^5", "doctrine/dbal": "^2.10", - "fideloper/proxy": "^4.2", "fakerphp/faker": "^1.14", + "fideloper/proxy": "^4.2", "google/apiclient": "^2.7", "guzzlehttp/guzzle": "^7.0.1", "hashids/hashids": "^4.0", @@ -67,6 +67,7 @@ "stripe/stripe-php": "^7.50", "symfony/http-client": "^5.2", "turbo124/beacon": "^1.0", + "turbo124/laravel-gmail": "^5", "webpatser/laravel-countries": "dev-master#75992ad", "wildbit/swiftmailer-postmark": "^3.3" }, diff --git a/composer.lock b/composer.lock index a665a1d18cda..5b49aaf3fc86 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "64a35682f0e808b80b4784d812271f0b", + "content-hash": "c7966839cf1cb74e25348aff4acadb1c", "packages": [ { "name": "authorizenet/authorizenet", @@ -563,6 +563,88 @@ ], "time": "2021-02-24T13:45:30+00:00" }, + { + "name": "codedge/laravel-selfupdater", + "version": "3.2.2", + "source": { + "type": "git", + "url": "https://github.com/codedge/laravel-selfupdater.git", + "reference": "ade06363a1a8175adcf070f392f1fd25eef5c214" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/codedge/laravel-selfupdater/zipball/ade06363a1a8175adcf070f392f1fd25eef5c214", + "reference": "ade06363a1a8175adcf070f392f1fd25eef5c214", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-zip": "*", + "guzzlehttp/guzzle": "6.* || 7.*", + "laravel/framework": "^8.33.1", + "php": "^7.3 || ^7.4 || ^8.0" + }, + "require-dev": { + "dg/bypass-finals": "^1.3", + "mikey179/vfsstream": "^1.6", + "mockery/mockery": "^1.4", + "orchestra/testbench": "^6.14.0", + "phpunit/phpunit": "^9.5.3" + }, + "type": "library", + "extra": { + "laravel": { + "aliases": { + "Updater": "Codedge\\Updater\\UpdaterFacade" + }, + "providers": [ + "Codedge\\Updater\\UpdaterServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Codedge\\Updater\\": "src/" + }, + "files": [ + "src/helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Holger Lösken", + "email": "holger.loesken@codedge.de", + "homepage": "http://codedge.de", + "role": "Developer" + } + ], + "description": "Providing an auto-updating functionality for your self-hosted Laravel application.", + "keywords": [ + "auto update", + "auto-update", + "laravel", + "laravel application", + "self update", + "self-hosted laravel application", + "self-update", + "update" + ], + "support": { + "issues": "https://github.com/codedge/laravel-selfupdater/issues", + "source": "https://github.com/codedge/laravel-selfupdater" + }, + "funding": [ + { + "url": "https://github.com/codedge", + "type": "github" + } + ], + "time": "2021-03-20T09:31:26+00:00" + }, { "name": "composer/ca-bundle", "version": "1.2.9", diff --git a/config/ninja.php b/config/ninja.php index 35197d2027b5..c5c54a5a6b25 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -15,6 +15,7 @@ return [ 'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_domain' => env('APP_DOMAIN', ''), 'app_version' => '5.1.42', + 'app_tag' => 'v5.1.42', 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', false), diff --git a/config/self-update.php b/config/self-update.php new file mode 100644 index 000000000000..3762d7babe4a --- /dev/null +++ b/config/self-update.php @@ -0,0 +1,147 @@ + env('SELF_UPDATER_SOURCE', 'github'), + + /* + |-------------------------------------------------------------------------- + | Version installed + |-------------------------------------------------------------------------- + | + | Set this to the version of your software installed on your system. + | + */ + + 'version_installed' => env('SELF_UPDATER_VERSION_INSTALLED', config('ninja.app_tag')), + + /* + |-------------------------------------------------------------------------- + | Repository types + |-------------------------------------------------------------------------- + | + | A repository can be of different types, which can be specified here. + | Current options: + | - github + | - http + | + */ + + 'repository_types' => [ + 'github' => [ + 'type' => 'github', + 'repository_vendor' => env('SELF_UPDATER_REPO_VENDOR', 'invoiceninja'), + 'repository_name' => env('SELF_UPDATER_REPO_NAME', 'invoiceninja'), + 'repository_url' => 'https://github.com/', + 'download_path' => env('SELF_UPDATER_DOWNLOAD_PATH', '/tmp'), + 'private_access_token' => env('SELF_UPDATER_GITHUB_PRIVATE_ACCESS_TOKEN', ''), + 'use_branch' => env('SELF_UPDATER_USE_BRANCH', 'v5-stable'), + ], + 'http' => [ + 'type' => 'http', + 'repository_url' => env('SELF_UPDATER_REPO_URL', ''), + 'pkg_filename_format' => env('SELF_UPDATER_PKG_FILENAME_FORMAT', 'v_VERSION_'), + 'download_path' => env('SELF_UPDATER_DOWNLOAD_PATH', '/tmp'), + 'private_access_token' => env('SELF_UPDATER_HTTP_PRIVATE_ACCESS_TOKEN', ''), + ], + ], + + /* + |-------------------------------------------------------------------------- + | Exclude folders from update + |-------------------------------------------------------------------------- + | + | Specific folders which should not be updated and will be skipped during the + | update process. + | + | Here's already a list of good examples to skip. You may want to keep those. + | + */ + + 'exclude_folders' => [ + '__MACOSX', + 'node_modules', + 'bootstrap/cache', + 'bower', + 'storage/app', + 'storage/framework', + 'storage/logs', + 'storage/self-update', + 'public/storage', + 'vendor', + ], + + /* + |-------------------------------------------------------------------------- + | Event Logging + |-------------------------------------------------------------------------- + | + | Configure if fired events should be logged + | + */ + + 'log_events' => env('SELF_UPDATER_LOG_EVENTS', false), + + /* + |-------------------------------------------------------------------------- + | Notifications + |-------------------------------------------------------------------------- + | + | Specify for which events you want to get notifications. Out of the box you can use 'mail'. + | + */ + + 'notifications' => [ + 'notifications' => [ + \Codedge\Updater\Notifications\Notifications\UpdateSucceeded::class => ['mail'], + \Codedge\Updater\Notifications\Notifications\UpdateFailed::class => ['mail'], + \Codedge\Updater\Notifications\Notifications\UpdateAvailable::class => ['mail'], + ], + + /* + * Here you can specify the notifiable to which the notifications should be sent. The default + * notifiable will use the variables specified in this config file. + */ + 'notifiable' => \Codedge\Updater\Notifications\Notifiable::class, + + 'mail' => [ + 'to' => [ + 'address' => env('SELF_UPDATER_MAILTO_ADDRESS', 'notifications@example.com'), + 'name' => env('SELF_UPDATER_MAILTO_NAME', ''), + ], + + 'from' => [ + 'address' => env('SELF_UPDATER_MAIL_FROM_ADDRESS', 'updater@example.com'), + 'name' => env('SELF_UPDATER_MAIL_FROM_NAME', 'Update'), + ], + ], + ], + + /* + |--------------------------------------------------------------------------- + | Register custom artisan commands + |--------------------------------------------------------------------------- + */ + + 'artisan_commands' => [ + 'pre_update' => [ + //'command:signature' => [ + // 'class' => Command class + // 'params' => [] + //] + ], + 'post_update' => [ + + ], + ], + +];