diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..9cce9a5 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,5 @@ +# Lines starting with '#' are comments. +# Each line is a file pattern followed by one or more owners. + +# These owners will be the default owners for everything in the repo. +* @revett \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 07bbcbb..e2c85a5 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,29 +1,37 @@ --- -name: Bug report -about: Create a report to help us improve - +name: Bug Report +about: Highlight a problem with the project --- -**Describe the bug** -A clear and concise description of what the bug is. +## Summary + +A clear and concise description of what the bug is... + +## To Reproduce + +Describle how to reproduce the behavior of the bug: -**To Reproduce** -Steps to reproduce the behavior: 1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error +1. Click on '...' +1. Scroll down to '...' +1. See error + +## Expected Behaviour + +A clear and concise description of what you expected to happen... + +## Docker + +Which version... + +## Docker Compose + +Which version... -**Expected behavior** -A clear and concise description of what you expected to happen. +## Operating System -**Screenshots** -If applicable, add screenshots to help explain your problem. +Are you running Mac, Windows or Linux... -**Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] - - Version [e.g. 22] +## Screenshots -**Additional context** -Add any other context about the problem here. +If applicable, add screenshots to help explain your problem. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 066b2d9..ecb27df 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,17 +1,17 @@ --- -name: Feature request +name: Feature Request about: Suggest an idea for this project - --- -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] +## Describe the Solution + +A clear and concise description of what you want to happen... + +## Why? -**Describe the solution you'd like** -A clear and concise description of what you want to happen. +Make the contributors of this project understand why this is an important +feature for them to implement... -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. +## Additional Context -**Additional context** -Add any other context or screenshots about the feature request here. +Add any other context or screenshots about the feature request here... diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 176744a..dbff955 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -6,7 +6,8 @@ ... -## Notes +## Checklist -- [ ] Remember to bump the `VERSION` file using [semver](https://semver.org/) 📝 -- [ ] Make sure the CI tests pass on your branch 👍 +- [ ] I have ran the tests locally. +- [ ] I branched off of the `develop` branch and not `master`. +- [ ] I did not change the `VERSION` file. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..ce1fea5 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,31 @@ +

+ Contributing to neo-local +

+ +

+ First off, thanks for taking the time to contribute! 🎉👍 +

+ +

+ The following is a set of guidelines for contributing to neo-local. Please use + your best judgement when following them, and feel free to propose changes to this + document in a pull request. +

+ +## Git Flow + +This project follows the [Git Flow](https://jeffkreeftmeijer.com/git-flow/) +branching workflow for managing features, hotfixes and releases. + +Please have a read first of Jeff Kreeftmeijer +[blog post](https://jeffkreeftmeijer.com/git-flow/) which does a great job of +describing it. + +After cloning the repo locally, create a new feature branch: + +``` +git checkout -b feat/my-awesome-feature develop +``` + +When ready push your changes from this branch to remove (Github) and create a +new pull request against the **develop** branch. \ No newline at end of file diff --git a/VERSION b/VERSION index 2774f85..142464b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.10.0 \ No newline at end of file +0.11.0 \ No newline at end of file diff --git a/cli/commands/index.go b/cli/commands/index.go index 36b4ccb..c2e1c48 100644 --- a/cli/commands/index.go +++ b/cli/commands/index.go @@ -8,8 +8,10 @@ import ( // the CLI. func GenerateCommandsIndex() []cli.Command { start := NewStart() + status := NewStatus() return []cli.Command{ start.ToCommand(), + status.ToCommand(), } } diff --git a/cli/commands/status.go b/cli/commands/status.go new file mode 100644 index 0000000..0f75c8c --- /dev/null +++ b/cli/commands/status.go @@ -0,0 +1,89 @@ +package commands + +import ( + "errors" + "fmt" + "log" + "strings" + + "github.com/CityOfZion/neo-local/cli/services" + "github.com/CityOfZion/neo-local/cli/stack" + "github.com/urfave/cli" + + "github.com/docker/docker/api/types" + "github.com/docker/docker/client" + "golang.org/x/net/context" +) + +type ( + // Status is the CLI command for checking the status of containers in the + // development environment. + Status struct{} +) + +// NewStatus creates a new Status. +func NewStatus() Status { + return Status{} +} + +// ToCommand generates the CLI command struct. +func (s Status) ToCommand() cli.Command { + return cli.Command{ + Action: s.action(), + Aliases: []string{"ps"}, + Flags: s.flags(), + Name: "status", + Usage: "Output overall health of network", + } +} + +func (s Status) action() func(c *cli.Context) error { + return func(c *cli.Context) error { + ctx := context.Background() + cli, err := client.NewEnvClient() + if err != nil { + return errors.New("Unable to create Docker client") + } + + ok := services.CheckDockerRunning(ctx, cli) + if !ok { + return errors.New("Docker is not running") + } + + services := stack.Services() + runningContainers, err := cli.ContainerList(ctx, types.ContainerListOptions{}) + if err != nil { + return err + } + + for _, container := range runningContainers { + containerName := "" + for _, name := range container.Names { + if strings.Contains(name, "coz_neo-local_") { // TODO: this string should be a const. + fmt.Println(name) + containerName = name + break + } + } + + if containerName == "" { + continue + } + + for _, service := range services { + if strings.Contains(containerName, service.ContainerName()) { + log.Printf( + "%s in '%s' state", service.Image, container.State, + ) + break + } + } + } + + return nil + } +} + +func (s Status) flags() []cli.Flag { + return []cli.Flag{} +} diff --git a/cli/main.go b/cli/main.go index 5925495..6a3bb55 100644 --- a/cli/main.go +++ b/cli/main.go @@ -12,7 +12,7 @@ import ( const ( copyright = "MIT" - description = "Quickly setup a local environment for NEO smart contract development" + description = "Personal blockchain for NEO dApp development!" ) var ( diff --git a/cli/services/docker.go b/cli/services/docker.go index bc59a91..449d90c 100644 --- a/cli/services/docker.go +++ b/cli/services/docker.go @@ -49,6 +49,6 @@ func dockerImageNames() []string { "cityofzion/neo-python:v0.8.1", "postgres:10.5", "registry.gitlab.com/cityofzion/neo-scan/api:latest", - "registry.gitlab.com/cityofzion/neo-scan/sync:latest" + "registry.gitlab.com/cityofzion/neo-scan/sync:latest", } } diff --git a/scripts/travis.sh b/scripts/travis.sh index 1fbaaf6..271356c 100755 --- a/scripts/travis.sh +++ b/scripts/travis.sh @@ -5,10 +5,9 @@ version=$(cat ./VERSION) set -e -if [[ $TRAVIS_BRANCH == 'master' || $TRAVIS_TAG == $version ]] +if [[ $TRAVIS_BRANCH == release/* ]] then - make integration-tests -else make check-version - make integration-tests fi + +make integration-tests