|
| 1 | +# Kirby Auto Git Plugin [](https://github.com/pedroborges/kirby-autogit/releases) [](https://github.com/pedroborges/kirby-autogit/issues) |
| 2 | + |
| 3 | +## Requirements |
| 4 | +- Kirby 2.2.3+ |
| 5 | +- PHP 5.6+ |
| 6 | + |
| 7 | +## Main features |
| 8 | +- Works on any Kirby structure |
| 9 | +- Auto commit |
| 10 | +- Localized commit messages |
| 11 | +- Panel user as commit author |
| 12 | + |
| 13 | +## Installation |
| 14 | + |
| 15 | +### Site Structure |
| 16 | +You can use whatever site structure fits better your needs. It doesn't matter whether your `content` folder is part of the main Git repo or is a submodule. Auto Git is smart enough to only commit changes made inside the `content` folder. |
| 17 | + |
| 18 | +> Internally Auto Git uses `kirby()->roots()->content()` to detect the `content` folder. It can have whatever name you've registered on your Kirby installation. |
| 19 | +
|
| 20 | +### Download |
| 21 | +[Download the files](https://github.com/pedroborges/kirby-autogit/archive/master.zip) and place them inside `site/plugins/autogit`. |
| 22 | + |
| 23 | +### Kirby CLI |
| 24 | +Kirby's [command line interface](https://github.com/getkirby/cli) makes installing the Auto Git plugin a breeze: |
| 25 | + |
| 26 | + $ kirby plugin:install pedroborges/kirby-autogit |
| 27 | + |
| 28 | +Updating couldn't be any easier, simply run: |
| 29 | + |
| 30 | + $ kirby plugin:update pedroborges/kirby-autogit |
| 31 | + |
| 32 | +### Git Submodule |
| 33 | +You can add the Auto Git plugin as a Git submodule. |
| 34 | + |
| 35 | + $ cd your/project/root |
| 36 | + $ git submodule add https://github.com/pedroborges/kirby-autogit.git site/plugins/autogit |
| 37 | + $ git submodule update --init --recursive |
| 38 | + $ git commit -am "Add Kirby Auto Git plugin" |
| 39 | + |
| 40 | +Updating is as easy as running a few commands. |
| 41 | + |
| 42 | + $ cd your/project/root |
| 43 | + $ git submodule foreach git checkout master |
| 44 | + $ git submodule foreach git pull |
| 45 | + $ git commit -am "Update submodules" |
| 46 | + $ git submodule update --init --recursive |
| 47 | + |
| 48 | +## Options |
| 49 | +The following options can be set in your `/site/config/config.php`: |
| 50 | + |
| 51 | + c::set('autogit.branch', 'master'); |
| 52 | + c::set('autogit.panel.user', true); |
| 53 | + c::set('autogit.user.name', 'Auto Git'); |
| 54 | + c::set('autogit.user.email', 'autogit@localhost'); |
| 55 | + c::set('autogit.language', 'en'); |
| 56 | + c::set('autogit.translation', [ |
| 57 | + 'site.update' => 'Changed site options', |
| 58 | + 'page.create' => 'Created page %s', |
| 59 | + 'page.update' => 'Updated page %s', |
| 60 | + 'page.delete' => 'Deleted page %s', |
| 61 | + 'page.sort' => 'Sorted page %s', |
| 62 | + 'page.hide' => 'Hid page %s', |
| 63 | + 'page.move' => 'Moved page %1$s to %2$s', |
| 64 | + 'file.upload' => 'Uploaded file %s', |
| 65 | + 'file.replace' => 'Replaced file %s', |
| 66 | + 'file.rename' => 'Renamed file %s', |
| 67 | + 'file.update' => 'Updated file %s', |
| 68 | + 'file.sort' => 'Sorted file %s', |
| 69 | + 'file.delete' => 'Deleted file %s', |
| 70 | + ]); |
| 71 | + |
| 72 | +### autogit.branch |
| 73 | +Sets the Git branch where commits will go to. Auto Git **won't** create the branch for you, make sure it exists prior to changing the default value. |
| 74 | + |
| 75 | +### autogit.panel.user |
| 76 | +Sets if Auto Git should use Kirby's panel user name and email as commit author. This will enable you to see who made each change on your Git client of choice or simply by running `$ git log`. **The user must have first name and email set on their account info.** |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | +> Options `autogit.user.name` and `autogit.user.email` will be overridden when this is set to `true`. |
| 81 | +
|
| 82 | +### autogit.user.name |
| 83 | +Default commit author name. Applied only when the option `autogit.panel.user` is set to `false` or when user's first name isn't set on his account info. |
| 84 | + |
| 85 | +### autogit.user.email |
| 86 | +Default commit author email. Applied only when the option `autogit.panel.user` is set to `false` or when user's first name isn't set on his account info. |
| 87 | + |
| 88 | +### autogit.language |
| 89 | +Default commit language. You can choose from any of the languages that ships with Auto Git: `'en'`, `'pt_BR'` or `'pt_PT'`. |
| 90 | + |
| 91 | +You can also use the `autogit.translation` option to provide a custom translation, see below. |
| 92 | + |
| 93 | +> Feel free to send a pull request to add support for more languages. |
| 94 | +
|
| 95 | +### autogit.translation |
| 96 | +An array containing a custom translation. This will override the default translation set in `autogit.language`. |
| 97 | + |
| 98 | +## Roadmap |
| 99 | +- Pull and push webhooks |
| 100 | +- Panel widget |
| 101 | + |
| 102 | +## FAQ |
| 103 | + |
| 104 | +### How do I push commits from my server to a remote repo? |
| 105 | +Right now the recommended way is to use a cron job to run `$ git push` frequently. Soon you'll have the option to do this manually from a panel widget or automatically by using a webhook to easily integrate with other services. |
| 106 | + |
| 107 | +## License |
| 108 | +<http://www.opensource.org/licenses/mit-license.php> |
| 109 | + |
| 110 | +## Author |
| 111 | + |
0 commit comments