Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
romnnn committed Apr 20, 2020
0 parents commit 097d5df
Show file tree
Hide file tree
Showing 13 changed files with 427 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .bumpversion.cfg
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}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tasks.py linguist-vendored
27 changes: 27 additions & 0 deletions .gitignore
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/
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
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
30 changes: 30 additions & 0 deletions .travis.yml
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)
21 changes: 21 additions & 0 deletions LICENSE
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.
58 changes: 58 additions & 0 deletions README.md
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.
15 changes: 15 additions & 0 deletions examples/example1/example1.go
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())
}
13 changes: 13 additions & 0 deletions examples/example1/example1_test.go
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)
}
}
9 changes: 9 additions & 0 deletions flatbson.go
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 + "!"
}
12 changes: 12 additions & 0 deletions flatbson_test.go
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(""))
}
}
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/romnnn/flatbson

go 1.13
Loading

0 comments on commit 097d5df

Please sign in to comment.