Skip to content

Latest commit

 

History

History
160 lines (117 loc) · 3.94 KB

File metadata and controls

160 lines (117 loc) · 3.94 KB

Config: dev.yml

Example

The file dev.yml must be placed at the root directory of your project. It should be commited to your repository and shared with everyone working on the project.

The up section describes the tasks that the bud up command will run. Some tasks prepare your environment to use a language like python or go. Other tasks ensure your environment is up to date like pip or golang_dep. The special custom task let you handle specific case needed for your project. See Tasks.

The commands section describes the project commands like bud test. See Project Commands.

The open section describes the project links available through bud open <name>. See Open Command.

dev.yml:

up:
  - go: 1.10.1
  - golang_dep
  - python: 3.6.5
  - pip:
      - python/requirements-dev.txt
  - custom:
      name: Download GeoIP db
      met?: test -e GeoIP.dat
      meet: curl -L http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz | gunzip > GeoIP.dat

commands:
  test:
    desc: Run tests for Python and Go
    run: pytest -v python/tests && go test $(go list ./...)

open:
  staging: https://staging.myapp.com
  doc: https://godoc.org/github.com/org/myapp

Tasks

python

This task will install the Python version (with PyEnv, which must be installed), create a virtualenv and activate it in your shell.

up:
  - python: 3.6.5

pip

This task will install a pip requirements file.

A Python environment must be selected before.

Currently this task can't detect whether it should run or not. PR welcome!

up:
  - python: 3.6.5
  - pip:
    - requirements.txt
    - requirements-dev.txt

pipenv

This task will install a Pipfile with Pipenv.

A Python environment must be selected before.

Currently this task can't detect whether it should run or not. PR welcome!

up:
  - python: 3.6.5
  - pipfile

go

This task will download the Go distribution from dl.google.com/go and activate it in your shell (with GOROOT).

up:
  - go: 1.10.1

golang_dep

This task will run Go Dep if needed.

A Go environment must be selected before.

up:
  - go: 1.10.1
  - golang_dep

custom

This task will run a command if a condition is not met. The condition is expressed as a command.

up:
  - custom:
      name: Install shellcheck with Brew
      met?: test -e /usr/local/Cellar/shellcheck
      meet: brew install shellcheck

Project commands

The project can define custom command in dev.yml that can be called with: bud <command>. Additional arguments are also passed to the command: bud <command> <arg> <arg>....

commands:
  test:
    desc: Run tests for Python and Go
    run: pytest -v python/tests && go test $(go list ./...)
  lint:
    desc: Run the linters
    run: script/run_all_linters

bud test is not much shorter than calling script/test for example. The idea is to introduce an indirection that will be easy to document and remember by being consistent across projects regardless of the programming language used (rails test? pytest -v? npm test? go test ./...?).

$ bud lint
🐼  running script/lint
pkg/project/current.go:14:2:warning: unused variable or constant someVariable declared but not used (varcheck)

Open Command

The command bud open <name> will open a link about the project with the OS default handler (using open/xdg-open).

Custom links

They are defined in dev.yml:

open:
  staging: https://staging.myapp.com
  doc: https://godoc.org/github.com/org/myapp

Tip: dev open is enough if there is only one link.

Github links:

  • github/gh: open the Github source code page for your checked out branch
  • pullrequest/pr: open the Github pull-request page for your checked out branch