Skip to content

Commit

Permalink
Merge pull request #182 from essentialkaos/develop
Browse files Browse the repository at this point in the history
Version 3.4.2
  • Loading branch information
andyone authored Apr 1, 2024
2 parents d6e432c + 60fa142 commit b7c145b
Show file tree
Hide file tree
Showing 13 changed files with 90 additions and 361 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:

strategy:
matrix:
go: [ '1.20.x', '1.21.x' ]
go: [ '1.21.x', '1.22.x' ]

steps:
- name: Checkout
Expand Down
57 changes: 48 additions & 9 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package cli

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Copyright (c) 2024 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down Expand Up @@ -38,6 +38,9 @@ import (
"github.com/essentialkaos/ek/v12/sortutil"
"github.com/essentialkaos/ek/v12/spinner"
"github.com/essentialkaos/ek/v12/strutil"
"github.com/essentialkaos/ek/v12/support"
"github.com/essentialkaos/ek/v12/support/deps"
"github.com/essentialkaos/ek/v12/support/pkgs"
"github.com/essentialkaos/ek/v12/system"
"github.com/essentialkaos/ek/v12/terminal"
"github.com/essentialkaos/ek/v12/terminal/tty"
Expand All @@ -58,15 +61,14 @@ import (
"github.com/essentialkaos/npck/tzst"

"github.com/essentialkaos/rbinstall/index"
"github.com/essentialkaos/rbinstall/support"
)

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

// App info
const (
APP = "RBInstall"
VER = "3.4.1"
VER = "3.4.2"
DESC = "Utility for installing prebuilt Ruby versions to rbenv"
)

Expand Down Expand Up @@ -209,7 +211,16 @@ func Run(gitRev string, gomod []byte) {
genAbout(gitRev).Print(options.GetS(OPT_VER))
os.Exit(0)
case options.GetB(OPT_VERB_VER):
support.Print(APP, VER, gitRev, gomod)
support.Collect(APP, VER).
WithRevision(gitRev).
WithDeps(deps.Extract(gomod)).
WithPackages(pkgs.Collect(
"rbinstall", "rbinstall-gen", "rbinstall-clone", "rbenv",
"jemalloc", "openssl", "zlib", "gcc",
"jre8,jre11,jre17,jdk8,jdk11,jdk17,java-1.8.0-openjdk,java-11-openjdk,java-17-openjdk,java-latest-openjdk",
)).
WithChecks(checkRepositoryAvailability()).
Print()
os.Exit(0)
case options.GetB(OPT_HELP):
genUsage().Print()
Expand Down Expand Up @@ -1509,7 +1520,7 @@ func getVersionFromFile() (string, error) {
// getAdvisableRubyGemsVersion returns recommended RubyGems version for
// given version of Ruby
func getAdvisableRubyGemsVersion(rubyVersion string) string {
ver, err := version.Parse(strutil.ReadField(rubyVersion, 0, false, "-"))
ver, err := version.Parse(strutil.ReadField(rubyVersion, 0, false, '-'))

if err != nil {
return "2.3"
Expand Down Expand Up @@ -1756,7 +1767,7 @@ func isLibLoaded(glob string) bool {
}

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

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

Expand All @@ -1781,7 +1792,7 @@ func isVersionSupportedByBundler(rubyVersion string) bool {
return false
}

minor := strutil.ReadField(rubyVersion, 1, false, ".")
minor := strutil.ReadField(rubyVersion, 1, false, '.')

if strings.ContainsAny(minor, "012") {
return false
Expand All @@ -1801,8 +1812,8 @@ func parseGemInfo(data string) (string, string) {
return data, ""
}

return strutil.ReadField(data, 0, false, "="),
strutil.ReadField(data, 1, false, "=")
return strutil.ReadField(data, 0, false, '='),
strutil.ReadField(data, 1, false, '=')
}

// logFailedAction save data to temporary log file and return path
Expand Down Expand Up @@ -1855,6 +1866,34 @@ func exit(code int) {

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

// checkRepositoryAccess checks availability
func checkRepositoryAvailability() support.Check {
chk := support.Check{Status: support.CHECK_OK, Title: "EK Repository availability"}

resp, err := req.Request{
URL: "https://rbinstall.kaos.st/" + INDEX_NAME,
AutoDiscard: true,
}.Head()

if err != nil {
chk.Status, chk.Message = support.CHECK_ERROR, err.Error()
return chk
}

if resp.StatusCode != 200 {
chk.Status = support.CHECK_ERROR
chk.Message = fmt.Sprintf("Repository returned non-ok status code (%d)", resp.StatusCode)
return chk
}

chk.Message = fmt.Sprintf(
"Status: %d; Updated: %s",
resp.StatusCode, resp.Response.Header.Get("last-modified"),
)

return chk
}

// printCompletion prints completion for given shell
func printCompletion() int {
info := genUsage()
Expand Down
16 changes: 9 additions & 7 deletions clone/clone.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package clone

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Copyright (c) 2024 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand All @@ -25,6 +25,8 @@ import (
"github.com/essentialkaos/ek/v12/pluralize"
"github.com/essentialkaos/ek/v12/progress"
"github.com/essentialkaos/ek/v12/req"
"github.com/essentialkaos/ek/v12/support"
"github.com/essentialkaos/ek/v12/support/deps"
"github.com/essentialkaos/ek/v12/terminal"
"github.com/essentialkaos/ek/v12/terminal/tty"
"github.com/essentialkaos/ek/v12/timeutil"
Expand All @@ -35,15 +37,14 @@ import (
"github.com/essentialkaos/ek/v12/usage/man"

"github.com/essentialkaos/rbinstall/index"
"github.com/essentialkaos/rbinstall/support"
)

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

// App info
const (
APP = "RBInstall Clone"
VER = "3.1.3"
VER = "3.1.4"
DESC = "Utility for cloning RBInstall repository"
)

Expand Down Expand Up @@ -80,8 +81,8 @@ type FileInfo struct {
var optMap = options.Map{
OPT_YES: {Type: options.BOOL},
OPT_NO_COLOR: {Type: options.BOOL},
OPT_HELP: {Type: options.BOOL, Alias: "u:usage"},
OPT_VER: {Type: options.BOOL, Alias: "ver"},
OPT_HELP: {Type: options.BOOL},
OPT_VER: {Type: options.MIXED},

OPT_VERB_VER: {Type: options.BOOL},
OPT_COMPLETION: {},
Expand Down Expand Up @@ -113,10 +114,11 @@ func Run(gitRev string, gomod []byte) {
printMan()
os.Exit(0)
case options.GetB(OPT_VER):
genAbout(gitRev).Print()
genAbout(gitRev).Print(options.GetS(OPT_VER))
os.Exit(0)
case options.GetB(OPT_VERB_VER):
support.Print(APP, VER, gitRev, gomod)
support.Collect(APP, VER).WithRevision(gitRev).
WithDeps(deps.Extract(gomod)).Print()
os.Exit(0)
case options.GetB(OPT_HELP) || len(args) != 2:
genUsage().Print()
Expand Down
10 changes: 7 additions & 3 deletions 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.4.1
Version: 3.4.2
Release: 0%{?dist}
Group: Applications/System
License: Apache License, Version 2.0
Expand Down Expand Up @@ -38,7 +38,7 @@ Utility for installing different prebuilt versions of Ruby to rbenv.
%package gen

Summary: Utility for generating RBInstall index
Version: 3.2.3
Version: 3.2.4
Release: 0%{?dist}
Group: Development/Tools

Expand All @@ -50,7 +50,7 @@ Utility for generating RBInstall index.
%package clone

Summary: Utility for cloning RBInstall repository
Version: 3.1.3
Version: 3.1.4
Release: 0%{?dist}
Group: Development/Tools

Expand Down Expand Up @@ -118,6 +118,10 @@ rm -rf %{buildroot}
################################################################################

%changelog
* Wed Mar 20 2024 Anton Novojilov <[email protected]> - 3.4.2-0
- [cli|gen|clone] Improved support information gathering
- Dependencies update

* Wed Jan 24 2024 Anton Novojilov <[email protected]> - 3.4.1-0
- Dependencies update

Expand Down
14 changes: 8 additions & 6 deletions gen/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package gen

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Copyright (c) 2024 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand All @@ -24,6 +24,8 @@ import (
"github.com/essentialkaos/ek/v12/path"
"github.com/essentialkaos/ek/v12/sortutil"
"github.com/essentialkaos/ek/v12/strutil"
"github.com/essentialkaos/ek/v12/support"
"github.com/essentialkaos/ek/v12/support/deps"
"github.com/essentialkaos/ek/v12/terminal/tty"
"github.com/essentialkaos/ek/v12/timeutil"
"github.com/essentialkaos/ek/v12/usage"
Expand All @@ -33,15 +35,14 @@ import (
"github.com/essentialkaos/ek/v12/usage/man"

"github.com/essentialkaos/rbinstall/index"
"github.com/essentialkaos/rbinstall/support"
)

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

// App info
const (
APP = "RBInstall Gen"
VER = "3.2.3"
VER = "3.2.4"
DESC = "Utility for generating RBInstall index"
)

Expand Down Expand Up @@ -95,7 +96,7 @@ var optMap = options.Map{
OPT_ALIAS: {Value: "alias.json"},
OPT_NO_COLOR: {Type: options.BOOL},
OPT_HELP: {Type: options.BOOL},
OPT_VER: {Type: options.BOOL},
OPT_VER: {Type: options.MIXED},

OPT_VERB_VER: {Type: options.BOOL},
OPT_COMPLETION: {},
Expand Down Expand Up @@ -129,10 +130,11 @@ func Run(gitRev string, gomod []byte) {
printMan()
os.Exit(0)
case options.GetB(OPT_VER):
genAbout(gitRev).Print()
genAbout(gitRev).Print(options.GetS(OPT_VER))
os.Exit(0)
case options.GetB(OPT_VERB_VER):
support.Print(APP, VER, gitRev, gomod)
support.Collect(APP, VER).WithRevision(gitRev).
WithDeps(deps.Extract(gomod)).Print()
os.Exit(0)
case options.GetB(OPT_HELP) || len(args) == 0:
genUsage().Print()
Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ module github.com/essentialkaos/rbinstall
go 1.18

require (
github.com/essentialkaos/depsy v1.1.0
github.com/essentialkaos/ek/v12 v12.98.0
github.com/essentialkaos/ek/v12 v12.113.1
github.com/essentialkaos/npck v1.6.2
)

require (
github.com/essentialkaos/depsy v1.1.0 // indirect
github.com/essentialkaos/go-linenoise/v3 v3.4.0 // indirect
github.com/klauspost/compress v1.17.4 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/sys v0.16.0 // indirect
github.com/klauspost/compress v1.17.7 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/sys v0.18.0 // indirect
)
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
github.com/essentialkaos/check v1.4.0 h1:kWdFxu9odCxUqo1NNFNJmguGrDHgwi3A8daXX1nkuKk=
github.com/essentialkaos/depsy v1.1.0 h1:U6dp687UkQwXlZU17Hg2KMxbp3nfZAoZ8duaeUFYvJI=
github.com/essentialkaos/depsy v1.1.0/go.mod h1:kpiTAV17dyByVnrbNaMcZt2jRwvuXClUYOzpyJQwtG8=
github.com/essentialkaos/ek/v12 v12.98.0 h1:DSoP84rmUpNFjfuk8HSL04lkNLC8EzBo38IYoZ0O1qc=
github.com/essentialkaos/ek/v12 v12.98.0/go.mod h1:peB5w8zUkRuDs7m/QG5Z2gMmqzSIs2viAmxzzNFIIoo=
github.com/essentialkaos/ek/v12 v12.113.1 h1:3opV9dwRpIQq1fqg5mkaSEt6ogECL4VLzrH/829qeYg=
github.com/essentialkaos/ek/v12 v12.113.1/go.mod h1:SslW97Se34YQKc08Ume2V/8h/HPTgLS1+Iok64cNF/U=
github.com/essentialkaos/go-linenoise/v3 v3.4.0 h1:g72w8x+/HIwOMBVvNaPYp+wMWVHrYZwzFAF7OfZR5Ts=
github.com/essentialkaos/go-linenoise/v3 v3.4.0/go.mod h1:t1kNLY2bSMQCy1JXOefD2BDLs/TTPMtTv3DFNV5uDSI=
github.com/essentialkaos/npck v1.6.2 h1:OqV74UfA9qoRYbFVsZ+KYH9kY//1nU6uX/HBfAltUQ4=
github.com/essentialkaos/npck v1.6.2/go.mod h1:7ziKy4mdUrSMTihDTZKAaxf6uDH2uAlOzsD3Mj2WTyI=
github.com/klauspost/compress v1.17.4 h1:Ej5ixsIri7BrIjBkRZLTo6ghwrEtHFk7ijlczPW4fZ4=
github.com/klauspost/compress v1.17.4/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM=
github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg=
github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc=
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
2 changes: 1 addition & 1 deletion index/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package index

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Copyright (c) 2024 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down
2 changes: 1 addition & 1 deletion rbinstall-clone.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package main

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Copyright (c) 2024 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down
2 changes: 1 addition & 1 deletion rbinstall-gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package main

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Copyright (c) 2024 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down
2 changes: 1 addition & 1 deletion rbinstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package main

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Copyright (c) 2024 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down
Loading

0 comments on commit b7c145b

Please sign in to comment.