|
1 | | -# flutter-git-hooks |
2 | | -Git hooks collection for Flutter project |
| 1 | +# Git hooks |
| 2 | +This repo contains git hooks for Flutter Application or Plugin Development. |
| 3 | + |
| 4 | +The purpose of this collection to gather some scripts which help to improve the quality of developed applications. I believe in fail-fast philosophy, thus I wrote these hooks. |
| 5 | + |
| 6 | +In my mind, pre-commit hooks can reduce CI costs. Additionally, we will get quick feedback on our changes to the application. |
| 7 | + |
| 8 | +## Description |
| 9 | + |
| 10 | +This repo contains a __pre-commit__ hook for Flutter Application or Plugin development. It cleans the workspace and then runs `analyze` and `test` commands on the project. |
| 11 | + |
| 12 | +## Requirements |
| 13 | +The `flutter` command must be available on the `PATH`. |
| 14 | + |
| 15 | +## How to use |
| 16 | + |
| 17 | +Add the contents of this repo to your root project as a git subtree. You can just copy it into `.git/hooks` folder. However, if you do not want to lose the benefits of git, please follow the description below. |
| 18 | + |
| 19 | +``` |
| 20 | +cd $PROJECT |
| 21 | +git remote add flutter-git-hooks https://github.com/warnyul/flutter-git-hooks.git |
| 22 | +git subtree add --prefix=git-hooks/ flutter-git-hooks master |
| 23 | +``` |
| 24 | +__Any person who clones your project must symlink the folder into `.git` folder__ |
| 25 | + |
| 26 | +``` |
| 27 | +mv .git/hooks .git/hooks.old && ln -s ../git-hooks .git/hooks |
| 28 | +``` |
| 29 | +## Update hooks |
| 30 | +You can update the hooks inside your project if necessary. So, enter your project's folder and pull changes from remote. |
| 31 | + |
| 32 | +``` |
| 33 | +cd $PROJECT |
| 34 | +git remote add flutter-git-hooks https://github.com/warnyul/flutter-git-hooks.git |
| 35 | +git fetch flutter-git-hooks master |
| 36 | +git subtree pull --prefix=git-hooks/ flutter-git-hooks master |
| 37 | +``` |
| 38 | + |
| 39 | +# License |
| 40 | + |
| 41 | + Copyright 2020 Balázs Varga |
| 42 | + |
| 43 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 44 | + you may not use this file except in compliance with the License. |
| 45 | + You may obtain a copy of the License at |
| 46 | + |
| 47 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 48 | + |
| 49 | + Unless required by applicable law or agreed to in writing, software |
| 50 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 51 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 52 | + See the License for the specific language governing permissions and |
| 53 | + limitations under the License. |
0 commit comments