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) {
return emojiSlice, nil 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 // Build kbtui with emoji lookup support
func BuildEmoji() error { func BuildEmoji() error {
mg.Deps(getRemotePackages)
emojis, err := createEmojiSlice() emojis, err := createEmojiSlice()
if err != nil { if err != nil {
return err return err
@ -93,6 +110,7 @@ func exit(err error) {
// Build kbtui with just the basic commands. // Build kbtui with just the basic commands.
func Build() { func Build() {
mg.Deps(getRemotePackages)
if err := sh.Run("go", "build"); err != nil { if err := sh.Run("go", "build"); err != nil {
defer func() { defer func() {
exit(err) exit(err)
@ -104,6 +122,7 @@ func Build() {
// The ShowReactions TypeCommand will print a message in the feed window when // The ShowReactions TypeCommand will print a message in the feed window when
// a reaction is received in the current conversation. // a reaction is received in the current conversation.
func BuildShowReactions() { func BuildShowReactions() {
mg.Deps(getRemotePackages)
if err := sh.Run("go", "build", "-tags", "showreactionscmd"); err != nil { if err := sh.Run("go", "build", "-tags", "showreactionscmd"); err != nil {
defer func() { defer func() {
exit(err) exit(err)
@ -116,6 +135,7 @@ func BuildShowReactions() {
// received in the current conversation. This gets pretty annoying, and // received in the current conversation. This gets pretty annoying, and
// is not recommended. // is not recommended.
func BuildAutoReact() { func BuildAutoReact() {
mg.Deps(getRemotePackages)
if err := sh.Run("go", "build", "-tags", "autoreactcmd"); err != nil { if err := sh.Run("go", "build", "-tags", "autoreactcmd"); err != nil {
defer func() { defer func() {
exit(err) exit(err)
@ -125,6 +145,7 @@ func BuildAutoReact() {
// Build kbtui with all commands and TypeCommands disabled. // Build kbtui with all commands and TypeCommands disabled.
func BuildAllCommands() { func BuildAllCommands() {
mg.Deps(getRemotePackages)
if err := sh.Run("go", "build", "-tags", "allcommands"); err != nil { if err := sh.Run("go", "build", "-tags", "allcommands"); err != nil {
defer func() { defer func() {
exit(err) exit(err)
@ -134,6 +155,7 @@ func BuildAllCommands() {
// Build kbtui with all Commands and TypeCommands enabled. // Build kbtui with all Commands and TypeCommands enabled.
func BuildAllCommandsT() { func BuildAllCommandsT() {
mg.Deps(getRemotePackages)
if err := sh.Run("go", "build", "-tags", "type_commands,allcommands"); err != nil { if err := sh.Run("go", "build", "-tags", "type_commands,allcommands"); err != nil {
defer func() { defer func() {
exit(err) exit(err)
@ -143,6 +165,7 @@ func BuildAllCommandsT() {
// Build kbtui with beta functionality // Build kbtui with beta functionality
func BuildBeta() { func BuildBeta() {
mg.Deps(getRemotePackages)
mg.Deps(BuildEmoji) mg.Deps(BuildEmoji)
if err := sh.Run("go", "build", "-tags", "allcommands,showreactionscmd,emojiList,tabcompletion"); err != nil { if err := sh.Run("go", "build", "-tags", "allcommands,showreactionscmd,emojiList,tabcompletion"); err != nil {
defer func() { defer func() {

Loading…
Cancel
Save