Skip to content

Commit e37ac94

Browse files
committed
Merge branch 'dev-docs'
closes #22
2 parents 7afe859 + f605066 commit e37ac94

File tree

2 files changed

+50
-2
lines changed

2 files changed

+50
-2
lines changed

contributing.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
Some guidelines and tips for development.
2+
3+
## git
4+
5+
Feel free to [fork](https://help.github.com/articles/fork-a-repo) this repository and [create a pull request](https://help.github.com/articles/creating-a-pull-request). Before making a large change, please open an issue to discuss it.
6+
7+
Make descriptive, granular commits. No need to squash them for the pull request.
8+
9+
If you drift too far from the master branch, please [merge](https://help.github.com/articles/syncing-a-fork) rather than rebasing. This will preserve the commit history that shows the context in which the code was written.
10+
11+
## style
12+
13+
- Tabs for indenting. Spaces for alignment.
14+
- Wrap discrete chunks of code in functions. This makes writing tests easier.
15+
- See [.editorconfig](.editorconfig) for more specifics and exceptions.
16+
- Follow the style you see in the code that's already here.
17+
18+
## testing
19+
20+
Have [bats](https://github.com/sstephenson/bats#readme) installed.
21+
22+
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.
23+
24+
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.
25+
26+
Write tests like [executable specifications](https://youtu.be/XcT4yYu_TTs?t=17m20s).
27+
28+
Group together tests that share a common subject by indenting test names with spaces, to achieve output similar to [Mocha](http://mochajs.org/#spec) or [RSpec](http://rspec.info/#asciicast-iframe-14103).
29+
30+
For anything that involves touching the file system, use `setup()` & `teardown()` functions to create a temporary directory:
31+
32+
```bash
33+
setup() {
34+
run mktemp -dt deploy_test.XXXX
35+
assert_success
36+
tmp=$output
37+
pushd "$tmp" >/dev/null
38+
}
39+
```
40+
41+
```bash
42+
teardown() {
43+
popd >/dev/null
44+
rm -rf "$tmp"
45+
}
46+
```
47+
48+
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 & 2 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,4 +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.
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)