diff --git a/.codeclimate.yml b/.codeclimate.yml new file mode 100644 index 0000000..16f4324 --- /dev/null +++ b/.codeclimate.yml @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad303fb..22e6a5c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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: @@ -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 diff --git a/.typos.toml b/.typos.toml new file mode 100644 index 0000000..55aead8 --- /dev/null +++ b/.typos.toml @@ -0,0 +1,2 @@ +[files] +extend-exclude = ["go.sum"] diff --git a/Makefile b/Makefile index 90acf98..d1cb749 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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' ################################################################################ diff --git a/README.md b/README.md index 5334c2a..fefc37a 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,10 @@
diff --git a/cli/cli.go b/cli/cli.go index 45bb25e..7c28312 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -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" ) @@ -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: {}, @@ -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) @@ -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) @@ -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 diff --git a/clone/clone.go b/clone/clone.go index 6ea3e7a..ef9f7a3 100644 --- a/clone/clone.go +++ b/clone/clone.go @@ -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) } } diff --git a/common/rbinstall.knf b/common/rbinstall.knf index 176bad5..54deb04 100644 --- a/common/rbinstall.knf +++ b/common/rbinstall.knf @@ -2,7 +2,7 @@ [main] - # Path to writable temorary directory + # Path to writable temporary directory tmp-dir: /tmp [storage] diff --git a/common/rbinstall.spec b/common/rbinstall.spec index ea6e3dc..9aaf7a4 100644 --- a/common/rbinstall.spec +++ b/common/rbinstall.spec @@ -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 @@ -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} @@ -118,6 +118,10 @@ rm -rf %{buildroot} ################################################################################ %changelog +* Fri May 05 2023 Anton Novojilov