Skip to content

Commit 8b184f5

Browse files
committed
Improve readme and add a script for pull pull request in single command
1 parent 60752af commit 8b184f5

File tree

3 files changed

+98
-73
lines changed

3 files changed

+98
-73
lines changed

pr.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
if [ -z "$1" ]; then
6+
echo "Missing github username"
7+
echo " Usage: pr.sh <your-github-username> <branch = default is master> <repository-name = laravel-chunk-upload>"
8+
exit 1
9+
fi
10+
11+
12+
USERNAME=$1
13+
BRANCH=${2:-master}
14+
REPOSITORY=${3:-laravel-chunk-upload}
15+
16+
cd laravel-chunk-upload
17+
18+
git checkout -b "$USERNAME"-master master
19+
git pull git@github.com:"$USERNAME"/"$REPOSITORY".git "$BRANCH"
20+
cd ..
21+
22+
echo "Done!"

readme.md

Lines changed: 75 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,142 +1,145 @@
1-
# Laravel chunked upload example
1+
# Laravel Chunked Upload Example
22

3-
> This example covers all supported Laravel versions. This implementation will allow us to test all versions at once.
3+
> This example covers all supported versions of Laravel. This implementation allows testing across all versions simultaneously.
44
5-
This repo contains full example for [laravel-chunk-upload](https://github.com/pionl/laravel-chunk-upload) package.
5+
This repository contains a full example for the [laravel-chunk-upload](https://github.com/pionl/laravel-chunk-upload) package. You can either explore an example app or run tests against all supported versions of Laravel.
66

77
* [Usage](#usage)
88
* [Compatibility](#compatibility)
9-
* [Run tests](#tests)
10-
* [Example code](#example-code)
11-
* [Testing your contribution](#testing-your-contribution)
12-
* [Adding new Laravel release](#adding-a-support-for-new-laravel-release)
9+
* [Running Tests](#tests)
10+
* [Example Code](#example-code)
11+
* [Testing Your Contribution](#testing-your-contribution)
12+
* [Contribution](#contribution)
1313

1414
## Install
1515

16+
```bash
17+
git clone git@github.com:pionl/laravel-chunk-upload-example.git --recurse-submodules
18+
npm install
1619
```
17-
git clone git@github.com:pionl/laravel-chunk-upload-example.git --recurse-submodules --remote-submodules
18-
npm install --only=production
19-
```
20+
21+
## Requirements
22+
23+
- PHP Installed if running locally
24+
- Node.js
25+
- Docker and Docker Compose installed
2026

2127
## Usage
2228

23-
**Install and run specific Laravel version. Use X.\* version format.**
29+
**To install and run a specific version of Laravel, use the X.\* version format.**
2430

25-
```
31+
```bash
2632
node run.js "8.*"
2733
```
2834

29-
> Pass --ignore-example to ignore updating and building example
30-
> Pass --verbose for debug info
31-
35+
> Pass _--ignore-example_ to ignore updating and building the example.
36+
>
37+
> Pass _--verbose_ for debug information.
3238
33-
open http://localhost:8000
39+
Open http://localhost:8000
3440

35-
## Compatibility
41+
## Compatibility
3642

37-
> Current version of laravel-chunk-upload is tested against:
43+
> The current version of laravel-chunk-upload is tested against:
3844
3945
| Laravel | PHP | Run | Tests |
4046
|---------|---------------------------------------|-------------------|------------------------|
47+
| 10.* | 8.2-node-20, 8.2-node-20 | `node run "11.*"` | `node tests.js "11.*"` |
4148
| 10.* | 8.1-node-17, 8.2-node-18 | `node run "10.*"` | `node tests.js "10.*"` |
4249
| 9.* | 8.0-node-17, 8.1-node-17, 8.2-node-18 | `node run "9.*"` | `node tests.js "9.*"` |
4350
| 8.* | 7.4-node-17, 8.0-node-17, 8.1-node-17 | `node run "8.*"` | `node tests.js "8.*"` |
4451
| 7.* | 7.4-node-17 | `node run "7.*"` | `node tests.js "7.*"` |
4552

4653
## Tests
4754

48-
> Pass --verbose for debug info
55+
> Pass --verbose for debug information.
4956
50-
**Run tests on all Laravel versions (install them before using it)**
57+
**Run tests on all Laravel versions (install them before using it) using docker**
5158

52-
```
59+
```bash
5360
node tests.js
5461
```
5562

56-
**Run tests on desired Laravel version**
63+
**Run tests on a desired Laravel version**
5764

58-
```
65+
```bash
5966
node tests.js "8.*"
6067
```
6168

62-
### Tests locally
69+
### Running Tests Locally
6370

64-
> Run `npm install` without production.
71+
* In one terminal, run `php 7.\*/artisan serve --host=0.0.0.0 --port=8000`.
72+
* In a second terminal, run tests with `./node_modules/.bin/codeceptjs run --steps`.
73+
* `npm run test-debug` will show the browser while tests are running.
6574

66-
* In one terminal run `php 7.\*/artisan serve --host=0.0.0.0 --port=8000`
67-
* In second terminal run tests `./node_modules/.bin/codeceptjs run --steps`
68-
* `npm run test-debug` will show browser while tests are running.
75+
### Docker-Compose
6976

70-
### Docker-compose
71-
72-
* Environment variables should be passed: `IMAGE_VERSION` (php version) and `LARAVEL_VERSION`.
73-
* `abort-on-container-exit` needs to be used to stop Laravel server.
77+
* Environment variables should be passed: `IMAGE_VERSION` (PHP version) and `LARAVEL_VERSION`.
78+
* `abort-on-container-exit` needs to be used to stop the Laravel server.
7479

7580
```bash
7681
IMAGE_VERSION=7.4 LARAVEL_VERSION=8.\* docker-compose -f docker-compose.yml -f docker-compose-tests.yml up --abort-on-container-exit
7782
```
7883

79-
## Running tests on latest Laravel release
84+
## Testing Your Contribution
8085

81-
**I did not find a way how to install Laravel on master with the latest changes from framework -- let me know if you know how**
86+
> Do not commit your changes - use a pull request in the main repo.
8287
83-
## Testing your contribution
88+
* Replace the `laravel-chunk-upload` folder with your repository (clone your fork).
89+
* Or you can pull changes from your fork with with given bash script:
8490

85-
> Do not commit your changes - use pull request in main repo
91+
```bash
92+
pr.sh <your-github-username> <branch = default is master> <repository-name = laravel-chunk-upload>
93+
```
94+
* Run tests on all versions with `node tests.js` to ensure backward compatibility.
8695

87-
* Replace `laravel-chunk-upload` folder with your repository (clone your fork)
88-
* Maintainer can pull PR
89-
90-
```bash
91-
cd laravel-chunk-upload
92-
git checkout -b drjdr-master master
93-
git pull https://github.com/drjdr/laravel-chunk-upload.git master
94-
cd ..
95-
```
96-
* Run tests on all versions `node tests.js` to ensure backward compatibility.
96+
## Adding Support for a New Laravel Release
9797

98-
## Adding a support for new Laravel release
98+
- Docker and Docker Compose installed.
99+
- Node.js installed.
99100

100-
- Docker + docker compose installed
101-
- Node.js installed
101+
> Do not commit your changes - use a pull request in the main repo.
102102
103-
> Do not commit your changes - use pull request in main repo
103+
* Add a new version to the `versions.json` file.
104+
* Add your changes to the `laravel-chunk-upload` folder.
105+
* Test the Laravel version with `node tests.js "10.\*"`.
106+
* Run tests on all versions with `node tests.js` to ensure backward compatibility.
104107

105-
* Add a new version to `versions.json` file.
106-
* Add your changes to `laravel-chunk-upload` folder
107-
* Test the Laravel version `node tests.js "10.\*"`
108-
* Run tests on all versions `node tests.js` to ensure backward compatibility.
108+
## Example Code
109109

110-
## Example code
110+
* **Controller - Dynamic Usage** at [./example/src/Http/Controllers/UploadController.php](./example/src/Http/Controllers/UploadController.php)
111+
* **Views** at [./example/resources/views/example/](./example/resources/views/example/) - Here, you can find a basic layout for the providers.
112+
* **JavaScript** at [./example/resources/assets/js/](./example/resources/assets/js/) - Here, you can find the initial setup for the providers.
111113

112-
* **Controller - dynamic usage** at [./example/src/Http/Controllers/UploadController.php](./example/src/Http/Controllers/UploadController.php)
113-
* **Views** at [./example/resources/views/example/](./example/resources/views/example/) - Here you can find basic layout for the providers.
114-
* **Javascripts** at [./example/resources/assets/js/](./example/resources/assets/js/) - Here you can find the initial setup for the providers.
114+
### Uploading to Amazon S3 (or Any Other Cloud Storage)
115115

116-
### Uploading to AMAZON s3 (or any other cloud storage)
116+
* It is recommended to upload the file in a separate queue JOB. Uploading can take time (for large files), and the request could get timed out.
117+
* It is important to stream the file to the cloud (not using `file_get_contents`), which would consume your memory.
118+
* Also, don't forget to remove the uploaded file after the upload.
117119

118-
* It is recommended to upload the file in separate queue JOB. Uploading can take a time (for large files) and the request could
119-
get timed out.
120-
* It is important to stream the file to the cloud (not using `file_get_contents`) which would eat your memory.
121-
* Also don't forget to remove the uploaded file after the upload.
120+
Example code found at [./example/src/Http/Controllers/UploadController.php](./example/src/Http/Controllers/UploadController.php#L59).
122121

123-
Example code found at [./example/sr/Http/Controllers/UploadController.php](./example/src/Http/Controllers/UploadController.php#L59).
124122

125-
## Contribution in example
123+
## Contribution
126124

127-
* If you make changes in assets, do not forget to call `node compile.js` to compile the changes and publish them to all version (you can also pass desired version)
125+
* If you make changes in assets, do not forget to call `node compile.js` to compile the changes and publish them to all versions (you can also pass the desired version).
128126

129127
# TODO
130128

131-
- Improve example controller
132-
- Add tests to dropzone
133-
- clean storage after tests
134-
- Add tests for paraller save
129+
- Improve example controller.
130+
- Add tests to Dropzone.
131+
- Clean storage after tests.
132+
- Add tests for parallel save.
133+
134+
### Running Tests on the Latest Laravel Release
135+
136+
**I did not find a way to install Laravel on master with the latest changes from the framework. Let me know if you know how.**
137+
135138

136139
## Copyright and License
137140

138141
[laravel-chunk-upload-example](https://github.com/pionl/laravel-chunk-upload-example)
139-
was written by [Martin Kluska](http://kluska.cz) and is released under the
142+
was written by [Martin Kluska](http://kluska.cz) and is released under the
140143
[MIT License](LICENSE.md).
141144

142-
Copyright (c) 2017 and beyond Martin Kluska
145+
Copyright (c) 2017 and beyond Martin Kluska and all the contributors (Thank you ❤️)

0 commit comments

Comments
 (0)