Browse Source

Download package updates before building

pull/25/head
Sam 5 years ago
parent
commit
dbf53680e6
  1. 23
      mage.go

23
mage.go

@ -62,8 +62,25 @@ func createEmojiSlice() ([]string, error) { @@ -62,8 +62,25 @@ func createEmojiSlice() ([]string, error) {
return emojiSlice, nil
}
func getRemotePackages() error {
var packages = []string{
"samhofi.us/x/keybase",
"github.com/awesome-gocui/gocui",
"github.com/magefile/mage/mage",
"github.com/magefile/mage/mg",
"github.com/magefile/mage/sh",
}
for _, p := range packages {
if err := sh.Run("go", "get", "-u", p); err != nil {
return err
}
}
return nil
}
// Build kbtui with emoji lookup support
func BuildEmoji() error {
mg.Deps(getRemotePackages)
emojis, err := createEmojiSlice()
if err != nil {
return err
@ -93,6 +110,7 @@ func exit(err error) { @@ -93,6 +110,7 @@ func exit(err error) {
// Build kbtui with just the basic commands.
func Build() {
mg.Deps(getRemotePackages)
if err := sh.Run("go", "build"); err != nil {
defer func() {
exit(err)
@ -104,6 +122,7 @@ func Build() { @@ -104,6 +122,7 @@ func Build() {
// The ShowReactions TypeCommand will print a message in the feed window when
// a reaction is received in the current conversation.
func BuildShowReactions() {
mg.Deps(getRemotePackages)
if err := sh.Run("go", "build", "-tags", "showreactionscmd"); err != nil {
defer func() {
exit(err)
@ -116,6 +135,7 @@ func BuildShowReactions() { @@ -116,6 +135,7 @@ func BuildShowReactions() {
// received in the current conversation. This gets pretty annoying, and
// is not recommended.
func BuildAutoReact() {
mg.Deps(getRemotePackages)
if err := sh.Run("go", "build", "-tags", "autoreactcmd"); err != nil {
defer func() {
exit(err)
@ -125,6 +145,7 @@ func BuildAutoReact() { @@ -125,6 +145,7 @@ func BuildAutoReact() {
// Build kbtui with all commands and TypeCommands disabled.
func BuildAllCommands() {
mg.Deps(getRemotePackages)
if err := sh.Run("go", "build", "-tags", "allcommands"); err != nil {
defer func() {
exit(err)
@ -134,6 +155,7 @@ func BuildAllCommands() { @@ -134,6 +155,7 @@ func BuildAllCommands() {
// Build kbtui with all Commands and TypeCommands enabled.
func BuildAllCommandsT() {
mg.Deps(getRemotePackages)
if err := sh.Run("go", "build", "-tags", "type_commands,allcommands"); err != nil {
defer func() {
exit(err)
@ -143,6 +165,7 @@ func BuildAllCommandsT() { @@ -143,6 +165,7 @@ func BuildAllCommandsT() {
// Build kbtui with beta functionality
func BuildBeta() {
mg.Deps(getRemotePackages)
mg.Deps(BuildEmoji)
if err := sh.Run("go", "build", "-tags", "allcommands,showreactionscmd,emojiList,tabcompletion"); err != nil {
defer func() {

Loading…
Cancel
Save