aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorXe Iaso <me@xeiaso.net>2023-08-11 04:02:40 -0700
committerXe Iaso <me@xeiaso.net>2023-08-11 04:02:56 -0700
commitab469b10678483b8ad41bd994668eab2825ba514 (patch)
tree18c089a42f5da3884145b6c73301703e59cd2835 /internal
parent16f60b165a114d4c41581257b513665ea16e06f7 (diff)
downloadx-ab469b10678483b8ad41bd994668eab2825ba514.tar.xz
x-ab469b10678483b8ad41bd994668eab2825ba514.zip
cmd: add yeet for build automation
Diffstat (limited to 'internal')
-rw-r--r--internal/appsluggr/appsluggr.go14
-rw-r--r--internal/kahless/kahless.go5
-rw-r--r--internal/yeet/yeet.go2
3 files changed, 14 insertions, 7 deletions
diff --git a/internal/appsluggr/appsluggr.go b/internal/appsluggr/appsluggr.go
index 0450c39..7fd1732 100644
--- a/internal/appsluggr/appsluggr.go
+++ b/internal/appsluggr/appsluggr.go
@@ -17,15 +17,15 @@ import (
// Must calls Pack and panics on an error.
//
// This is useful for using appsluggr from yeet scripts.
-func Must(fname, outFname string) {
- if err := Pack(fname, outFname); err != nil {
+func Must(fname, outFname string, extraFiles ...map[string]string) {
+ if err := Pack(fname, outFname, extraFiles...); err != nil {
log.Panicf("error packing %s into %s: %v", fname, outFname, err)
}
}
// Pack takes a statically linked binary and packs it into a Heroku-compatible slug image
// at outFname.
-func Pack(fname string, outFname string) error {
+func Pack(fname string, outFname string, extraFiles ...map[string]string) error {
dir, err := os.MkdirTemp("", "appsluggr")
if err != nil {
return err
@@ -50,6 +50,14 @@ func Pack(fname string, outFname string) error {
return err
}
+ for _, finfo := range extraFiles {
+ for src, dst := range finfo {
+ if err := copy.Copy(src, dst); err != nil {
+ return err
+ }
+ }
+ }
+
copy.Copy("config.ts", dir)
if err := os.WriteFile(filepath.Join(dir, "Procfile"), []byte("web: /app/bin/main\n"), 0777); err != nil {
diff --git a/internal/kahless/kahless.go b/internal/kahless/kahless.go
index c7f3dbe..1480612 100644
--- a/internal/kahless/kahless.go
+++ b/internal/kahless/kahless.go
@@ -4,7 +4,6 @@ import (
"bytes"
"flag"
"io"
- "io/ioutil"
"log"
"net"
"os"
@@ -21,7 +20,7 @@ func getAgent() (agent.Agent, error) {
}
var (
- greedoAddr = flag.String("kahless-addr", "lufta.cetacean.club:22", "address to use for kahless")
+ greedoAddr = flag.String("kahless-addr", "lufta:22", "address to use for kahless")
greedoUser = flag.String("kahless-user", "cadey", "username to use for kahless")
)
@@ -48,7 +47,7 @@ func Dial() (*ssh.Client, error) {
// Copy copies a local file reader to the remote destination path. This copies the enitre contents of contents into ram. Don't use this function if doing so is a bad idea. Only works on files less than 2 GB.
func Copy(mode os.FileMode, fileName string, contents io.Reader, destinationPath string) error {
- data, err := ioutil.ReadAll(contents)
+ data, err := io.ReadAll(contents)
if err != nil {
return err
}
diff --git a/internal/yeet/yeet.go b/internal/yeet/yeet.go
index 4d73de3..e14ae49 100644
--- a/internal/yeet/yeet.go
+++ b/internal/yeet/yeet.go
@@ -25,7 +25,7 @@ func init() {
}
WD = lwd
- DateTag = time.Now().Format("010220061504")
+ DateTag = time.Now().Format("200601021504")
}
// ShouldWork explodes if the given command with the given env, working dir and context fails.