Skip to content

Commit

Permalink
Release 1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
c4s4 committed May 12, 2019
2 parents 8f09d3d + e10b231 commit ddffe39
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.yml
@@ -1,5 +1,9 @@
# Semantic Change Log (http://github.com/c4s4/changelog)

- version: 1.0.2
date: 2019-05-12
summary: Added web installer

- version: 1.0.1
date: 2019-05-10
summary: Fixed documentation
Expand Down
20 changes: 19 additions & 1 deletion README.md
Expand Up @@ -4,7 +4,25 @@ DotRun command loads dotenv file, loads its environment and runs given command i

## Installation

Drop the binary for your platform in the *bin* directory of the archive somewhere in your `PATH` and rename it *dotrun*.
### Unix users (Linux, BSDs and MacOSX)

Unix users may download and install latest *dotrun* release with command:

```bash
$ sh -c "$(curl http://sweetohm.net/dist/dotrun/install)"
```

If *curl* is not installed on you system, you might run:

```bash
$ sh -c "$(wget -O - http://sweetohm.net/dist/dotrun/install)"
```

**Note:** Some directories are protected, even as *root*, on **MacOSX** (since *El Capitan* release), thus you can't install *dotrun* in */usr/bin* for instance.

### Binary package

Otherwise, you can download latest binary archive at <https://github.com/c4s4/dotrun/releases>. Unzip the archive, put the binary of your platform somewhere in your *PATH* and rename it *dotrun*.

## Usage

Expand Down
15 changes: 12 additions & 3 deletions build.yml
Expand Up @@ -3,8 +3,8 @@
extends: [golang, git, changelog]

properties:
LIBRARIES:
- github.com/joho/godotenv
WEB_HOME: 'casa@sweetohm.net:/home/web/dist/={NAME}'
LIBRARIES: [github.com/joho/godotenv]

environment:
GOPATH: '${GOPATH}:={_BASE}'
Expand Down Expand Up @@ -35,8 +35,17 @@ targets:
- throw: "Test failed:\n={output}"
- print: 'Test OK'

deploy:
doc: Deploy installation script and binaries
depends: binaries
steps:
- print: 'Deploying dotrun binaries...'
- $: ['scp', 'install', =WEB_HOME]
- 'binaries = join(find(".", BUILD_DIR+"/bin/*"), " ")'
- $: 'scp ={binaries} ={WEB_HOME}'

release:
doc: Perform a release
depends: [test, version, archive]
depends: [test, version, archive, deploy]
steps:
- super:
81 changes: 81 additions & 0 deletions install
@@ -0,0 +1,81 @@
#!/bin/sh
#
# Installation script for Unix platforms. To run installation, type :
#
# $ sh -c "$(curl http://sweetohm.net/dist/${NAME}/install)"
#
# or (if you don't have curl installed):
#
# $ sh -c "$(wget -O - http://sweetohm.net/dist/${NAME}/install)"

set -e

NAME="dotrun"

# get OS and ARCH and build binary name
os=`uname | tr '[:upper:]' '[:lower:]'`
arch=`uname -m`

if [ "$arch" = "i386" ]; then
arch="386"
elif [ "$arch" = "x86_64" ]; then
arch="amd64"
elif [ "$arch" = "arm" ]; then
arch="arm"
fi

echo "os: ${os}"
echo "arch: ${arch}"

binary="${NAME}-${os}-${arch}"

# set default installation directory
if [ -d "/opt/local/bin" ]
then
DEFAULT_DIR="/opt/local/bin"
elif [ -d "/opt/bin" ]
then
DEFAULT_DIR="/opt/bin"
elif [ -d "/usr/local/bin" ]
then
DEFAULT_DIR="/usr/local/bin"
elif [ -d "/usr/bin" ]
then
DEFAULT_DIR="/usr/bin"
else
DEFAULT_DIR="/bin"
fi

# select command to download binary
if hash curl 2>/dev/null
then
command="curl -o"
elif hash wget 2>/dev/null
then
command="wget -O"
else
echo "You must install curl or wget to run this installation script"
exit 1
fi

# download binary in /tmp/${NAME} and make it executable
${command} /tmp/${NAME} http://sweetohm.net/dist/${NAME}/${binary}
chmod +x /tmp/${NAME}

# prompt for installation directory
read -p "Installation directory [${DEFAULT_DIR}]? " directory
if [ -z "$directory" ]
then
directory=${DEFAULT_DIR}
fi

# copy binary to installation directory
if [ -w "${directory}" ]
then
mv /tmp/${NAME} ${directory}
else
sudo mv /tmp/${NAME} ${directory}
sudo chown root: ${directory}/${NAME}
fi

echo "${NAME} installed in '${directory}' directory"

0 comments on commit ddffe39

Please sign in to comment.