Graphql-engine: Add hasura-cli to brew

Created on 11 Sep 2018  路  13Comments  路  Source: hasura/graphql-engine

Lazy users like me prefer to use https://brew.sh/

brew install hasura-cli

rather than download something :)

cli

Most helpful comment

I have created a draft PR for this. I tried getting it in with "v1.0.0-beta.8", but the formula will not be allowed in to Homebrew/homebrew-core without a "stable" version. I will keep my eye on it and push it through as soon as hasura/graphql-engine v1.0.0 is released.

All 13 comments

I have created a draft PR for this. I tried getting it in with "v1.0.0-beta.8", but the formula will not be allowed in to Homebrew/homebrew-core without a "stable" version. I will keep my eye on it and push it through as soon as hasura/graphql-engine v1.0.0 is released.

@Kjens93 we have now released the stable version. Would you mind trying this again? 馃檪

@marionschleifer Absolutely! I'm tied up at work today, but I will get it take care of in the next couple of days for sure.

Update: ran into a hiccup with this while trying to get it to work with dep and It appears that go.mod isn't present in the stable 1.0.0 tagged release. Will keep trying to get it working as-is, but may have to wait for the next release. Will also be submitting a PR with a build improvement as requested by the homebrew core team.

@Kjens93 We changed to go modules after 1.0 was released, so, 1.0 tag still uses dep. The build command can be found in the makefile.

Any updates on this? It would be great to be able to install the cli via brew

@leos we ended up going with a different solution at @evereepay, so this was de-prioritized on my end. Unfortunately I don't have bandwidth to try this again right now (newborn + toddler + working at home), so someone else might have to take a crack at it. Sorry folks. 馃槥

@marionschleifer @shahidhk I'm happy to hack on this - it seems fairly straightforward, however the homebrew guidelines are to not have self-upgradable software - https://docs.brew.sh/Acceptable-Formulae#we-dont-like-tools-that-upgrade-themselves - I can probably remove /commands/update-cli.go and related pieces as part of the homebrew install/compilation but it would be better if it was a compile time option. Is that something you would consider adding?

Hey @leos, I think this is doable and we can consider adding this.
Will disabling adding the update-cli command do? we can maybe add a new ldflag which can disable it at build time.

gox -ldflags \
  '-X github.com/hasura/graphql-engine/cli/version.BuildVersion=$(VERSION)
  -X github.com/hasura/graphql-engine/cli/plugins.IndexBranchRef=$(PLUGINS_BRANCH)
  -X github.com/hasura/graphql-engine/cli/commands.IsUpdateCommandEnabled=false
  -s -w -extldflags "-static"' \
-rebuild \
-os="${OS}" \
-arch="amd64" \
-output="${OUTPUT_DIR}/${VERSION}/cli-hasura-{{.OS}}-{{.Arch}}" \
./cmd/hasura/


$ hasura

   / /_   ____ _ _____ __  __ _____ ____ _
  / __ \ / __ `// ___// / / // ___// __ `/
 / / / // /_/ /(__  )/ /_/ // /   / /_/ /
/_/ /_/ \__,_//____/ \__,_//_/    \__,_/


GraphQL commands:
  init       Initialize directory for Hasura GraphQL Engine migrations
  migrate    Manage migrations on the database
  metadata   Manage Hasura GraphQL Engine metadata saved in the database
  console    Open console to manage database and try out APIs
  actions    Manage actions on hasura
  seeds      Manage seed data

Other commands:
  completion   Generate auto completion code
  version      Print the CLI version
  plugins      Manage plugins for the cli
  scripts      Execute helper scripts to manage Hasura Projects

Use "hasura [command] --help" for more information about a command.

@scriptonist That would be great - the command and the check for updates should both be disabled. What's the best way to get that done/teed up? Should I open another issue?

@leos Yes please, let's open a new issue to track that.

This now works, feel free to close.

Please address the update disabling ticket. I can do a PR for the Homebrew formula when that's ready.

~ > brew install hasura-cli
==> Downloading https://homebrew.bintray.com/bottles/hasura-cli-1.2.2.catalina.bottle.tar.gz
######################################################################## 100.0%
==> Pouring hasura-cli-1.2.2.catalina.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completions have been installed to:
  /usr/local/share/zsh/site-functions
==> Summary
馃嵑  /usr/local/Cellar/hasura-cli/1.2.2: 8 files, 23.2MB
~ > hasura version                                                                                                                                                
INFO hasura cli                                    version=v1.2.2

Also, please update the install docs for MacOS

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jjangga0214 picture jjangga0214  路  3Comments

bogdansoare picture bogdansoare  路  3Comments

shahidhk picture shahidhk  路  3Comments

sachaarbonel picture sachaarbonel  路  3Comments

coco98 picture coco98  路  3Comments