Skip to content

Commit 11bc3c4

Browse files
committed
1 parent 8f998d3 commit 11bc3c4

File tree

2 files changed

+49
-52
lines changed

2 files changed

+49
-52
lines changed

contributing.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
Some guidelines and tips for development.
2+
3+
### git
4+
5+
1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository.
6+
2. Make changes on a branch of your choice. Atomic commits are better than clobbering commits.
7+
3. [Sync your fork](https://help.github.com/articles/syncing-a-fork/) and keep your branch up to date with [master](https://github.com/X1011/git-directory-deploy/tree/master).
8+
4. [Create a pull request](https://help.github.com/articles/creating-a-pull-request/) to this repository.
9+
10+
Once a pull request is opened, be careful with `git commit --amend` and `git rebase`. No need to squash a branch into multiple commits, either. When in doubt, preserve your history.
11+
12+
### syntax & style
13+
14+
- Tabs for indenting. Spaces for alignment.
15+
- Wrap discrete chunks of code in functions. This makes writing test easier.
16+
- See [.editorconfig](.editorconfig) for more specifics and exceptions.
17+
- Follow the style you see in the code that's already here.
18+
19+
### testing
20+
21+
Have [bats](https://github.com/sstephenson/bats#readme) installed.
22+
23+
Groups of tests are in `.bats` files in the repository root. You can [run tests manually](https://github.com/sstephenson/bats#running-tests) or use the `./watch` script (requires [`entr`](https://github.com/clibs/entr)) to automatically run them when any file is changed.
24+
25+
Discrete chunks of code should have a discrete set of tests. If possible, tests should call the relevant function rather than running the whole script.
26+
27+
Write test names so that they tell a story for a test group, and indent each test
28+
29+
For anything that involves touching the file system, use `setup()` & `teardown()` functions for the `.bats` file that make the tests run in a temporary folder:
30+
31+
```bash
32+
setup() {
33+
run mktemp -dt deploy_test.XXXX
34+
assert_success
35+
tmp=$output
36+
pushd "$tmp" >/dev/null
37+
}
38+
```
39+
40+
```bash
41+
teardown() {
42+
popd >/dev/null
43+
rm -rf "$tmp"
44+
}
45+
```
46+
47+
Finally, make sure the `.bats` files are in a path that's accounted-for in [`circle.yml`](circle.yml).

readme.md

Lines changed: 2 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ This is a script for deploying generated files to a git branch, such as when bui
22

33
[![Circle CI](https://circleci.com/gh/X1011/git-directory-deploy.svg?style=svg)](https://circleci.com/gh/X1011/git-directory-deploy)
44

5-
For an example of use, see [X1011/verge-mobile-bingo](https://github.com/X1011/verge-mobile-bingo).
5+
For an example of use, see [X1011/verge-mobile-bingo](https://github.com/X1011/verge-mobile-bingo). For development info, see [contributing.md](contributing.md).
66

77
## configuration
88
Download the script (`wget https://github.com/X1011/git-directory-deploy/raw/master/deploy.sh && chmod +x deploy.sh`) and edit these variables within it as needed to fit your project:
@@ -47,54 +47,4 @@ Do this every time you want to deploy, or have your CI server do it.
4747

4848
`-v`, `--verbose`: echo expanded commands as they are executed, using the xtrace option. This can be useful for debugging, as the output will include the values of variables that are being used, such as $commit_title and $deploy_directory. However, the script makes special effort to not output the value of $repo, as it may contain a secret authentication token.
4949

50-
`-e`, `--allow-empty`: allow deployment of an empty directory. By default, the script will abort if `deploy_directory` is empty.
51-
52-
## develop
53-
54-
Some guidelines and tips for development.
55-
56-
### git
57-
58-
1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository.
59-
2. Make changes on a branch of your choice. Atomic commits are better than clobbering commits.
60-
3. [Sync your fork](https://help.github.com/articles/syncing-a-fork/) and keep your branch up to date with [master](https://github.com/X1011/git-directory-deploy/tree/master).
61-
4. [Create a pull request](https://help.github.com/articles/creating-a-pull-request/) to this repository.
62-
63-
Once a pull request is opened, be careful with `git commit --amend` and `git rebase`. No need to squash a branch into multiple commits, either. When in doubt, preserve your history.
64-
65-
### syntax & style
66-
67-
- Tabs for indenting. Spaces for alignment.
68-
- Wrap discrete chunks of code in functions. This makes writing test easier.
69-
- See [.editorconfig](.editorconfig) for more specifics and exceptions.
70-
- Follow the style you see in the code that's already here.
71-
72-
### testing
73-
74-
Have [bats](https://github.com/sstephenson/bats#readme) installed.
75-
76-
Groups of tests are in `.bats` files in the repository root. You can [run tests manually](https://github.com/sstephenson/bats#running-tests) or use the `./watch` script (requires [`entr`](https://github.com/clibs/entr)) to automatically run them when any file is changed.
77-
78-
Discrete chunks of code should have a discrete set of tests. If possible, tests should call the relevant function rather than running the whole script.
79-
80-
Write test names so that they tell a story for a test group, and indent each test
81-
82-
For anything that involves touching the file system, use `setup()` & `teardown()` functions for the `.bats` file that make the tests run in a temporary folder:
83-
84-
```bash
85-
setup() {
86-
run mktemp -dt deploy_test.XXXX
87-
assert_success
88-
tmp=$output
89-
pushd "$tmp" >/dev/null
90-
}
91-
```
92-
93-
```bash
94-
teardown() {
95-
popd >/dev/null
96-
rm -rf "$tmp"
97-
}
98-
```
99-
100-
Finally, make sure the `.bats` files are in a path that's accounted-for in [`circle.yml`](circle.yml).
50+
`-e`, `--allow-empty`: allow deployment of an empty directory. By default, the script will abort if `deploy_directory` is empty.

0 commit comments

Comments
 (0)