Skip to content

Commit

Permalink
Merge pull request #127 from essentialkaos/develop
Browse files Browse the repository at this point in the history
Version 3.0.4
  • Loading branch information
andyone authored May 23, 2023
2 parents e3aa381 + 9fae6bb commit 0d384e4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
18 changes: 12 additions & 6 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ import (
// App info
const (
APP = "RBInstall"
VER = "3.0.3"
VER = "3.0.4"
DESC = "Utility for installing prebuilt Ruby versions to RBEnv"
)

Expand Down Expand Up @@ -182,6 +182,7 @@ var colorTagApp string
var colorTagVer string

var useRawOutput = false
var noProgress = false

// ////////////////////////////////////////////////////////////////////////////////// //

Expand Down Expand Up @@ -279,6 +280,11 @@ func configureUI() {
progress.DefaultSettings.ProgressColorTag = "{s}"
progress.DefaultSettings.SpeedColorTag = "{s}"
progress.DefaultSettings.RemainingColorTag = "{s}"

if os.Getenv("CI") != "" || options.GetB(OPT_NO_PROGRESS) {
spinner.DisableAnimation = true
noProgress = true
}
}

// prepare do some preparations for installing ruby
Expand Down Expand Up @@ -671,7 +677,7 @@ func installCommand(rubyVersion string) {
spinner.SpinnerColorTag = "{" + categoryColor[category] + "}"
fmtc.NameColor("category", "{"+categoryColor[category]+"}")

if !options.GetB(OPT_NO_PROGRESS) {
if !noProgress {
fmtc.Printf("Fetching {*}{?category}%s{!} from storage…\n", info.Name)
file, err = downloadFile(info)
} else {
Expand All @@ -697,7 +703,7 @@ func installCommand(rubyVersion string) {

// //////////////////////////////////////////////////////////////////////////////// //

if !options.GetB(OPT_NO_PROGRESS) {
if !noProgress {
fmtc.Printf("Unpacking {*}{?category}%s{!} data…\n", info.Name)
err = unpackFile(file, getUnpackDirPath())
} else {
Expand Down Expand Up @@ -1161,7 +1167,7 @@ func downloadFile(info *index.VersionInfo) (string, error) {
return "", fmtc.Errorf("Server return error code %d", resp.StatusCode)
}

if options.GetB(OPT_NO_PROGRESS) {
if noProgress {
_, err = io.Copy(fd, resp.Body)
} else {
pb := progress.New(resp.ContentLength, "")
Expand All @@ -1183,7 +1189,7 @@ func unpackFile(file, outputDir string) error {
return fmt.Errorf("Can't unpack %s: %w", file, err)
}

if options.GetB(OPT_NO_PROGRESS) {
if noProgress {
err = tzst.Read(bufio.NewReader(fd), outputDir)
} else {
pb := progress.New(fsutil.GetSize(file), "")
Expand Down Expand Up @@ -1595,7 +1601,7 @@ func getSystemInfo() (string, string, error) {
}

if strings.Contains(osInfo.IDLike, "rhel") {
os = fmt.Sprintf("rhel-%d", osVersion.Major())
os = fmt.Sprintf("el-%d", osVersion.Major())
} else {
os = fmt.Sprintf("%s-%d", osInfo.ID, osVersion.Major())
}
Expand Down
9 changes: 6 additions & 3 deletions common/alias.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"ol-7": "rhel-7",
"ol-8": "rhel-8",
"ol-9": "rhel-9"
"ol-7": "el-7",
"ol-8": "el-8",
"ol-9": "el-9",
"rhel-7": "el-7",
"rhel-8": "el-8",
"rhel-9": "el-9"
}
6 changes: 5 additions & 1 deletion common/rbinstall.spec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

Summary: Utility for installing prebuilt Ruby to rbenv
Name: rbinstall
Version: 3.0.3
Version: 3.0.4
Release: 0%{?dist}
Group: Applications/System
License: Apache License, Version 2.0
Expand Down Expand Up @@ -118,6 +118,10 @@ rm -rf %{buildroot}
################################################################################

%changelog
* Tue May 23 2023 Anton Novojilov <[email protected]> - 3.0.4-0
- Fixed bug with disabling spinner animation
- Minor code refactoring

* Thu May 18 2023 Anton Novojilov <[email protected]> - 3.0.3-0
- [cli] Don't install documentation while updating RubyGems gem
- Disable using EK rubygems proxy by default
Expand Down

0 comments on commit 0d384e4

Please sign in to comment.