diff --git a/cmd/linux.go b/cmd/linux.go index b812d3fb6..2f033f41a 100644 --- a/cmd/linux.go +++ b/cmd/linux.go @@ -11,6 +11,7 @@ type LinuxDistribution int const ( // Unknown is the catch-all distro Unknown LinuxDistribution = 0 + // Ubuntu distribution Ubuntu LinuxDistribution = 1 ) @@ -31,7 +32,7 @@ func GetLinuxDistroInfo() *DistroInfo { lsbRelease := program.FindProgram("lsb_release") if lsbRelease != nil { - stdout, _, err, _ := lsbRelease.Run("-a") + stdout, _, _, err := lsbRelease.Run("-a") if err != nil { return result } @@ -72,7 +73,7 @@ func DpkgInstalled(packageName string) (bool, error) { if dpkg == nil { return false, fmt.Errorf("cannot check dependencies: dpkg not found") } - _, _, _, exitCode := dpkg.Run("-L", packageName) + _, _, exitCode, _ := dpkg.Run("-L", packageName) result = exitCode == 0 return result, nil } diff --git a/cmd/prerequisites.go b/cmd/prerequisites.go index 9b78bc8b2..108d39985 100644 --- a/cmd/prerequisites.go +++ b/cmd/prerequisites.go @@ -62,6 +62,8 @@ func getRequiredProgramsLinux() *Prerequisites { // TODO: Test this on Windows func getRequiredProgramsWindows() *Prerequisites { result := &Prerequisites{} + result.Add(newPrerequisite("gcc", "Please install gcc from here and try again: http://tdm-gcc.tdragon.net/download. You will need to add the bin directory to your path, EG: C:\\TDM-GCC-64\\bin\\")) + result.Add(newPrerequisite("npm", "Please install node/npm from here and try again: https://nodejs.org/en/download/")) return result } diff --git a/cmd/program.go b/cmd/program.go index c579c0e2c..c92d6b382 100644 --- a/cmd/program.go +++ b/cmd/program.go @@ -44,16 +44,17 @@ func (p *ProgramHelper) FindProgram(programName string) *Program { } } +// GetFullPathToBinary returns the full path the the current binary func (p *Program) GetFullPathToBinary() (string, error) { return filepath.Abs(p.Path) } // Run will execute the program with the given parameters // Returns stdout + stderr as strings and an error if one occured -func (p *Program) Run(vars ...string) (stdout, stderr string, err error, exitCode int) { +func (p *Program) Run(vars ...string) (stdout, stderr string, exitCode int, err error) { command, err := p.GetFullPathToBinary() if err != nil { - return "", "", err, 1 + return "", "", 1, err } cmd := exec.Command(command, vars...) var stdo, stde bytes.Buffer diff --git a/go.mod b/go.mod index 088821717..d171210a6 100644 --- a/go.mod +++ b/go.mod @@ -4,8 +4,9 @@ require ( github.com/AlecAivazis/survey v1.7.1 github.com/fatih/color v1.7.0 github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect - github.com/leaanthony/spinner v0.5.0 + github.com/leaanthony/spinner v0.4.0 github.com/leaanthony/synx v0.0.0-20180923230033-60efbd9984b0 // indirect + github.com/leaanthony/wincursor v0.0.0-20180705115120-056510f32d15 // indirect github.com/mattn/go-colorable v0.0.9 // indirect github.com/mattn/go-isatty v0.0.4 // indirect github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect diff --git a/go.sum b/go.sum index f2b808ff3..1df5885c4 100644 --- a/go.sum +++ b/go.sum @@ -4,10 +4,14 @@ github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= +github.com/leaanthony/spinner v0.4.0 h1:y/7FqQqqObRKYI+33bg9DGhHIY7cQHicm+Vz0Uda0Ik= +github.com/leaanthony/spinner v0.4.0/go.mod h1:2Mmv+8Brcw3NwPT1DdOLmW6+zWpSamDDFFsUvVHo2cc= github.com/leaanthony/spinner v0.5.0 h1:OJKn+0KP6ilHxwCEOv5Lo0wPM4PgWZWLJTeUprGJK0g= github.com/leaanthony/spinner v0.5.0/go.mod h1:2Mmv+8Brcw3NwPT1DdOLmW6+zWpSamDDFFsUvVHo2cc= github.com/leaanthony/synx v0.0.0-20180923230033-60efbd9984b0 h1:1bGojw4YacLY5bqQalojiQ7mSfQbe4WIWCEgPZagowU= github.com/leaanthony/synx v0.0.0-20180923230033-60efbd9984b0/go.mod h1:Iz7eybeeG8bdq640iR+CwYb8p+9EOsgMWghkSRyZcqs= +github.com/leaanthony/wincursor v0.0.0-20180705115120-056510f32d15 h1:166LIty6ldcyOc7tbgfu5smsGATvEo0JZV6bnbzyEc4= +github.com/leaanthony/wincursor v0.0.0-20180705115120-056510f32d15/go.mod h1:7TVwwrzSH/2Y9gLOGH+VhA+bZhoWXBRgbGNTMk+yimE= github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs=