Skip to content

Commit

Permalink
Refactor code base (#760)
Browse files Browse the repository at this point in the history
  • Loading branch information
denisidoro authored Jul 28, 2022
1 parent f5759f2 commit ebb02e2
Show file tree
Hide file tree
Showing 72 changed files with 1,556 additions and 1,354 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- uses: actions/checkout@v1
- name: Build
id: build
run: scripts/release ${{ matrix.target }}
run: scripts/dot rust release ${{ matrix.target }}
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
Expand Down
100 changes: 43 additions & 57 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@ on: [push]
name: CI

jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
# check:
# name: Check
# runs-on: ubuntu-latest
# steps:
# - name: Checkout sources
# uses: actions/checkout@v2

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
# - name: Install stable toolchain
# uses: actions-rs/toolchain@v1
# with:
# profile: minimal
# toolchain: stable
# override: true

- name: Run cargo check
uses: actions-rs/cargo@v1
continue-on-error: false
with:
command: check
# - name: Run cargo check
# uses: actions-rs/cargo@v1
# continue-on-error: false
# with:
# command: check

test:
name: Tests
Expand Down Expand Up @@ -64,21 +64,7 @@ jobs:
command: test

- name: Install deps
run: |
_install() {
if command -v "$1"; then
return 0;
fi
sudo apt-get install "$1" || sudo apt install "$1" || brew install "$1"
};
_install_many() {
for dep in $@; do
_install "$dep"
done
}
_install_many git bash npm tmux
run: ./scripts/dot pkg add git bash npm tmux

- name: Install fzf
run: git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf; yes | ~/.fzf/install;
Expand All @@ -89,31 +75,31 @@ jobs:
- name: Run bash tests
run: ./tests/run

# lints:
# name: Lints
# runs-on: ubuntu-latest
# steps:
# - name: Checkout sources
# uses: actions/checkout@v2
lints:
name: Lints
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

# - name: Install stable toolchain
# uses: actions-rs/toolchain@v1
# with:
# profile: minimal
# toolchain: stable
# override: true
# components: rustfmt, clippy
# - name: Install stable toolchain
# uses: actions-rs/toolchain@v1
# with:
# profile: minimal
# toolchain: stable
# override: true
# components: rustfmt, clippy

# - name: Run cargo fmt
# uses: actions-rs/cargo@v1
# continue-on-error: false
# with:
# command: fmt
# args: --all -- --check
- name: Run cargo fmt
uses: actions-rs/cargo@v1
continue-on-error: false
with:
command: fmt
args: --all -- --check

# - name: Run cargo clippy
# uses: actions-rs/cargo@v1
# continue-on-error: false
# with:
# command: clippy
# args: -- -D warnings
- name: Run cargo clippy
uses: actions-rs/cargo@v1
continue-on-error: false
with:
command: clippy
args: -- -D warnings
26 changes: 13 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "navi"
version = "2.20.1"
version = "2.21.0"
authors = ["Denis Isidoro <[email protected]>"]
edition = "2021"
description = "An interactive cheatsheet tool for the command-line"
Expand All @@ -19,8 +19,8 @@ disable-repo-management = []
travis-ci = { repository = "denisidoro/navi", branch = "master" }

[dependencies]
regex = { version = "1.5.6", default-features = false, features = ["std", "unicode-perl"] }
clap = { version = "3.2.8", features = ["derive", "cargo"] }
regex = { version = "1.6.0", default-features = false, features = ["std", "unicode-perl"] }
clap = { version = "3.2.14", features = ["derive", "cargo"] }
crossterm = "0.24.0"
lazy_static = "1.4.0"
directories-next = "2.0.0"
Expand All @@ -31,8 +31,8 @@ thiserror = "1.0.31"
strip-ansi-escapes = "0.1.1"
edit = "0.1.4"
remove_dir_all = "0.7.0"
serde = { version = "1.0.138", features = ["derive"] }
serde_yaml = "0.8.24"
serde = { version = "1.0.140", features = ["derive"] }
serde_yaml = "0.8.26"

[lib]
name = "navi"
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.56.0"
channel = "1.62.0"
components = [ "rustfmt", "clippy" ]
27 changes: 27 additions & 0 deletions scripts/dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -euo pipefail

export NAVI_HOME="$(cd "$(dirname "$0")/.." && pwd)"
export PROJ_HOME="$NAVI_HOME"
export PROJ_NAME="navi"
export CARGO_PATH="${NAVI_HOME}/core/Cargo.toml"

# TODO: bump dotfiles + remove this fn
log::note() { log::info "$@"; }
export -f log::note

dot::clone() {
git clone 'https://github.com/denisidoro/dotfiles' "$DOTFILES"
cd "$DOTFILES"
git checkout 'v2022.07.16'
}

dot::clone_if_necessary() {
[ -n "${DOTFILES:-}" ] && [ -x "${DOTFILES}/bin/dot" ] && return
export DOTFILES="${NAVI_HOME}/target/dotfiles"
dot::clone
}

dot::clone_if_necessary

"${DOTFILES}/bin/dot" "$@"
38 changes: 0 additions & 38 deletions scripts/fix

This file was deleted.

Loading

0 comments on commit ebb02e2

Please sign in to comment.