Skip to content

Commit

Permalink
Revised paths for autorun and autoinstall. Prepping for 0.1.0 Release…
Browse files Browse the repository at this point in the history
… of the Demo
  • Loading branch information
miketheprogrammer committed Oct 18, 2014
1 parent 84aaa62 commit fc4c942
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 37 deletions.
14 changes: 8 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ vendor/linux/x64/thrust_shell

vendor/darwin/x64/ThrustShell.app

release/vendor/linux/x64/content_shell.pak
release/vendor/linux/x64/icudtl.dat
release/vendor/linux/x64/libchromiumcontent.so
release/vendor/linux/x64/libffmpegsumo.so
release/vendor/linux/x64/thrust_shell
release/go-thrust/vendor/linux/x64/content_shell.pak
release/go-thrust/vendor/linux/x64/icudtl.dat
release/go-thrust/vendor/linux/x64/libchromiumcontent.so
release/go-thrust/vendor/linux/x64/libffmpegsumo.so
release/go-thrust/go-thrust/vendor/linux/x64/thrust_shell

release/vendor/darwin/x64/ThrustShell.app
release/vendor/darwin/x64/ThrustShell.app

dist/*
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ Please note Complete Support will never be toggled until Thrust core is stable.

- [ ] SubMenus need order preservation

- [ ] vendor folders need versioning
- [X] vendor folders need versioning

- [X] Need to fix Pathing for autoinstall and autorun. Relative paths will not work for most use cases.

This thrust client exposes enough Methods to be fairly forwards compatible even without adding new helper methods. The beauty of working with a stable JSON RPC Protocol is that most methods are just helpers around build that data structure.

Expand Down
2 changes: 1 addition & 1 deletion connection/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var out Out
Initializes threads with Channel Structs
Opens Connection
*/
func InitializeThreads(proto, address string) error {
func InitializeThreads() error {
//c, err := net.Dial(proto, address)
//conn = c

Expand Down
12 changes: 2 additions & 10 deletions demo.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"flag"
"fmt"
"os"
"runtime"
Expand All @@ -18,20 +17,13 @@ import (
)

func main() {
addr := flag.String("socket", "/tmp/_thrust_shell.sock", "unix socket where thrust is running")
autoloaderDisabled := flag.Bool("disable-auto-loader", false, "disable auto running of thrust")

// Parses Flags
InitLogger()

if len(*addr) == 0 {
Log.Errorf("System cannot proceed without a socket to connect to. please use -socket={socket_addr}")
os.Exit(2)
}

connection.StdOut, connection.StdIn = spawn.SpawnThrustCore(*addr, *autoloaderDisabled)
connection.StdOut, connection.StdIn = spawn.SpawnThrustCore()

err := connection.InitializeThreads("unix", *addr)
err := connection.InitializeThreads()
if err != nil {
fmt.Println(err)
os.Exit(2)
Expand Down
24 changes: 17 additions & 7 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
build.release:
rm -rf release/vendor/darwin/x64/*
touch release/vendor/darwin/x64/README.md
rm -rf release/vendor/linux/x64/*
touch release/vendor/linux/x64/README.md
cp -rf tools release/
rm -f release/Thrust
go build -o release/Thrust
rm -rf release/go-thrust/vendor/darwin/x64/*
touch release/go-thrust/vendor/darwin/x64/README.md
rm -rf release/go-thrust/vendor/linux/x64/*
touch release/go-thrust/vendor/linux/x64/README.md
cp -rf tools release/go-thrust
rm -f release/go-thrust/Thrust
go build -o release/go-thrust/Thrust


dist.darwin: build.release
mkdir -p dist
cd release && zip -r ../dist/go-thrust-v0.1.0-darwin-x64.zip go-thrust/*

dist.linux: build.release
mkdir -p dist
cd release/
cd release && zip -r ../dist/go-thrust-v0.1.0-linux-x64.zip go-thrust/*
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
wget https://github.com/breach/thrust/releases/download/v$1/thrust-v$1-linux-x64.zip
mkdir -p ./vendor/linux/x64/v$1
mv thrust-v$1-linux-x64.zip ./vendor/linux/x64/v$1
cd ./vendor/linux/x64/$1
mv thrust-v$1-linux-x64.zip ./vendor/linux/x64/v$1/thrust-v$1-linux-x64.zip
cd ./vendor/linux/x64/v$1/
unzip thrust-v$1-linux-x64.zip
rm thrust-v$1-linux-x64.zip
File renamed without changes.
File renamed without changes.
File renamed without changes.
25 changes: 15 additions & 10 deletions spawn/spawn_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,33 @@ import (
"io"
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"time"

. "github.com/miketheprogrammer/go-thrust/common"
)

func SpawnThrustCore(addr string, autoloaderDisabled bool) (io.ReadCloser, io.WriteCloser) {
func SpawnThrustCore() (io.ReadCloser, io.WriteCloser) {

var thrustExecPath string
var thrustBoostrapPath string
dir, err := filepath.Abs(filepath.Dir(os.Args[0]))
if err != nil {
fmt.Println(err)
os.Exit(2)
}
if strings.Contains(runtime.GOOS, "darwin") {
thrustExecPath = "./vendor/darwin/x64/v" + THRUST_VERSION + "/ThrustShell.app/Contents/MacOS/ThrustShell"
thrustBoostrapPath = "./tools/bootstrap_darwin.sh"
thrustExecPath = dir + "/vendor/darwin/x64/v" + THRUST_VERSION + "/ThrustShell.app/Contents/MacOS/ThrustShell"
thrustBoostrapPath = dir + "/tools/bootstrap_darwin.sh"
}
if strings.Contains(runtime.GOOS, "linux") {
thrustExecPath = "./vendor/linux/x64/v" + THRUST_VERSION + "/thrust_shell"
thrustBoostrapPath = "./tools/bootstrap_linux.sh"
thrustExecPath = dir + "/vendor/linux/x64/v" + THRUST_VERSION + "/thrust_shell"
thrustBoostrapPath = dir + "/tools/bootstrap_linux.sh"
}

if len(thrustExecPath) > 0 && autoloaderDisabled == false {
if len(thrustExecPath) > 0 {
if _, err := os.Stat(thrustExecPath); os.IsNotExist(err) {
Log.Info("Could not find executable:", thrustExecPath)
Log.Info("Attempting to Download and Install the Thrust Core Executable")
Expand Down Expand Up @@ -61,8 +67,8 @@ func SpawnThrustCore(addr string, autoloaderDisabled bool) (io.ReadCloser, io.Wr
}

Log.Info("Attempting to start Thrust Core")
Log.Debug("CMD:", thrustExecPath, "-socket-path="+addr)
cmd := exec.Command(thrustExecPath, "-socket-path="+addr)
Log.Debug("CMD:", thrustExecPath)
cmd := exec.Command(thrustExecPath)
cmdIn, e1 := cmd.StdinPipe()
cmdOut, e2 := cmd.StdoutPipe()

Expand All @@ -87,8 +93,7 @@ func SpawnThrustCore(addr string, autoloaderDisabled bool) (io.ReadCloser, io.Wr
return cmdOut, cmdIn
} else {
fmt.Println("===============WARNING================")
fmt.Println("Auto Loading of thrust currently not supported for", runtime.GOOS)
fmt.Println("Please run thrust executable manually")
fmt.Println("Current operating system not supported", runtime.GOOS)
fmt.Println("===============END====================")
}
return nil, nil
Expand Down

0 comments on commit fc4c942

Please sign in to comment.