Basic shell changes + docker build system.

This commit is contained in:
Corey Butler
2016-11-02 20:08:16 -05:00
parent 8a673b24b4
commit 77e7c3fe27
29 changed files with 118 additions and 0 deletions

15
Dockerfile Normal file
View File

@@ -0,0 +1,15 @@
# Installation Builder
FROM golang:1.7.3-alpine
MAINTAINER Author.io
ADD ./app /app
WORKDIR /app
RUN apk add -U git \
&& cd /app \
&& export PATH=$PATH:$GOPATH/bin \
&& go get github.com/inconshreveable/go-update \
&& go get gopkg.in/urfave/cli.v2 \
&& go get github.com/olekukonko/tablewriter \
&& apk del git \
&& rm -rf /tmp/* /var/cache/apk/*

View File

@@ -1,3 +1,40 @@
# switch
Switch is a Node.js Version Management utility.
**Key Features:**
- [ ] Installation
- [ ] Switching
- [ ] Hooks
- [ ] Pre-Install
- [ ] Post-Install
- [ ] Pre-Use
- [ ] Post-Use
- [ ] Shared Global npm Modules (optional)
- [ ] Download Mirror Support
- [ ] Daemon
- [ ] Web Dashboard
- [ ] Notifications? (new Node versions)
- [ ] Install Shortcuts
- [ ] lts
- [ ] latest
- [ ] MAJOR (ex: `6` installs `6.9.1`)
- [ ] MINOR (ex: `6.9` installs `6.9.1`)
- [ ] npm fallback
- [ ] Automatic Updates
**Available For:**
- [ ] Windows 8/8.1/10
- [ ] GUI, .msi, silent installer
- [ ] Chocolatey
- [ ] macOS
- [ ] dmg/app
- [ ] homebrew
- [ ] Linux
- [ ] rpm
- [ ] yum
- [ ] apt-get
- [ ] apk
- [ ] Docker
- [ ] IBMi?
[![Tweet This!][1.1] Tweet This!][1]
[1.1]: http://i.imgur.com/wWzX9uB.png (Tweet about NVM for Windows)
[1]: https://twitter.com/intent/tweet?hashtags=nodejs&original_referer=http%3A%2F%2F127.0.0.1%3A91%2F&text=Check%20out%20NVM%20for%20Windows!&tw_p=tweetbutton&url=http%3A%2F%2Fgithub.com%2Fcoreybutler%2Fnvm-windows&via=goldglovecb

49
app/switch.go Normal file
View File

@@ -0,0 +1,49 @@
package main
import (
"io"
"os"
"github.com/olekukonko/tablewriter"
)
const (
AppName = "switch"
AppVersion = "1.0.0"
Description = ""
)
func main() {
help()
}
func log(msg string) {
io.WriteString(os.Stdout, msg)
}
func cmd(subcmd string) string {
return AppName + " " + subcmd
}
func xcmd(subcmd string) string {
return "[X] " + AppName + " " + subcmd
}
func help() {
log("\nRunning " + AppName + " v" + AppVersion + ".")
log("\n\nUsage:\n\n")
data := [][]string{
[]string{xcmd("install <version> [arch]"), "The <version> can be a specific Node.js semantic version number, \"latest\" for the latest available release, or \"lts\" for the latest LTS release. Optionally specify whether to install the 32 or 64 bit version (defaults to system arch). Set [arch] to \"all\" to install 32 AND 64 bit versions."},
[]string{xcmd("uninstall <version>"), "Must be a specific version (x.x.x)."},
}
table := tablewriter.NewWriter(os.Stdout)
table.SetBorder(false)
table.SetCenterSeparator("")
table.SetColumnSeparator("")
table.SetColWidth(40)
table.AppendBulk(data)
table.Render()
log("\n\nCopyright (c) 2017 Author.io and Contributors.\n\n")
}

8
build.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/sh
docker run --rm \
--name switch-builder \
-e GOOS=windows \
-e GOARCH=386 \
-v "$(pwd)/out:/out" \
-v "$(pwd)/app:/app" \
switch go build -o /out/switch.exe /app/switch.go

Binary file not shown.

Binary file not shown.

7
dev.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/sh
docker run --rm -it \
--name switch-builder \
-e GOOS=linux \
-e GOARCH=386 \
-v "$(pwd)/app:/app" \
switch sh

2
mkenv.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/sh
docker build -t switch .

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB