Skip to content

Commit

Permalink
Merge pull request #82 from essentialkaos/develop
Browse files Browse the repository at this point in the history
Version 0.21.2
  • Loading branch information
andyone authored Mar 22, 2019
2 parents 98abe23 + 449fc93 commit 3149a7c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
32 changes: 30 additions & 2 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"net/url"
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"time"
Expand Down Expand Up @@ -54,7 +55,7 @@ import (
// App info
const (
APP = "RBInstall"
VER = "0.21.1"
VER = "0.21.2"
DESC = "Utility for installing prebuilt Ruby versions to rbenv"
)

Expand Down Expand Up @@ -1558,7 +1559,7 @@ func checkDependencies(info *index.VersionInfo, category string) {
}

if strings.HasSuffix(info.Name, "jemalloc") {
if !fsutil.IsExist("/lib64/libjemalloc.so.2") && !fsutil.IsExist("/lib/libjemalloc.so.2") {
if !isLibLoaded("libjemalloc.so.2") {
printErrorAndExit("Jemalloc 5+ is required for this version of Ruby")
}
}
Expand Down Expand Up @@ -1616,6 +1617,33 @@ func getSystemInfo() (string, string, error) {
return os, arch, nil
}

// isLibLoaded return true if given library is loaded
func isLibLoaded(glob string) bool {
cmd := exec.Command("ldconfig", "-p")
output, err := cmd.Output()

if err != nil {
printErrorAndExit(err.Error())
}

for _, line := range strings.Split(string(output), "\n") {
if !strings.Contains(line, "=>") {
continue
}

line = strings.TrimSpace(line)
line = strutil.ReadField(line, 0, false, " ")

match, _ := filepath.Match(glob, line)

if match {
return true
}
}

return false
}

// getNameWithoutPatchLevel return name without -p0
func getNameWithoutPatchLevel(name string) string {
return strings.Replace(name, "-p0", "", -1)
Expand Down
5 changes: 4 additions & 1 deletion common/rbinstall.spec
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

Summary: Utility for installing prebuilt Ruby to rbenv
Name: rbinstall
Version: 0.21.1
Version: 0.21.2
Release: 0%{?dist}
Group: Applications/System
License: EKOL
Expand Down Expand Up @@ -143,6 +143,9 @@ rm -rf %{buildroot}
################################################################################

%changelog
* Fri Mar 22 2019 Anton Novojilov <[email protected]> - 0.21.2-0
- [cli] Improved jemalloc availability check

* Tue Mar 19 2019 Anton Novojilov <[email protected]> - 0.21.1-0
- [cli] Fixed bug with railsexpress availability info in versions listing

Expand Down

0 comments on commit 3149a7c

Please sign in to comment.