From 7f917afd5eb10b835df75e91fbe39957ce87c335 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Thu, 10 Feb 2022 19:01:32 +0000 Subject: [PATCH 1/5] Add an ./install.sh as a helper for working with the local coder executable --- README.md | 5 +++++ install.sh | 7 +++++++ 2 files changed, 12 insertions(+) create mode 100755 install.sh diff --git a/README.md b/README.md index 9cd8bc09504a3..a90b6df4338a0 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,11 @@ This repository contains source code for Coder V2. Additional documentation: The `develop.sh` script runs the server locally on port `3000`, and runs a hot-reload server for front-end code on `8080`. +### CLI + +- `./install.sh` will `go install` the `coder` CLI +- `coder --help` + ## Front-End Plan For the front-end team, we're planning on 2 phases to the 'v2' work: diff --git a/install.sh b/install.sh new file mode 100755 index 0000000000000..7bf713e035609 --- /dev/null +++ b/install.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +set -euo pipefail + +go install cmd/coder/main.go +echo "Coder CLI now installed at:" +echo "$(which coder)" From 00ca4ceab6b9ac90f1465c173d3073cc40ee40eb Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Thu, 10 Feb 2022 19:02:00 +0000 Subject: [PATCH 2/5] Fix semantic commit From 0b16731c9f05cc69c47005ec82e00b1781852831 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Fri, 11 Feb 2022 00:27:52 +0000 Subject: [PATCH 3/5] Remove install.sh; add make install target --- Makefile | 8 ++++++++ README.md | 14 +++++++++----- install.sh | 7 ------- 3 files changed, 17 insertions(+), 12 deletions(-) delete mode 100755 install.sh diff --git a/Makefile b/Makefile index e14562b46e848..eb542ce94b648 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +INSTALL_DIR=$(shell go env GOPATH)/bin + bin/coder: mkdir -p bin go build -o bin/coder cmd/coder/main.go @@ -51,6 +53,12 @@ fmt: fmt/prettier fmt/sql gen: database/generate peerbroker/proto provisionersdk/proto provisionerd/proto .PHONY: gen +install: + @echo "--- Copying from bin to $(INSTALL_DIR)" + cp -r ./bin $(INSTALL_DIR) + @echo "-- CLI available at $(INSTALL_DIR)/coder" +.PHONY: install + peerbroker/proto: peerbroker/proto/peerbroker.proto protoc \ --go_out=. \ diff --git a/README.md b/README.md index a90b6df4338a0..d163a45f464f0 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,12 @@ This repository contains source code for Coder V2. Additional documentation: ## Development +### Pre-requisites + +- `git` installed +- `node` and `yarn` installed +- `go` version 1.17, with the `GOPATH` environment variable set + ### Cloning - `git clone https://github.com/coder/coder` @@ -23,6 +29,9 @@ This repository contains source code for Coder V2. Additional documentation: ### Building - `make build` +- `make install` + +The `coder` CLI binary will now be available at `$GOPATH/bin/coder` ### Development @@ -30,11 +39,6 @@ This repository contains source code for Coder V2. Additional documentation: The `develop.sh` script runs the server locally on port `3000`, and runs a hot-reload server for front-end code on `8080`. -### CLI - -- `./install.sh` will `go install` the `coder` CLI -- `coder --help` - ## Front-End Plan For the front-end team, we're planning on 2 phases to the 'v2' work: diff --git a/install.sh b/install.sh deleted file mode 100755 index 7bf713e035609..0000000000000 --- a/install.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -go install cmd/coder/main.go -echo "Coder CLI now installed at:" -echo "$(which coder)" From 44156384991c7defb5b7bb465f8ed7eefcc2f52d Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Fri, 11 Feb 2022 00:29:52 +0000 Subject: [PATCH 4/5] Add wildcard, so on Windows we'll show the '.exe' extension too --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index eb542ce94b648..388eb44b6f434 100644 --- a/Makefile +++ b/Makefile @@ -56,7 +56,7 @@ gen: database/generate peerbroker/proto provisionersdk/proto provisionerd/proto install: @echo "--- Copying from bin to $(INSTALL_DIR)" cp -r ./bin $(INSTALL_DIR) - @echo "-- CLI available at $(INSTALL_DIR)/coder" + @echo "-- CLI available at $(shell ls $(INSTALL_DIR)/coder*)" .PHONY: install peerbroker/proto: peerbroker/proto/peerbroker.proto From 1b55786c20491ea149a95347cc71965dcf289a48 Mon Sep 17 00:00:00 2001 From: Bryan Date: Thu, 10 Feb 2022 19:09:38 -0800 Subject: [PATCH 5/5] Update README.md --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d163a45f464f0..41fd90fbadc2c 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,10 @@ This repository contains source code for Coder V2. Additional documentation: ### Pre-requisites -- `git` installed -- `node` and `yarn` installed +- `git` - `go` version 1.17, with the `GOPATH` environment variable set +- `node` +- `yarn` ### Cloning