Skip to content

Commit

Permalink
Merge pull request #124 from essentialkaos/develop
Browse files Browse the repository at this point in the history
Version 3.0.2
  • Loading branch information
andyone authored May 11, 2023
2 parents 861d283 + 5c51f11 commit e4f6534
Show file tree
Hide file tree
Showing 12 changed files with 101 additions and 46 deletions.
39 changes: 39 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
version: "2"

checks:
argument-count:
enabled: true
config:
threshold: 6
complex-logic:
enabled: true
config:
threshold: 6
file-lines:
enabled: true
config:
threshold: 1000
method-complexity:
enabled: true
config:
threshold: 8
method-count:
enabled: true
config:
threshold: 20
method-lines:
enabled: true
config:
threshold: 100
nested-control-flow:
enabled: true
config:
threshold: 6
return-statements:
enabled: true
config:
threshold: 6
similar-code:
enabled: false
identical-code:
enabled: false
26 changes: 16 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
SRC_DIR: src/github.com/${{ github.repository }}

jobs:
Go:
name: Go
Expand All @@ -37,22 +34,18 @@ jobs:
go: [ '1.19.x', '1.20.x' ]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}

- name: Checkout
uses: actions/checkout@v3
with:
path: ${{env.SRC_DIR}}

- name: Download dependencies
working-directory: ${{env.SRC_DIR}}
run: make deps

- name: Build binary
working-directory: ${{env.SRC_DIR}}
run: make all

Perfecto:
Expand Down Expand Up @@ -91,3 +84,16 @@ jobs:
uses: essentialkaos/hadolint-action@v1
with:
files: .docker/ruby.docker .docker/ruby-jemalloc.docker .docker/ruby-railsexpress.docker .docker/jruby.docker

Typos:
name: Typos
runs-on: ubuntu-latest

needs: Go

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Check spelling
uses: crate-ci/typos@master
2 changes: 2 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[files]
extend-exclude = ["go.sum"]
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
################################################################################

# This Makefile generated by GoMakeGen 2.1.0 using next command:
# This Makefile generated by GoMakeGen 2.2.0 using next command:
# gomakegen --mod .
#
# More info: https://kaos.sh/gomakegen
Expand Down Expand Up @@ -106,6 +106,6 @@ help: ## Show this info
| sed 's/ifdef //' \
| awk 'BEGIN {FS = " .*?## "}; {printf " \033[32m%-14s\033[0m %s\n", $$1, $$2}'
@echo -e ''
@echo -e '\033[90mGenerated by GoMakeGen 2.1.0\033[0m\n'
@echo -e '\033[90mGenerated by GoMakeGen 2.2.0\033[0m\n'

################################################################################
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<p align="center"><a href="#readme"><img src="https://gh.kaos.st/rbinstall.svg"/></a></p>

<p align="center">
<a href="https://kaos.sh/w/rbinstall/ci"><img src="https://kaos.sh/w/rbinstall/ci.svg" alt="GitHub Actions CI Status" /></a>
<a href="https://kaos.sh/r/rbinstall"><img src="https://kaos.sh/r/rbinstall.svg" alt="GoReportCard" /></a>
<a href="https://kaos.sh/l/rbinstall"><img src="https://kaos.sh/l/5680ef76d53ea9526739.svg" alt="Code Climate Maintainability" /></a>
<a href="https://kaos.sh/b/rbinstall"><img src="https://kaos.sh/b/b78de32a-6867-4bd3-9135-8244d4813531.svg" alt="codebeat badge" /></a>
<a href="https://kaos.sh/w/rbinstall/ci"><img src="https://kaos.sh/w/rbinstall/ci.svg" alt="GitHub Actions CI Status" /></a>
<a href="https://kaos.sh/w/rbinstall/codeql"><img src="https://kaos.sh/w/rbinstall/codeql.svg" alt="GitHub Actions CodeQL Status" /></a>
<a href="#license"><img src="https://gh.kaos.st/apache2.svg"></a>
</p>
Expand Down
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.1"
VER = "3.0.2"
DESC = "Utility for installing prebuilt Ruby versions to RBEnv"
)

Expand Down Expand Up @@ -151,8 +151,8 @@ var optMap = options.Map{
OPT_INFO: {Type: options.BOOL},
OPT_NO_COLOR: {Type: options.BOOL},
OPT_NO_PROGRESS: {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 @@ -206,7 +206,7 @@ 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)
Expand Down Expand Up @@ -394,7 +394,10 @@ func validateConfig() {

// fetchIndex download index from remote repository
func fetchIndex() {
resp, err := req.Request{URL: knf.GetS(STORAGE_URL) + "/" + INDEX_NAME}.Get()
resp, err := req.Request{
URL: knf.GetS(STORAGE_URL) + "/" + INDEX_NAME,
Query: req.Query{"r": time.Now().UnixMicro()},
}.Get()

if err != nil {
printErrorAndExit("Can't fetch repository index: %v", err)
Expand Down Expand Up @@ -1139,7 +1142,10 @@ func downloadFile(info *index.VersionInfo) (string, error) {

defer fd.Close()

resp, err := req.Request{URL: knf.GetS(STORAGE_URL) + "/" + info.Path + "/" + info.File}.Do()
resp, err := req.Request{
URL: knf.GetS(STORAGE_URL) + "/" + info.Path + "/" + info.File,
Query: req.Query{"hash": info.Hash},
}.Get()

if err != nil {
return "", err
Expand Down
2 changes: 1 addition & 1 deletion clone/clone.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func checkArguments(url, dir string) {
}

if !fsutil.IsExecutable(dir) {
printErrorAndExit("Directory %s is not exectable", dir)
printErrorAndExit("Directory %s is not executable", dir)
}
}

Expand Down
2 changes: 1 addition & 1 deletion common/rbinstall.knf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[main]

# Path to writable temorary directory
# Path to writable temporary directory
tmp-dir: /tmp

[storage]
Expand Down
8 changes: 6 additions & 2 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.0.1
Version: 3.0.2
Release: 0%{?dist}
Group: Applications/System
License: Apache License, Version 2.0
Expand All @@ -24,7 +24,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

Requires: rbenv libyaml ca-certificates zlib >= 1.2.11

BuildRequires: golang >= 1.19
BuildRequires: golang >= 1.20

Provides: %{name} = %{version}-%{release}

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

%changelog
* Fri May 05 2023 Anton Novojilov <[email protected]> - 3.0.2-0
- [cli] Better caching handling
- Dependencies update

* Mon Mar 27 2023 Anton Novojilov <[email protected]> - 3.0.1-0
- [cli|gen|clone] Added verbose version output
- Dependencies update
Expand Down
2 changes: 1 addition & 1 deletion gen/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func checkDir(dataDir string) {
}

if !fsutil.IsExecutable(dataDir) {
printErrorAndExit("Directory %s is not exectable", dataDir)
printErrorAndExit("Directory %s is not executable", dataDir)
}

if options.GetS(OPT_OUTPUT) == "" && !fsutil.IsWritable(dataDir) {
Expand Down
13 changes: 6 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ module github.com/essentialkaos/rbinstall
go 1.18

require (
github.com/essentialkaos/depsy v1.0.0
github.com/essentialkaos/ek/v12 v12.63.0
github.com/essentialkaos/npck v1.2.1
github.com/essentialkaos/depsy v1.1.0
github.com/essentialkaos/ek/v12 v12.67.0
github.com/essentialkaos/npck v1.5.0
)

require (
github.com/cyphar/filepath-securejoin v0.2.3 // indirect
github.com/essentialkaos/go-linenoise/v3 v3.4.0 // indirect
github.com/klauspost/compress v1.16.3 // indirect
golang.org/x/crypto v0.7.0 // indirect
golang.org/x/sys v0.6.0 // indirect
github.com/klauspost/compress v1.16.5 // indirect
golang.org/x/crypto v0.9.0 // indirect
golang.org/x/sys v0.8.0 // indirect
)
28 changes: 13 additions & 15 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
github.com/cyphar/filepath-securejoin v0.2.3 h1:YX6ebbZCZP7VkM3scTTokDgBL2TY741X51MTk3ycuNI=
github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
github.com/essentialkaos/check v1.4.0 h1:kWdFxu9odCxUqo1NNFNJmguGrDHgwi3A8daXX1nkuKk=
github.com/essentialkaos/depsy v1.0.0 h1:FikBtTnNhk+xFO/hFr+CfiKs6QnA3wMD6tGL0XTEUkc=
github.com/essentialkaos/depsy v1.0.0/go.mod h1:XVsB2eVUonEzmLKQP3ig2P6v2+WcHVgJ10zm0JLqFMM=
github.com/essentialkaos/ek/v12 v12.63.0 h1:9yaEu5W3bx//9y52ShqYCoFDKOcwEdrnvgSkUYyatgI=
github.com/essentialkaos/ek/v12 v12.63.0/go.mod h1:9MlSuHpewu7OZ9tM9dLFHvoA8dflBIUPCA0Ctt97wRs=
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.67.0 h1:ii15t0O+3Mu7uI3Te5X5BIqYXi1V7ovtSIYi5LyiltU=
github.com/essentialkaos/ek/v12 v12.67.0/go.mod h1:sRgw+F7PeeoNsmLLVMKy5ccugwGSljk8/rTXC9dyT+M=
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.2.1 h1:OXLlRR39sk+3sKOJN5WzXlux295yI46YI/62+j3ytIw=
github.com/essentialkaos/npck v1.2.1/go.mod h1:UeYjyKd/FNcU767VgLYuGkfCu68VW9ZMynukScJOTc0=
github.com/klauspost/compress v1.16.3 h1:XuJt9zzcnaz6a16/OU53ZjWp/v7/42WcR5t2a0PcNQY=
github.com/klauspost/compress v1.16.3/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
github.com/essentialkaos/npck v1.5.0 h1:YkvHywXX1g7mUhGyN97ZAsg4l3kSwGhhFmQBa+e7upA=
github.com/essentialkaos/npck v1.5.0/go.mod h1:hbphr/PCfljbolELHLmRXxNX1nV78JIUMteUP9gg2l4=
github.com/klauspost/compress v1.16.5 h1:IFV2oUNUzZaz+XyusxpLzpzS8Pt5rh0Z16For/djlyI=
github.com/klauspost/compress v1.16.5/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
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.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A=
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g=
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

0 comments on commit e4f6534

Please sign in to comment.