programandoarg/pg_rails

View on GitHub
bin/anycable-go

Summary

Maintainability
Test Coverage
#!/bin/bash

cd $(dirname $0)/..

# It's recommended to use the exact version of AnyCable-Go here
version="1.5.0"

if [ ! -f ./bin/dist/anycable-go ]; then
  echo "AnyCable-go is not installed, downloading..."
  ./bin/rails g anycable:download --version=$version --bin-path=./bin/dist
fi

curVersion=$(./bin/dist/anycable-go -v)

if [[ "$version" != "latest" ]]; then
  if [[ "$curVersion" != "$version"* ]]; then
    echo "AnyCable-go version is not $version, downloading a new one..."
    ./bin/rails g anycable:download --version=$version --bin-path=./bin/dist
  fi
fi

./bin/dist/anycable-go $@