2017-01-16 15:39:46 +01:00
# Contributing
2015-03-13 18:16:11 +01:00
Hi,
2017-01-16 15:39:46 +01:00
this document is made for newcomers in Jirafeau who are digging into the code.
2017-02-23 16:19:03 +01:00
If you have further questions, then just ask for help 🤓.
2017-01-16 15:39:46 +01:00
## General principle
Jirafeau is made in the [KISS ](http://en.wikipedia.org/wiki/KISS_principle ) way (Keep It Simple, Stupid).
It is meant to be a simple filehosting service, simple to use, simple to install, simple to maintain.
This project won't evolve to a file manager and will focus to keep a very few dependencies.
2021-01-19 14:54:35 +09:00
So things like a markdown parser for the ToS or E-Mail tasks would be useful for sure, but may be [rejected ](https://gitlab.com/mojo42/Jirafeau/issues/37#note_1191566 ) since they would a lot of dependencies and makes the project more complex.
2017-01-16 15:39:46 +01:00
## Structure
2015-03-13 18:16:11 +01:00
2021-01-19 14:54:35 +09:00
Here is a little explanation of Jirafeau's structure in a simplified
view only to show the most important files and their role.
2015-03-13 18:16:11 +01:00
2017-01-16 15:57:46 +01:00
```
2015-03-13 18:16:11 +01:00
.
2017-01-20 17:31:35 +01:00
├── admin.php : administration interface to manage links and files
2017-09-08 16:16:15 +02:00
├── docker : folder containing some configuration files to run Jirafeau in docker
2015-03-13 18:16:11 +01:00
├── f.php : permits to download files or show the download page
2017-01-20 17:31:35 +01:00
├── index.php : provides a web interface to interact with API
├── script.php : API interface (all file actions happen here - upload, deletion, etc)
2015-03-13 18:16:11 +01:00
├── install.php : installation script
2017-01-20 17:31:35 +01:00
├── tos.php : "Terms of Service" page
2015-03-13 18:16:11 +01:00
├── lib
2017-01-20 17:31:35 +01:00
│ ├── config.original.php : default parameters
2021-01-19 14:54:35 +09:00
│ ├── config.local.php : the users parameters (auto generated, not versioned)
2017-01-20 17:31:35 +01:00
│ ├── functions_*.js : JavaScript functions for index.php (AJAX etc)
│ ├── functions.php : core functions and tools of Jirafeau
│ ├── tos.original.txt : default text show on the ToS page
2021-01-19 14:54:35 +09:00
│ ├── tos.local.txt : a users alternative text show on the ToS page (not versioned)
2017-01-20 17:31:35 +01:00
│ ├── settings.php : core settings of Jirafeau, includes the configuration params automatically
│ ├── locales : language folder, contains all language files
2015-03-13 18:16:11 +01:00
│ └── template
2017-01-20 17:31:35 +01:00
│ ├── footer.php : footer with links to source and ToS for all HTML views
│ └── header.php : header with logo and title for all HTML views
2015-03-13 18:16:11 +01:00
├── media : folder containing all skins
2021-01-19 14:54:35 +09:00
└── var-xxxxxxx : the users folder containing all data (auto generated, not versioned)
├── async : chunks of uploaded files (not successful yet)
2017-01-20 17:31:35 +01:00
├── files : all files that have been uploaded successfully
2017-09-08 16:16:15 +02:00
│ ├── [hashed file name] : the original file
│ └── [hashed file name]_count : count many links to this file exist
2021-01-19 14:54:35 +09:00
└── links : all links, including metadata, pointing to files
2017-09-08 16:16:15 +02:00
└── [link] : the link file, includes which original file should be used and some meta data like creation date, expiration time
2017-01-16 15:57:46 +01:00
```
2015-07-16 11:55:25 +02:00
2017-01-16 15:39:46 +01:00
## Translations
2021-01-19 14:54:35 +09:00
Translation may be added via [Jirafeau's Weblate ](https://hosted.weblate.org/projects/jirafeau/master/ ).
2017-01-16 15:39:46 +01:00
## Coding style
2015-07-16 11:55:25 +02:00
2017-01-26 13:25:09 +01:00
- This project follows the [PSR-2 ](http://www.php-fig.org/psr/psr-2/ ) Coding Style
2017-01-16 15:39:46 +01:00
- Files must be in UTF-8 without BOM and use Unix Line Endings (LF)
2017-01-24 10:51:19 +01:00
## Branches
* ```master` `` = latest release, e.g. 2.0.1
* ```next-release` `` = development branch - all new features are merged into this branch until the next version is released. So use this branch as base while developing new features or bugfixes.
* ```test` `` = sandbox branch to test new features or merge requests, or run integration tests. The content of this branch may change at any time.
2017-01-16 15:39:46 +01:00
## Merge Requests
2015-07-16 11:55:25 +02:00
2017-01-16 15:39:46 +01:00
Please create one branch for each feature and send one merge request for each branch.
2015-07-16 11:55:25 +02:00
2021-01-19 14:54:35 +09:00
Don't squash several changes or commits into one merge request as this is hard to review.
2017-01-24 10:51:19 +01:00
Please use ```next-release` `` as base branch and send your merge request to this branch (not ` ``master` ``).
2017-02-23 16:19:03 +01:00
2021-01-19 14:54:35 +09:00
Quick walkthrough:
2017-02-23 16:19:03 +01:00
* Create ticket for new feature
* Fork the original repository, clone the own repository, add the original repository as upstream
* Checkout »next-release« branch ```git checkout next-release` ``
* Create a new branch on top of that one, e.g. »some-feature« ```git checkout -b some-feature` ``
2019-12-17 19:31:29 +01:00
* Make your change
* You may check if the project is still [REUSE Compliant ](https://reuse.software/ ) by running `docker run -v $(pwd):/code --rm fsfe/reuse /bin/sh -c "cd /code && reuse lint"`
2017-02-23 16:19:03 +01:00
* Commit changes → push → send merge request ```git add -A; git commit; git push` `` MR via GitLab (link shown in console)
* Feature is reviewed
* MR accepted: Reviewer checks out »next-release« branch and cherry-picks the commit ```git checkout next-release; git cherry-pick be4369641; git push` ``
* MR declined: Reviewer add some notes, Developer rebases his branch, adds neccessary changes, force pushes the branch, ask a reviewer to review the changes in the merge request ticket (as Gitlab recognizes them automatically) ```git checkout some-feature; git rebase upstream/next-release` `` …[add changes]… ` ``git add -A, git commit --amend; git push -f` ``
2017-02-23 16:30:15 +01:00
## New Releases
2019-12-17 18:14:51 +01:00
* If the release is not done for security purposes: create a new issue and freeze next-release branch for at least week.
2017-02-23 16:30:15 +01:00
* Compare the [»next-release« branch to »master« ](https://gitlab.com/mojo42/Jirafeau/compare/master...next-release )
2020-11-15 22:09:11 +01:00
* Add a list of noteworthy features and bugfixes to `CHANGELOG.md`
* Add eventual upgrade procedure to `CHANGELOG.md`
2020-12-02 21:33:44 +01:00
* Build and test docker image
2017-02-23 16:30:15 +01:00
* Change the version, using [semantic versioning ](http://semver.org/ ), in ```settings.php` ``
* Merge »next-release« branch to »master«
* Tag the »master« with the new version
* Push branch and tag
2020-12-02 21:33:44 +01:00
* Push new docker image
* Update the demo page
2017-02-23 16:30:15 +01:00
* Dance a little