Skip to content

Commit

Permalink
change command
Browse files Browse the repository at this point in the history
  • Loading branch information
pior committed Jun 3, 2018
1 parent 6aebb91 commit 9a5429d
Show file tree
Hide file tree
Showing 28 changed files with 119 additions and 119 deletions.
2 changes: 1 addition & 1 deletion DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ Initialize the shell:

```bash
# DAD_DEBUG=1
eval "$(dad --init)"
eval "$(bud --init)"
```
58 changes: 29 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
# Dad
# DevBuddy

[![Go Report Card](https://goreportcard.com/badge/github.com/pior/dad)](https://goreportcard.com/report/github.com/pior/dad)
[![CircleCI](https://circleci.com/gh/pior/dad.svg?style=svg)](https://circleci.com/gh/pior/dad)
[![GitHub Release](https://img.shields.io/github/release/pior/dad.svg)](https://github.com/pior/dad/releases/latest)
[![GitHub Release Date](https://img.shields.io/github/release-date/pior/dad.svg)](https://github.com/pior/dad/releases/latest)
[![Go Report Card](https://goreportcard.com/badge/github.com/devbuddy/devbuddy)](https://goreportcard.com/report/github.com/devbuddy/devbuddy)
[![CircleCI](https://circleci.com/gh/devbuddy/devbuddy.svg?style=svg)](https://circleci.com/gh/devbuddy/devbuddy)
[![GitHub Release](https://img.shields.io/github/release/devbuddy/devbuddy.svg)](https://github.com/devbuddy/devbuddy/releases/latest)
[![GitHub Release Date](https://img.shields.io/github/release-date/devbuddy/devbuddy.svg)](https://github.com/devbuddy/devbuddy/releases/latest)

## What is this?

**Dad** is an open-source implementation of an amazing internal tool developed at
**DevBuddy** is an open-source implementation of an amazing internal tool developed at
[Shopify](https://engineering.shopify.com) called "**Dev**".

The first goal of this tools is to automate the **setup** tasks required to work on a project.

With **Dad**, pushing a change on a project you never touched look like this:
With **DevBuddy**, pushing a change on a project you never touched look like this:

- `dad clone pior/dad`
- `dad up`
- `bud clone devbuddy/devbuddy`
- `bud up`
- `git commit`
- `dad test`
- `bud test`
- `git push`

## Status and progress

**Dad** is mostly useful for Python and Go projects. More languages will be natively
supported. Additional automatic tasks will also be implemented, making **Dad** also
**DevBuddy** is mostly useful for Python and Go projects. More languages will be natively
supported. Additional automatic tasks will also be implemented, making **DevBuddy** also
useful for languages without native support.

See the project config [documentation](docs/Config.md).
Expand Down Expand Up @@ -54,7 +54,7 @@ Others
- Notification when important files (eg: `requirements.txt`) are updated locally
(eg: by `git pull`)
- A `help` command to guide a new developer based on `dev.yml`
- A `upgrade` command to auto-upgrade **Dad**
- A `upgrade` command to auto-upgrade **DevBuddy**

### Hosting platform:

Expand All @@ -72,24 +72,24 @@ Others
## Install

```bash
$ bash -c "$(curl -sL https://raw.githubusercontent.com/pior/dad/master/install.sh)"
$ bash -c "$(curl -sL https://raw.githubusercontent.com/devbuddy/devbuddy/master/install.sh)"
```

Uninstall it:
```bash
$ sudo rm /usr/local/bin/dad
$ sudo rm /usr/local/bin/bud
```

## Setup

★ Install the shell integration (in `~/.bash_profile`):
```bash
eval "$(dad --shell-init --with-completion)"
eval "$(bud --shell-init --with-completion)"
```

A safer version:
```bash
type dad > /dev/null 2> /dev/null && eval "$(dad --shell-init --with-completion)"
type bud > /dev/null 2> /dev/null && eval "$(bud --shell-init --with-completion)"
```

## Usage
Expand All @@ -112,13 +112,13 @@ commands:
desc: Lint the project
run: script/lint
```
See Dad own [dev.yml](dev.yml)
See DevBuddy own [dev.yml](dev.yml)

```bash
$ dad
$ bud
Usage:
dad [flags]
dad [command]
bud [flags]
bud [command]

Available Commands:
cd Jump to a local project
Expand All @@ -131,12 +131,12 @@ Available Commands:
up Ensure the project is up and running

Flags:
-h, --help help for dad
-h, --help help for bud
--shell-init Shell initialization
--version version for dad
--version version for bud
--with-completion Enable completion during initialization

Use "dad [command] --help" for more information about a command.
Use "bud [command] --help" for more information about a command.
```

## Development
Expand All @@ -145,7 +145,7 @@ Use "dad [command] --help" for more information about a command.
```bash
~ $ mkdir -p ~/src/github.com/pior
~ $ cd ~/src/github.com/pior
~/src/github.com/pior $ git clone git@github.com:pior/dad.git
~/src/github.com/pior $ git clone git@github.com:devbuddy/devbuddy.git
```

★ Fetch the dependencies (in `vendor`)
Expand All @@ -162,11 +162,11 @@ Use "dad [command] --help" for more information about a command.

To show the debug messages, add this before in your environment:
```bash
export DAD_DEBUG=1
export BUD_DEBUG=1
```
Or:
```bash
$ dad-enable-debug # dad-disable-debug
$ bud-enable-debug # bud-disable-debug
```

### Release
Expand All @@ -184,8 +184,8 @@ Expected:
1. The CI process will test the release
2. The CI process will publish macOS/Linux binaries to the Github Releases page

Updating the [install.sh](https://github.com/pior/dad/blob/master/install.sh) script is probably a good idea.
Updating the [install.sh](https://github.com/devbuddy/devbuddy/blob/master/install.sh) script is probably a good idea.

## License

[MIT](https://github.com/pior/dad/blob/master/LICENSE)
[MIT](https://github.com/devbuddy/devbuddy/blob/master/LICENSE)
File renamed without changes.
2 changes: 1 addition & 1 deletion dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ up:
commands:
testup:
desc: Build, install and run the development version
run: go install && dad up
run: go install && bud up

test:
desc: Run the unittests
Expand Down
10 changes: 5 additions & 5 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -eu

VERSION="v0.3.0"
DEST="/usr/local/bin"
SHELL_LINE='eval "$(dad --shell-init --with-completion)"'
SHELL_LINE='eval "$(bud --shell-init --with-completion)"'

YELLOW="\033[1;33m"
BLUE="\033[1;34m"
Expand Down Expand Up @@ -41,22 +41,22 @@ header() {

banner() {
echo ""
echo -e "${YELLOW}Welcome to Dad installer!${RESET}"
echo -e "${YELLOW}Welcome to DevBuddy installer!${RESET}"
}

instructions() {
echo ""
echo -e "${YELLOW}Good!${RESET}\n"
echo -e "${WHITE}Now, all you need is to add this to your bash .profile:${RESET}\n"
echo -e " ${CODE}" ${SHELL_LINE} "${RESET}\n"
echo -e "Report any issue to ${LINK}https://github.com/pior/dad/issues${RESET}\n"
echo -e "Report any issue to ${LINK}https://github.com/devbuddy/devbuddy/issues${RESET}\n"
}

main() {
banner

header "Downloading binary from Github"
URL="https://github.com/pior/dad/releases/download/${VERSION}/dad-$(make_variant)"
URL="https://github.com/devbuddy/devbuddy/releases/download/${VERSION}/bud-$(make_variant)"
TMPFILE=`mktemp`
curl -L -# --fail "${URL}" -o "${TMPFILE}"

Expand All @@ -68,7 +68,7 @@ main() {
read -p "Correct? [enter]"

header "Installing to ${DEST}"
sudo install "${TMPFILE}" "${DEST}/dad"
sudo install "${TMPFILE}" "${DEST}/bud"

[[ -e "${TMPFILE}" ]] && unlink "${TMPFILE}"

Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var rootCmd *cobra.Command

func build(version string) {
rootCmd = &cobra.Command{
Use: "dad",
Use: "bud",
Run: rootRun,
Version: version,
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

var upgradeCmd = &cobra.Command{
Use: "upgrade",
Short: "[experimental] Upgrade dad to the latest available release.",
Short: "[experimental] Upgrade DevBuddy to the latest available release.",
Run: upgradeRun,
Args: noArgs,
}
Expand All @@ -25,7 +25,7 @@ func upgradeRun(cmd *cobra.Command, args []string) {

ui := termui.NewUI(cfg)

plateform := fmt.Sprintf("dad-%s-%s", runtime.GOOS, runtime.GOARCH)
plateform := fmt.Sprintf("bud-%s-%s", runtime.GOOS, runtime.GOARCH)

ui.CommandRun("Getting latest release for", plateform)

Expand Down
6 changes: 3 additions & 3 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type Config struct {
homeDir string // the user home directory
DebugEnabled bool // whether debug logging is activated
SourceDir string // projects base directory
dataDir string // directory managed by Dad (languages distribs, virtualenvs...)
dataDir string // directory managed by DevBuddy (languages distribs, virtualenvs...)
}

func NewTestConfig() *Config {
Expand All @@ -33,13 +33,13 @@ func Load() (*Config, error) {
homeDir: homedir,
DebugEnabled: debugEnabled(),
SourceDir: filepath.Join(homedir, "src"),
dataDir: filepath.Join(userDataDir, "dad"),
dataDir: filepath.Join(userDataDir, "bud"),
}
return &c, nil
}

func debugEnabled() bool {
return os.Getenv("DAD_DEBUG") != ""
return os.Getenv("BUD_DEBUG") != ""
}

func getHomeDir() (string, error) {
Expand Down
6 changes: 3 additions & 3 deletions pkg/env/env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
func TestGetActiveFeatures(t *testing.T) {
envs := [][]string{
[]string{},
[]string{"DAD_AUTO_ENV_FEATURES="},
[]string{"DAD_AUTO_ENV_FEATURES=f1=v1"},
[]string{"DAD_AUTO_ENV_FEATURES=f1=v1:f2=v2"},
[]string{"BUD_AUTO_ENV_FEATURES="},
[]string{"BUD_AUTO_ENV_FEATURES=f1=v1"},
[]string{"BUD_AUTO_ENV_FEATURES=f1=v1:f2=v2"},
}
features := []map[string]string{
map[string]string{},
Expand Down
2 changes: 1 addition & 1 deletion pkg/env/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strings"
)

const autoEnvVariableName = "DAD_AUTO_ENV_FEATURES"
const autoEnvVariableName = "BUD_AUTO_ENV_FEATURES"

// GetActiveFeatures returns a Hash of feature name -> param
func (e *Env) GetActiveFeatures() map[string]string {
Expand Down
4 changes: 2 additions & 2 deletions pkg/helpers/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ func (g *Github) listReleases() (releases *GithubReleaseList, err error) {
}

func releaseURL() string {
url := os.Getenv("DAD_RELEASE_URL")
url := os.Getenv("BUD_RELEASE_URL")
if url != "" {
return url
}
return "https://api.github.com/repos/pior/dad/releases/latest"
return "https://api.github.com/repos/devbuddy/devbuddy/releases/latest"
}

// LatestRelease get latest release url for a specific `platform`
Expand Down
16 changes: 8 additions & 8 deletions pkg/helpers/github_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/dnaeon/go-vcr/recorder"
)

const baseURL = "https://github.com/pior/dad/releases/download/v0.1.0"
const baseURL = "https://github.com/devbuddy/devbuddy/releases/download/v0.1.0"

func buildGithubClient(t *testing.T) (g *Github, r *recorder.Recorder) {
r, err := recorder.New("fixtures/github")
Expand All @@ -24,11 +24,11 @@ func buildGithubClient(t *testing.T) (g *Github, r *recorder.Recorder) {
func TestLatestReleaseOnDarwin(t *testing.T) {
g, r := buildGithubClient(t)

darwin, err := g.LatestRelease("dad-darwin-amd64")
darwin, err := g.LatestRelease("bud-darwin-amd64")
require.NoError(t, err, "github.LatestRelease() failed")

require.Equal(t, fmt.Sprintf("%s/dad-darwin-amd64", baseURL), darwin.DownloadURL)
require.Equal(t, "dad-darwin-amd64", darwin.Plateform)
require.Equal(t, fmt.Sprintf("%s/bud-darwin-amd64", baseURL), darwin.DownloadURL)
require.Equal(t, "bud-darwin-amd64", darwin.Plateform)

err = r.Stop()
require.NoError(t, err, "Recorder.Stop() failed")
Expand All @@ -37,11 +37,11 @@ func TestLatestReleaseOnDarwin(t *testing.T) {
func TestLatestReleaseOnLinux(t *testing.T) {
g, r := buildGithubClient(t)

linux, err := g.LatestRelease("dad-linux-amd64")
linux, err := g.LatestRelease("bud-linux-amd64")
require.NoError(t, err, "github.LatestRelease() failed")

require.Equal(t, fmt.Sprintf("%s/dad-linux-amd64", baseURL), linux.DownloadURL)
require.Equal(t, "dad-linux-amd64", linux.Plateform)
require.Equal(t, fmt.Sprintf("%s/bud-linux-amd64", baseURL), linux.DownloadURL)
require.Equal(t, "bud-linux-amd64", linux.Plateform)

err = r.Stop()
require.NoError(t, err, "Recorder.Stop() failed")
Expand All @@ -50,6 +50,6 @@ func TestLatestReleaseOnLinux(t *testing.T) {
func TestLatestReleaseOnUnknown(t *testing.T) {
g, _ := buildGithubClient(t)

_, err := g.LatestRelease("dad-linux-amd128")
_, err := g.LatestRelease("bud-linux-amd128")
require.Error(t, err)
}
2 changes: 1 addition & 1 deletion pkg/helpers/upgrader.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (u *Upgrader) Perform(ui *termui.UI, destinationPath string, sourceURL stri
return
}

tmpFile, err := ioutil.TempFile("", "dad-")
tmpFile, err := ioutil.TempFile("", "bud-")
if err != nil {
return
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/helpers/upgrader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
"testing"

"github.com/Flaque/filet"

"github.com/dnaeon/go-vcr/recorder"
"github.com/stretchr/testify/require"

"github.com/devbuddy/devbuddy/pkg/config"
"github.com/devbuddy/devbuddy/pkg/termui"
"github.com/stretchr/testify/require"
)

func TestUpgraderLatestRelease(t *testing.T) {
Expand Down Expand Up @@ -42,7 +42,7 @@ func TestUpgraderLatestRelease(t *testing.T) {
u := NewUpgraderWithHTTPClient(client, false)

ui := termui.NewUI(config.NewTestConfig())
err = u.Perform(ui, target.Name(), "https://github.com/pior/dad/releases/download/v0.1.0/dad-darwin-amd64")
err = u.Perform(ui, target.Name(), "https://github.com/devbuddy/devbuddy/releases/download/v0.1.0/bud-darwin-amd64")
require.NoError(t, err, "upgrader.Perform() failed")

result, err := ioutil.ReadFile(target.Name())
Expand Down
2 changes: 1 addition & 1 deletion pkg/integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func AddFinalizerCd(path string) error {
func addFinalizer(action, arg string) (err error) {
content := fmt.Sprintf("%s:%s\n", action, arg)

finalizerPath := os.Getenv("DAD_FINALIZER_FILE")
finalizerPath := os.Getenv("BUD_FINALIZER_FILE")

if finalizerPath == "" {
fmt.Println(color.Red("Shell integration error:"), "can't run a finalizer action:", color.Brown(content))
Expand Down
2 changes: 1 addition & 1 deletion pkg/tasks/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func activateFeature(ctx *context, task Task) (err error) {
}
}

// Special case, we want the dad process to get PATH updates from features to call the right processes.
// Special case, we want the bud process to get PATH updates from features to call the right processes.
// Like the pip process from the newly activated virtualenv.
// Explanation: exec.Command calls exec.LookPath to find the executable path, which rely on the PATH of
// the process itself.
Expand Down

0 comments on commit 9a5429d

Please sign in to comment.