Skip to content

Commit 538d4be

Browse files
committed
Create project skeleton
0 parents  commit 538d4be

16 files changed

+134
-0
lines changed

.dkrc

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
# ---
3+
# Add your own commands, functions, and variables here. Define defaults first,
4+
# then `dk use:` the desired devkit modules, and then define any overrides to
5+
# the devkit defaults.
6+
# ---
7+
8+
# Available modules (uncomment to use):
9+
10+
# -- Shell/Generic Modules --
11+
dk use: bash-kit # enable `with-bash` command to use different bash versions
12+
dk use: cram # run tests using the "cram" functional test tool
13+
dk use: shell-console # make the "console" command enter a subshell
14+
15+
# -- Watch Modules --
16+
dk use: modd-watch # watch multiple patterns and run different commands on them
17+
18+
# -- Language-Specific Modules --
19+
dk use: shellcheck # support running shellcheck (via docker if not installed)
20+
21+
# Define overrides, new commands, functions, etc. here:

.editorconfig

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[*]
2+
indent_style = tab
3+
indent_size = 4
4+
tab_width = 4
5+

.envrc

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/usr/bin/env bash
2+
3+
# basher installation scheme for dependencies; you can change this if you want,
4+
# so long as all the variables are correct. The .devkit/dk script will clone
5+
# basher to $BASHER_ROOT and look for binaries in $BASHER_INSTALL_BIN.
6+
7+
export BASHER_PREFIX="$PWD/.deps"
8+
export BASHER_INSTALL_BIN="$BASHER_PREFIX/bin"
9+
export BASHER_INSTALL_MAN="$BASHER_PREFIX/man"
10+
11+
# Dependencies are checked out here:
12+
export BASHER_PACKAGES_PATH="$BASHER_PREFIX"
13+
export BASHER_ROOT="$BASHER_PACKAGES_PATH/basherpm/basher"
14+
15+
# Build go-based deps in .deps
16+
export GOPATH="$BASHER_PREFIX/go"
17+
export GOBIN="$BASHER_INSTALL_BIN"
18+
19+
# Stub in case direnv isn't being used
20+
declare -F -- watch_file >/dev/null || watch_file() { :;}
21+
22+
# If these files change, so might our paths, so direnv should reload
23+
watch_file \
24+
"$BASHER_PREFIX/.gimme-env" \
25+
"$BASHER_INSTALL_BIN/activate" \
26+
"$BASHER_INSTALL_BIN/python" \
27+
"$PWD/composer.json" \
28+
"$PWD/package.json" \
29+
"$PWD/.nvmrc"
30+
31+
# Activate nvm if Node project w/.nvmrc (but don't install node)
32+
if [[ -f .nvmrc ]]; then
33+
if ! declare -F -- nvm >/dev/null; then
34+
# No user-level nvm? Install as a project dependency
35+
[[ "${NVM_DIR-}" ]] || export NVM_DIR="$BASHER_PREFIX/nvm-sh/nvm"
36+
[[ -d "${NVM_DIR}" ]] || git clone -q --depth=1 https://github.com/nvm-sh/nvm.git "$NVM_DIR"
37+
source "$NVM_DIR/nvm.sh" --no-use
38+
fi
39+
nvm use || true # Allow failures to proceed anyway
40+
fi
41+
42+
# Activate gimme/go enviornment if Go project
43+
[[ ! -f "$BASHER_PREFIX/.gimme-env" ]] || source "$BASHER_PREFIX/.gimme-env"
44+
45+
# Activate virtualenv if present
46+
[[ -f $BASHER_INSTALL_BIN/activate && -f $BASHER_INSTALL_BIN/python ]] &&
47+
[[ ! "${VIRTUAL_ENV-}" || $VIRTUAL_ENV != "$BASHER_PREFIX" ]] &&
48+
VIRTUAL_ENV_DISABLE_PROMPT=true source $BASHER_INSTALL_BIN/activate
49+
50+
__dk_path() { [[ :"${!1}": == *:"$2":* ]] || export $1="$2:${!1}"; }
51+
52+
# Activate .composer/vendor/bin if PHP project
53+
[[ ! -f composer.json ]] || __dk_path PATH "$PWD/vendor/bin"
54+
55+
# Activate node_modules/.bin if Node project
56+
[[ ! -f package.json ]] || __dk_path PATH "$PWD/node_modules/.bin"
57+
58+
# $BASHER_INSTALL_BIN must be on PATH to use commands installed as deps
59+
__dk_path PATH "$BASHER_INSTALL_BIN"
60+
61+
# You can add other variables you want available via direnv. Configuration
62+
# variables for devkit itself, however, should go in .dkrc unless they need
63+
# to be available via direnv as well.

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.deps
2+
.devkit

LICENSE

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
MIT License
2+
3+
Copyright (c) 2023 PJ Eby
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
6+
files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
7+
modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
8+
is furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
11+
12+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
13+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
15+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

package.sh

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BUILD_DEPS=bashup/mdsh

script/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## Scripts To Rule Them All
2+
3+
The scripts in this directory are a [Scripts To Rule Them All](https://githubengineering.com/scripts-to-rule-them-all/) implementation, powered by [.devkit](https://github.com/bashup/.devkit). They should be run from within the project's root directory, using e.g. `script/test` to run tests, and so on.
4+
5+
Please check the containing project's documentation for more details, or see the preceding links for more background or reference information.
6+

script/bootstrap

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
3+
if ! [[ -f .dkrc ]]; then
4+
echo "Please run this script from the project root directory." >&2
5+
exit 64 # EX_USAGE
6+
fi
7+
8+
if ! [[ -d .devkit ]]; then
9+
# Modify this line if you want to pin a particular .devkit revision:
10+
git clone -q --depth 1 https://github.com/bashup/.devkit
11+
fi
12+
13+
exec ".devkit/dk" "$(basename "$0")" "$@"

script/build

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bootstrap

script/cibuild

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bootstrap

script/clean

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bootstrap

script/console

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bootstrap

script/server

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bootstrap

script/setup

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bootstrap

script/test

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bootstrap

script/update

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bootstrap

0 commit comments

Comments
 (0)