/ Barf
Barf
1 #!/usr/bin/env bar 2 # -*- mode: sh; sh-shell: bash -*- 3 # vim: set ft=bash: 4 # shellcheck shell=bash 5 # shellcheck disable=SC2016 6 7 # This is the barfile for maintaining 'bar' itself. A more generalized and customizeable barfile 8 # that become installed with 'bar init_local' is the Barf.default file in this directory. 9 10 #shellcheck disable=2034 11 SHELLCHECK_LS_FILES=":!tests" 12 13 14 # We lint and build the doc here 15 rule doc lints 16 17 require git 18 19 function nodbg 20 { 21 # shellcheck disable=2046 22 if grep -n '^[[:space:]]*DBG' $(git_ls_files -c --other -- ':!README' ); then 23 return 1 24 fi 25 } 26 27 rule lints: 'is_testdir_used?' nodbg 28 29 # manually testing the staged changes 30 rule test_staged: testdir_enter lints 31 32 # maintenance rules 33 rule build_docs: -- './bar help >README' 34 35 # called by another name (githook) 36 rule pre-commit: MAIN 37 38 # TODO: test Barf.default 39 40 ## Run all tests in tests/ directory 41 rule tests: test_cache 42 rule tests: test_cargo_completers 43 rule tests: test_cargo_variable_expansion 44 rule tests: test_completion 45 rule tests: test_ext_completers 46 rule tests: test_extcomp 47 rule tests: test_function_completion 48 rule tests: test_integration 49 rule tests: test_is_cargo_tool_completion 50 rule tests: test_issue_fixes 51 rule tests: test_memodb_analyze 52 rule tests: test_prototype_parsing 53 rule tests: test_prototype_scoping 54 rule tests: test_public_mode 55 rule tests: test_user_requirements 56 57 # Individual test rules 58 rule test_cache: -- tests/test_cache.sh 59 rule test_cargo_completers: -- tests/test_cargo_completers.sh 60 rule test_cargo_variable_expansion: -- tests/test_cargo_variable_expansion.sh 61 rule test_completion: -- tests/test_completion.sh 62 rule test_ext_completers: -- tests/test_ext_completers.sh 63 rule test_extcomp: -- tests/test_extcomp.sh 64 rule test_function_completion: -- tests/test_function_completion.sh 65 rule test_integration: -- tests/test_integration.sh 66 rule test_is_cargo_tool_completion: -- tests/test_is_cargo_tool_completion.sh 67 rule test_issue_fixes: -- tests/test_issue_fixes.sh 68 rule test_memodb_analyze: -- tests/test_memodb_analyze.sh 69 rule test_prototype_parsing: -- tests/test_prototype_parsing.sh 70 rule test_prototype_scoping: -- tests/test_prototype_scoping.sh 71 rule test_public_mode: -- tests/test_public_mode.sh 72 rule test_user_requirements: -- tests/test_user_requirements.sh 73 74 rule SETUP: 'called_as? pre-commit' testdir_enter 75 rule SETUP: 'called_as? pre-merge-commit' testdir_enter 76 rule SETUP: 'called_as? prepare-commit-msg' testdir_enter 77 rule SETUP: 'called_as? commit-msg' testdir_enter 78 79 rule activate: \ 80 'githook_enable~ pre-commit'\ 81 'githook_enable~ pre-merge-commit'\ 82 'githook_enable~ prepare-commit-msg'\ 83 'githook_enable~ commit-msg' 84 85 #rule watch: --conclusive is_entr_installed? -- 'rule_eval entr_watch "${RULE_ARGS[@]}"' 86 87 # enter a recursive shell for debugging 88 rule dbgsh: -- ' 89 echo "Entering bar shell, try <help>." 90 bash --rcfile <( 91 declare -f 92 typeset -p | grep -Ev "^declare -[a-zA-Z]*r" 93 echo " 94 PS1=\"(bar) \w \$ \" 95 enable -n help 96 require help 97 " 98 ) 99 '