Skip to content

Commit

Permalink
Changelog: Readme, Composer.json
Browse files Browse the repository at this point in the history
  • Loading branch information
pietrocinaglia committed Sep 7, 2022
1 parent ecb8428 commit b308274
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 52 deletions.
11 changes: 8 additions & 3 deletions Config/laraupdater.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,19 @@
return [

/*
* Temp folder to store update before to install it.
* Temporary folder to store update before to install it.
*/
'tmp_path' => '/../tmp',
'tmp_folder_name' => 'tmp',

/*
* Script's filename called during the update.
*/
'script_filename' => 'upgrade.php',

/*
* URL where your updates are stored ( e.g. for a folder named 'updates', under http://site.com/yourapp ).
*/
'update_baseurl' => 'http://site.com/yourapp/updates',
'update_baseurl' => 'http://localhost:8888/update',

/*
* Set a middleware for the route: updater.update
Expand Down
74 changes: 29 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# LaraUpdater [ self-update for your Laravel App ]

LaraUpdater allows your Laravel Application to auto-update itself ! ;)
LaraUpdater allows your Laravel application to auto-update itself ! ;)

When you release an application is most important maintain it; therefore, could be necessary to publish an update for bugs fixing as well as for new features implementation.

Expand All @@ -14,16 +14,12 @@ WITHOUT LaraUpdate => Do you want to contact them one by one and send them the u

#### WITH LaraUpdater => Let your application (ALONE) detects that a new update is available and notifies its presence to the administrator; furthermore, let your application install it and handles all related steps.

### NEW VERSION change-log
[ thanks to salihkiraz :) ]
- multi lang. supported
- sample views add
- laravel package auto discover added
- laravel 5.7 tested
- zip file extract fixed

### NEW VERSION change-log
- Now it supports Laravel 8 and 9;
- New view based on Bootstrap 5;
- Bugs Fix.

![alt text](readme_files/cover.png "LaraUpdater")

## Features:

Expand All @@ -40,18 +36,22 @@ You can set which users (e.g. only the admin) can perform an update for the app
#### > Fault tolerant
During the update LaraUpdate BACKUPS all files that are overwritten, so if an error occurs it can try to restore automatically the previous state. If the restoring fails, you can use the backup stored in the root of your system for a manual maintenance.

#### > Supports UPGRADE script
#### > Supports PHP script
LaraUpdate can import a PHP script to perform custom actions (e.g. create a table in database after the update); the commands are performed in the last step of update.

#### > Backup/Recovery Integrated

#### > Multi-language


## Getting Started

These instructions will get you a copy of the project up and running on your server for development and testing purposes.

### Prerequisites

LaraUpdater has been tested using Laravel 5.4
Recommended Laravel Version >= 5.x
LaraUpdater has been tested using Laravel 8/9
Recommended Laravel Version >= 8


## Installing
Expand Down Expand Up @@ -83,14 +83,19 @@ When it is published you can manage the configuration of LaraUpdater through the

```
/*
* Temp folder to store update before to install it.
* Temporary folder to store update before to install it.
*/
'tmp_path' => '/../tmp',
'tmp_folder_name' => 'tmp',
/*
* Script's filename called during the update.
*/
'script_filename' => 'upgrade.php',
/*
* URL where your updates are stored ( e.g. for a folder named 'updates', under http://site.com/yourapp ).
*/
'update_baseurl' => 'http://site.com/yourapp/updates',
'update_baseurl' => 'http://localhost:8888/update',
/*
* Set a middleware for the route: updater.update
Expand All @@ -112,7 +117,7 @@ For example, create a .txt file that contains only:
```
1.0
```
...use only 1 row, the first, of the .txt file.
Use only 1 row, the first, of the .txt file.
When release an update this files is updated from LaraUpdate.


Expand All @@ -129,9 +134,10 @@ This file must contain a function named `main()` with a boolean return (to pass
function main(){
command-1-to-connect-db
command-2-to-create-table
command-3-to-insert-data
example:
command-1-to-connect-db
command-2-to-create-table
command-3-to-insert-data
return true;
}
Expand Down Expand Up @@ -188,39 +194,17 @@ This route is protected using the information under `'allow_users_id'` in `confi
I suggest, to not use directly these routes BUT to show an Alert when an update is available; the Alert could be contain a Button to perform the update, see the solution below:


### (Example) Bootstrap 4 and JQuery solution
### Notification popup by using Bootstrap 5 and JQuery (included)

![alt text](readme_files/preview1.png "Alert with Update Button")

Add to `view/layout/app.blade.php` this HTML code (I suggest immediately before of `@yield('content')`):
Add to `resources/view/layout/app.blade.php` this code to load the view included in LaraUpdater (I suggest immediately before of `@yield('content')`):
```
<div id="update_notification" style="display:none;" class="alert alert-info">
<button type="button" style="margin-left: 20px" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
@include('vendor.laraupdater.notification')
```

, now add (at the end of `view/layout/app.blade.php`) this JQuery script:
```
<script>
$(document).ready(function() {
$.ajax({
type: 'GET',
url: 'updater.check',
async: false,
success: function(response) {
if(response != ''){
$('#update_notification').append('<strong>Update Available <span class="badge badge-pill badge-info">v. '+response+'</span></strong><a role="button" href="updater.update" class="btn btn-sm btn-info pull-right">Update Now</a>');
$('#update_notification').show();
}
}
});
});
</script>
```
TEST: publish an update and refresh the page to show the alert :-)

<< END >> ...to test it: publish an update and refresh the page to show the alert :-)

## License

Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pcinaglia/laraupdater",
"description": "LaraUpdater allows your Laravel Application to auto-update itself.",
"description": "LaraUpdater allows your Laravel application to auto-update itself.",
"keywords": [
"self-updater",
"update-checker",
Expand All @@ -10,14 +10,14 @@
],
"homepage": "https://github.com/pietrocinaglia/laraupdater",
"require": {
"php": ">=5.4.0"
"php": ">=7.0.0"
},
"license": "MIT",
"authors": [
{
"name": "Pietro Cinaglia",
"homepage": "http://linkedin.com/in/pietrocinaglia",
"role": "Developer; Software Engineer."
"homepage": "https://github.com/pietrocinaglia",
"role": "Software Engineer."
}
],
"minimum-stability": "dev",
Expand Down
Binary file removed readme_files/cover.png
Binary file not shown.
Binary file modified readme_files/preview1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b308274

Please sign in to comment.