Skip to content

Commit

Permalink
perf(script): add fast mode to skip all slow actions
Browse files Browse the repository at this point in the history
  • Loading branch information
kamontat committed Jul 11, 2024
1 parent 994b2a9 commit cd8eaf0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions scripts/dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#= - deploy - deploy changes to repository
#= - wait - wait for workflows (only if enabled deploy)
#= - test - enabled test latest changes first
#= - fast - enabled fast mode to skipped all slow command

export COMPONENTS=(
'1password'
Expand Down Expand Up @@ -90,6 +91,7 @@ main() {
feat_is_prompt && features+=("prompt")
feat_is_test && features+=("test")
feat_is_wait && features+=("wait")
feat_is_fast && features+=("fast")

local suffix=""
[ "${#features[@]}" -gt 0 ] && suffix=" with features '${features[*]}'"
Expand Down
6 changes: 6 additions & 0 deletions scripts/libs/core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,14 @@ core_start() {

runner "$component" get-latest \
$ check_cmd_fail feat_is_dryrun \
$ check_cmd_fail feat_is_fast \
$ check_must_success deploy-plugin \
$ exec_with_file asdf latest "$component" \
$ verify_asdf_latest

runner "$component" list-all \
$ check_must_success get-latest deploy-plugin \
$ check_cmd_fail feat_is_fast \
$ exec_with_file asdf list all "$component" \
$ verify_asdf_list

Expand All @@ -86,22 +88,26 @@ core_start() {
runner "$component" install-latest \
$ check_must_success get-latest \
$ check_cmd_pass feat_is_test \
$ check_cmd_fail feat_is_fast \
$ exec_with_file asdf install "$component" latest \
$ verify_asdf_install "$install_path"
runner "$component" shell-latest \
$ check_must_success get-latest \
$ check_must_success install-latest \
$ check_cmd_pass feat_is_test \
$ check_cmd_fail feat_is_fast \
$ exec_with_file asdf shell "$component" "$latest"
runner "$component" "test-latest" \
$ check_must_success get-latest \
$ check_must_success install-latest \
$ check_cmd_pass feat_is_test \
$ check_cmd_fail feat_is_fast \
$ exec_with_file asdf "$component" test
runner "$component" "uninstall-latest" \
$ check_must_success get-latest \
$ check_must_success install-latest \
$ check_cmd_pass feat_is_test \
$ check_cmd_fail feat_is_fast \
$ exec_with_file asdf uninstall "$component" "$latest"

runner "$component" "git-pull" \
Expand Down
4 changes: 4 additions & 0 deletions scripts/libs/feature.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ feat_is_test() {
__feat_status test tst t
}

feat_is_fast() {
__feat_status fast fst f
}

__feat_status() {
local key enabled
for enabled in ${FEAT_ENABLED//,/ }; do
Expand Down

0 comments on commit cd8eaf0

Please sign in to comment.