-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
romnnn
committed
Apr 20, 2020
0 parents
commit 097d5df
Showing
13 changed files
with
427 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[bumpversion] | ||
current_version = 0.0.1 | ||
commit = True | ||
tag = True | ||
|
||
|
||
|
||
[bumpversion:file:flatbson.go] | ||
search = const Version \= "{current_version}" | ||
replace = {new_version} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tasks.py linguist-vendored |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Ignore all | ||
* | ||
|
||
# Unignore all with extensions | ||
!*.* | ||
|
||
# Unignore all dirs | ||
!*/ | ||
|
||
# Unignore bazel files without extension | ||
!**/WORKSPACE | ||
!**/BUILD | ||
|
||
# Unignore Dockerfile and other useful files | ||
!**/Dockerfile | ||
!**/.dockerignore | ||
!**/.gitattributes | ||
!**/LICENSE | ||
|
||
### Above combination will ignore all files without extension ### | ||
|
||
.DS_Store | ||
.vscode/ | ||
.idea/ | ||
coverage* | ||
*.exe | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
- repo: git://github.com/dnephin/pre-commit-golang | ||
rev: master | ||
hooks: | ||
- id: go-fmt | ||
- id: go-vet | ||
- id: go-lint | ||
- id: go-imports | ||
- id: go-cyclo | ||
args: [-over=15] | ||
- id: go-build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
dist: bionic | ||
language: go | ||
go: | ||
- 1.13.x | ||
- master | ||
- tip | ||
os: | ||
- linux | ||
- osx | ||
env: MOD=github.com/romnnn/flatbson BINARY=flatbson | ||
|
||
jobs: | ||
allow_failures: | ||
- go: tip | ||
fast_finish: true | ||
|
||
install: true | ||
notifications: | ||
email: false | ||
before_script: | ||
- pip install -U pip && pip install pre-commit invoke ruamel.yaml | ||
- go get -u golang.org/x/lint/golint | ||
- go get github.com/fzipp/gocyclo | ||
- go get github.com/mitchellh/gox | ||
script: | ||
- invoke pre-commit | ||
- env GO111MODULE=on go build ${MOD} | ||
- env GO111MODULE=on go test -v -race -coverprofile=coverage.txt -coverpkg=all -covermode=atomic ./... | ||
after_success: | ||
- bash <(curl -s https://codecov.io/bash) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020, romnnn | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
## flatbson | ||
|
||
[![Build Status](https://travis-ci.com/romnnn/flatbson.svg?branch=master)](https://travis-ci.com/romnnn/flatbson) | ||
[![GitHub](https://img.shields.io/github/license/romnnn/flatbson)](https://github.com/romnnn/flatbson) | ||
[![GoDoc](https://godoc.org/github.com/romnnn/flatbson?status.svg)](https://godoc.org/github.com/romnnn/flatbson) [![Test Coverage](https://codecov.io/gh/romnnn/flatbson/branch/master/graph/badge.svg)](https://codecov.io/gh/romnnn/flatbson) | ||
[![Release](https://img.shields.io/github/release/romnnn/flatbson)](https://github.com/romnnn/flatbson/releases/latest) | ||
|
||
Your description goes here... | ||
|
||
|
||
|
||
#### Usage as a library | ||
|
||
```golang | ||
import "github.com/romnnn/flatbson" | ||
``` | ||
|
||
For more examples, see `examples/`. | ||
|
||
|
||
#### Development | ||
|
||
###### Prerequisites | ||
|
||
Before you get started, make sure you have installed the following tools:: | ||
|
||
$ python3 -m pip install -U cookiecutter>=1.4.0 | ||
$ python3 -m pip install pre-commit bump2version invoke ruamel.yaml halo | ||
$ go get -u golang.org/x/tools/cmd/goimports | ||
$ go get -u golang.org/x/lint/golint | ||
$ go get -u github.com/fzipp/gocyclo | ||
$ go get -u github.com/mitchellh/gox # if you want to test building on different architectures | ||
|
||
**Remember**: To be able to excecute the tools downloaded with `go get`, | ||
make sure to include `$GOPATH/bin` in your `$PATH`. | ||
If `echo $GOPATH` does not give you a path make sure to run | ||
(`export GOPATH="$HOME/go"` to set it). In order for your changes to persist, | ||
do not forget to add these to your shells `.bashrc`. | ||
|
||
With the tools in place, it is strongly advised to install the git commit hooks to make sure checks are passing in CI: | ||
```bash | ||
invoke install-hooks | ||
``` | ||
|
||
You can check if all checks pass at any time: | ||
```bash | ||
invoke pre-commit | ||
``` | ||
|
||
Note for Maintainers: After merging changes, tag your commits with a new version and push to GitHub to create a release: | ||
```bash | ||
bump2version (major | minor | patch) | ||
git push --follow-tags | ||
``` | ||
|
||
#### Note | ||
|
||
This project is still in the alpha stage and should not be considered production ready. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/romnnn/flatbson" | ||
) | ||
|
||
func run() string { | ||
return flatbson.Shout("This is an example") | ||
} | ||
|
||
func main() { | ||
fmt.Println(run()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package main | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestCli(t *testing.T) { | ||
out := run() | ||
expected := "This is an example!" | ||
if out != expected { | ||
t.Errorf("Got %s but expected %s", out, expected) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package flatbson | ||
|
||
// Version is incremented using bump2version | ||
const Version = "0.0.1" | ||
|
||
// Shout returns the input message with an exclamation mark | ||
func Shout(s string) string { | ||
return s + "!" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package flatbson | ||
|
||
import "testing" | ||
|
||
func TestShout(t *testing.T) { | ||
if Shout("Test") != "Test!" { | ||
t.Errorf("Got %s but want \"Test!\"", Shout("Test")) | ||
} | ||
if Shout("") != "!" { | ||
t.Errorf("Got %s but want \"!\"", Shout("")) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module github.com/romnnn/flatbson | ||
|
||
go 1.13 |
Oops, something went wrong.