Skip to content

Commit

Permalink
[BREAKING] Version 6 (#322)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dougley authored Jun 11, 2018
1 parent 830278d commit d58fc3a
Show file tree
Hide file tree
Showing 157 changed files with 7,907 additions and 4,699 deletions.
139 changes: 139 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
version: 2
jobs:
test:
docker:
- image: node:latest
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run:
name: Install modules
command: npm install
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- node_modules
- run:
name: Test
command: npm test
build:
docker:
- image: docker:latest
steps:
- run:
name: Git
command: apk add --update git
- checkout
- setup_remote_docker
- run:
name: Initialize submodule
command: git submodule update --init --remote
- run:
name: Build Docker image
command: if [ "$CIRCLE_BRANCH" = "master" ]; then docker build -t dougley/wildbeast:latest --build-arg buildno=$CIRCLE_BUILD_NUM --build-arg commitsha=$CIRCLE_SHA1 .; else docker build -t dougley/wildbeast:$CIRCLE_BRANCH --build-arg buildno=$CIRCLE_BUILD_NUM --build-arg commitsha=$CIRCLE_SHA1 .; fi
- run:
name: Push image to Docker hub
command: |
echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
if [ "$CIRCLE_BRANCH" = "master" ]; then docker push dougley/wildbeast:latest; else docker push dougley/wildbeast:$CIRCLE_BRANCH; fi
tagged-build:
docker:
- image: docker:latest
steps:
- run:
name: Git
command: apk add --update git
- checkout
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Initialize submodule
command: git submodule update --init --remote
- run:
name: Build Docker image
command: docker build -t dougley/wildbeast:$(git describe --abbrev=0 --tags) --build-arg buildno=$CIRCLE_BUILD_NUM --build-arg commitsha=$CIRCLE_SHA1 .
- run:
name: Push image to Docker hub
command: |
echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
docker push dougley/wildbeast:$(git describe --abbrev=0 --tags)
docs-build:
docker:
- image: python:3.5
steps:
- checkout
- restore_cache:
key: deps1-{{ .Branch }}-{{ checksum "requirements.txt" }}
- run:
command: |
python3 -m venv venv
. venv/bin/activate
pip install -r requirements.txt
- save_cache:
key: deps1-{{ .Branch }}-{{ checksum "requirements.txt" }}
paths:
- "venv"
- run:
name: Compile
command: |
. venv/bin/activate
mkdocs build
docs-deploy:
docker:
- image: python:3.5
steps:
- checkout
- restore_cache:
key: deps1-{{ .Branch }}-{{ checksum "requirements.txt" }}
- run:
command: |
python3 -m venv venv
. venv/bin/activate
pip install -r requirements.txt
- save_cache:
key: deps1-{{ .Branch }}-{{ checksum "requirements.txt" }}
paths:
- "venv"
- run:
name: Compile
command: |
. venv/bin/activate
mkdocs build
- add_ssh_keys:
fingerprints:
- "cf:bd:5e:04:62:ce:4d:da:1e:11:87:a1:ab:3e:9f:df"
- run:
name: Deploy
command: |
. venv/bin/activate
git config user.email [email protected]
mkdocs gh-deploy
workflows:
version: 2
docs:
jobs:
- docs-build
- docs-deploy:
requires:
- docs-build
filters:
branches:
only: master
test_n_build:
jobs:
- test
- build:
requires:
- test
filters:
branches:
only: /master|experimental/
- tagged-build:
requires:
- test
filters:
branches:
ignore: /.*/
tags:
only: /v.+/
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
17 changes: 1 addition & 16 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,16 +1 @@
*.json
*.md
*.txt
*.log
*.mp3
*.exe
*.yml
*.sh
customize
perms
users
ffmpeg
ffprobe
ffplay
ffserver
Dockerfile
node_modules/**
10 changes: 6 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"extends": "standard",
"plugins": [
"standard"
]
"extends": "standard",
"globals": {
"i18n": false,
"logger": false,
"bot": false
}
}
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
* text=auto
*.js text eol=crlf
*.js text eol=crlf
6 changes: 4 additions & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
* @SteamingMutt
*.js @TheSharks/development
* @Dougley
*.js @TheSharks/development
docs/* @linuswillner
mkdocs.yml @linuswillner
File renamed without changes.
99 changes: 78 additions & 21 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,90 @@
**Thank you for taking the time to contribute to the development of WildBeast!**

Please follow these rules when making contributions to this repository.

# Contribution rules
# Source code

## Unwanted contributions
1. Spelling/Grammar changes (Managed internally)
2. Style violations fixes (Managed internally)
3. ESLint rules changes
4. Custom command issues (Except problems **within** the command framework itself)
5. Alias additions (Only applies if no new default commands are provided)
6. Issues stemming from usage of normal user accounts instead of OAuth bot accounts

1. Style violations fixes
2. ESLint rules changes
3. Alias additions (Only applies if no new commands are provided)

## Wanted contributions
Everything that doesn't fit in the unwanted category is wanted :eyes: :thumbsup:

# Notes
## Commands
Make sure that the commands you're adding are suitable to be default commands and packaged within for instance WildBot. If you think that some commands are better off as custom ones, don't submit them but instead introduce them to your own instance. Given that you have one, of course.
We welcome all contributions that aren't unwanted by the rules defined above.

## Code rules

### Verified as working

All code contributed to this repository should be verified as working, meaning you've tested the functionality at least once and didn't encounter unexpected behaviour.
Please keep in mind that we might ask you to confirm if this is the case.

### ESLint

ESLint handles our style enforcement, when making contributions, **please confirm your code adheres to the style**, your build will fail otherwise and we're less inclined to merge it.
To verify your code adheres to our styleguide, run `npm test` in the project root.

## Code practices

### Database operations

When performing database operations, **don't import a driver and call it directly**, instead, require `database-selector.js` and write abstractions.
When writing abstractions, you only need to write them for the officially supported database at that time. (currently ArangoDB)

## When writing, keep the styleguide in mind
1. We follow the [JavaScript Standard Style](https://github.com/feross/standard), please format your code according to that.
2. [ESLint](http://eslint.org/) is used to identify other style violations.
### Global objects

# Before you PR
If you have gotten far enough to pull request (Written the code edits etc.) and have it all ready, do a few things first.
Avoid polluting the global namespace unnecessarily, if something is not likely to be frequently used across the project, don't add it.
When calling global objects, call them as you would a non-global object, for example: `global.logger.log('Hello world!')`.

1. Test your code. This means attempting to run a WildBeast instance with your edited code, if you have your own instance to test with. This is recommended as even partially broken code can be already identified here before running styleguide checks.
2. Run the command `npm test` in the bot's folder to "lint" the code using ESlint. If it finds violations, fix them before continuing.
3. Run the command `standard` in the same directory as above to test for JS Standard Code Style violations. Again, if violations are found, fix them before proceeding.
### Promises and async

When all the above give you a green light, you can consider yourself free to make the pull request!
**Always** chain promises where possible.

```js
// ✗ bad
aPromise().then(result => {
anotherPromise(result).then(anotherresult => {
console.log(anotherresult)
}).catch(console.error)
}).catch(console.error)
```

```js
// ✓ good
aPromise().then(result => {
return anotherPromise(result)
}).then(anotherresult => {
console.log(anotherresult)
}).catch(console.error)
```

```js
// ✓ even better
aPromise().then(async result => {
const anotherresult = await anotherPromise(result)
console.log(anotherresult)
})
```

# Docs

## General contribution rules

* Additions should be committed to a **docs/<your-changes-title\>** branch and PRed to the experimental branch.
* Strive to submit grammatically correct changes.
* Do not commit or PR to the **gh-pages** branch. The **gh-pages** branch is handled by our CI.
* Follow the overall format in the docs.
* Do not add extraneous material such as screenshots.
* New pages must be added to the navbar in [mkdocs.yml](../mkdocs.yml). See [DOCS_GUIDE.md](DOCS_GUIDE.md) for more details.

## Unwanted contributions

* Unnecessary restructurations of the docs.
* Untested changes (Changes must be verified as working)
* Configuration changes, except when changes are necessary for the documentation to work properly.

## Wanted contributions

**NOTE:** Pull requests that break the rules provided above **will be rejected!**
Anything not outlined in the above section is considered wanted.
21 changes: 21 additions & 0 deletions .github/DOCS_GUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Compilation guide

This is a guide for installing the required dependencies to modify the WildBeast documentation and compile it for your pull request.

**Note:** Windows users can use the bundled Batch file (**install_docs_deps.bat**) to easily install the dependencies. The installation process is far simpler on Linux and can be done by simply running `sudo python3.5 -m pip --upgrade -r requirements.txt`. (3.6 is also supported)

## Initial setup

When you have cloned the repository, you need to install the dependencies before making modifications.

These dependencies will use Python to install, and your Python installation has to comply with requirements for the MkDocs documentation generator engine. If you haven't set it up yet on your system, follow [MkDocs' guide](http://www.mkdocs.org/#installing-python) on doing so.

Remember to install the dependencies for the documentation as outlined above.

## Editing

Before you start making changes to the documents, open a command window in the repository folder and run the command `npm run start-docs`. This will start the MkDocs test server.

When the test environment is running, you can open the URL `http://localhost:8000` in your browser to preview your changes. Every time you save a document, the page will automatically refresh and display changes.

**Note:** If you add new pages, you need to add the page name and document into `mkdocs.yml` in the sitemap section or the page will not be added to the navbar. **New pages must always be added to the navbar!**
Loading

0 comments on commit d58fc3a

Please sign in to comment.