From 0e320eca70b44189eba76a29707e0f73baa62e0a Mon Sep 17 00:00:00 2001 From: Tom Chauveau Date: Thu, 6 May 2021 19:20:56 +0200 Subject: [PATCH] Update documentation Signed-off-by: Tom Chauveau --- cmd/dagger/cmd/version.go | 6 ++-- doc/install.md | 16 +++++++++- doc/update.md | 67 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 3 deletions(-) create mode 100644 doc/update.md diff --git a/cmd/dagger/cmd/version.go b/cmd/dagger/cmd/version.go index 2faf3c68..e8ac6f81 100644 --- a/cmd/dagger/cmd/version.go +++ b/cmd/dagger/cmd/version.go @@ -46,7 +46,7 @@ var versionCmd = &cobra.Command{ runtime.GOOS, runtime.GOARCH, ) - if check := viper.GetBool("check"); check != false { + if check := viper.GetBool("check"); check { upToDate, err := isVersionLatest() if err != nil { fmt.Println("error: could not check version.") @@ -110,10 +110,12 @@ func getOnlineVersion(currentVersion *goVersion.Version) (*goVersion.Version, er return nil, err } + defer resp.Body.Close() data, err := ioutil.ReadAll(resp.Body) if err != nil { return nil, err } + latestVersion := strings.TrimSuffix(string(data), "\n") return goVersion.NewVersion(latestVersion) } @@ -164,7 +166,7 @@ func checkVersion() { // Update check timestamps file now := time.Now().Format(time.RFC3339) - ioutil.WriteFile(daggerDirectory+"/version_check.txt", []byte(now), 0644) + ioutil.WriteFile(daggerDirectory+"/version_check.txt", []byte(now), 0600) } } diff --git a/doc/install.md b/doc/install.md index 5f245931..bd2dd5a0 100644 --- a/doc/install.md +++ b/doc/install.md @@ -1,5 +1,11 @@ # Installing Dagger +## Summary + - [Option 1 (Mac OS only): install from Homebrew](#option-1--mac-os-only---install-from-homebrew) + - [Option 2: install from a shell script](#option-2--install-from-a-shell-script) + - [Option 3: Manually fetch the latest binary release from Github](#option-3--manually-fetch-the-latest-binary-release-from-github) + - [Option 4: Compile from source](#option-4--compile-from-source) + ## Option 1 (Mac OS only): install from Homebrew From your Mac OS terminal, run the following command: @@ -8,12 +14,14 @@ From your Mac OS terminal, run the following command: brew install dagger/tap/dagger ``` +> :bulb: Verify the installation with `dagger version`. + ## Option 2: install from a shell script From a terminal, run the following command: ```shell -curl -sfL https://dagger-io.s3.amazonaws.com/dagger/install.sh | sh +curl -sfL https://releases.dagger.io/dagger/install.sh | sh ``` You now have the dagger binary in the local directory under `./bin/dagger`. @@ -24,12 +32,16 @@ You can then install it globally on your system: sudo mv ./bin/dagger /usr/local/bin ``` +> :bulb: Verify the installation with `dagger version`. + ## Option 3: Manually fetch the latest binary release from Github Open your web browser to [the latest release](https://github.com/dagger/dagger/releases/latest). From the **assets** section, download the archive corresponding to your OS and Arch. +> :bulb: Verify the installation with `dagger version`. + ## Option 4: Compile from source You will need [Go](https://golang.org) version 1.16 or later. @@ -51,3 +63,5 @@ cd dagger; make ```shell cp ./cmd/dagger/dagger /usr/local/bin ``` + +> :bulb: Verify the installation with `dagger version`. \ No newline at end of file diff --git a/doc/update.md b/doc/update.md new file mode 100644 index 00000000..0b0c4cea --- /dev/null +++ b/doc/update.md @@ -0,0 +1,67 @@ +# Updating Dagger + +## Summary + - [Option 1: (Mac OS only): update from Homebrew](#option-1--mac-os-only---update-from-homebrew) + - [Option 2: update from a shell script](#option-2--update-from-a-shell-script) + - [Option 3: Manually fetch the latest binary release from Github](#option-3--manually-fetch-the-latest-binary-release-from-github) + - [Option 4: Compile from source](#option-4--compile-from-source) + +## Option 1: (Mac OS only): update from Homebrew + +From your Mac OS terminal, run the following command: + +```shell +brew update dagger/tap/dagger +``` + +> :bulb: Verify the update with `dagger version`. + +## Option 2: update from a shell script + +From a terminal, run the following command: + +```shell +curl -sfL https://releases.dagger.io/dagger/install.sh | sh +``` + +You now have the dagger binary in the local directory under `./bin/dagger`. + +You can then update it globally on your system: + +```shell +sudo mv ./bin/dagger /usr/local/bin +``` + +> :bulb: Verify the update with `dagger version`. + +## Option 3: Manually fetch the latest binary release from Github + +Open your web browser to [the latest release](https://github.com/dagger/dagger/releases/latest). + +From the **assets** section, download the archive corresponding to your OS and Arch. + +> :bulb: Verify the update with `dagger version`. + +## Option 4: Compile from source + +You will need [Go](https://golang.org) version 1.16 or later. + +1. Clone the dagger repository + +```shell +git clone https://github.com/dagger/dagger.git +``` + +2. Build the `dagger` binary. + +```shell +cd dagger; make +``` + +3. Copy the `dagger` tool to a location listed in your `$PATH`. For example, to copy it to `/usr/local/bin`: + +```shell +cp ./cmd/dagger/dagger /usr/local/bin +``` + +> :bulb: Verify the update with `dagger version`. \ No newline at end of file