From bdbd942e9bb91c41006e3a212fdb0bdfec3709c8 Mon Sep 17 00:00:00 2001 From: Joshua Potter Date: Thu, 23 Nov 2023 11:02:40 -0700 Subject: [PATCH] Rename once more to `bootstrap`. --- .gitignore | 2 +- Makefile | 2 +- README.md | 12 ++++++------ flake.nix | 2 +- include/config.h | 14 +++++++------- include/dyn_array.h | 6 +++--- main.c | 10 +++++----- src/config.c | 2 +- test/test_config.h | 10 +++++----- test/test_dyn_array.h | 6 +++--- 10 files changed, 33 insertions(+), 33 deletions(-) diff --git a/.gitignore b/.gitignore index aa76474..0db04da 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ .cache/ .direnv/ compile_commands.json -spec +bootstrap test/runner diff --git a/Makefile b/Makefile index a6136c0..9230f7b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -BUILD=clang -Og -g -I include src/*.c main.c -o spec +BUILD=clang -Og -g -I include src/*.c main.c -o bootstrap all: build bear diff --git a/README.md b/README.md index f6974d0..4f8bc63 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -# spec +# bootstrap CLI utility for initializing projects in reproducible ways. ## Overview Within the `specs` directory exists so-called *specs*. A spec is a directory -containing a `spec.json` file and a `run.sh` file. The former is configured like -so: +containing an optional `spec.json` file and a `run.sh` file. The former is +configured like so: ```spec.json { @@ -15,9 +15,9 @@ so: ``` The keys of this top-level JSON object correspond to the parameters that are -prompted by the `spec init` curses interface. The value is used to determine -what kind of prompt `spec` provides for the given question. Possible value types -include: +prompted by the `bootstrap init` curses interface. The value is used to +determine what kind of prompt `bootstrap` provides for the given question. +Possible value types include: * `[...]` (list) * This indicates a select option prompt. The user chooses amongst the values diff --git a/flake.nix b/flake.nix index a0387a3..17003d4 100644 --- a/flake.nix +++ b/flake.nix @@ -31,7 +31,7 @@ ncurses ]; shellHook = '' - export SPEC_ROOT_DIR="${./specs}" + export BOOTSTRAP_ROOT_DIR="${./specs}" ''; }; } diff --git a/include/config.h b/include/config.h index 3d4c3c0..31d277d 100644 --- a/include/config.h +++ b/include/config.h @@ -1,14 +1,14 @@ -#ifndef _SPEC_CONFIG_H -#define _SPEC_CONFIG_H +#ifndef _BOOTSTRAP_CONFIG_H +#define _BOOTSTRAP_CONFIG_H struct Config { - // The directory the `spec` command was run from. + // The directory the `bootstrap` command was run from. // OWNERSHIP: Does not own this pointer. const char *cwd; // The root directory housing our specs. // OWNERSHIP: Does not own this pointer. const char *root_dir; - // The name of the spec we want to load. + // The name of the spec we want to bootstrap. // OWNERSHIP: Does not own this pointer. const char *target; }; @@ -16,8 +16,8 @@ struct Config { enum ConfigError { // Indicates the $CWD could not be retrieved. CE_ENV_CWD_INVALID = 1, - // Indicates the `$SPEC_ROOT_DIR` environment variable is empty. - CE_ENV_SPEC_ROOT_DIR_INVALID, + // Indicates the $BOOTSTRAP_ROOT_DIR environment variable is empty. + CE_ENV_ROOT_DIR_INVALID, // Indicates the target argument is invalid. CE_TARGET_INVALID, }; @@ -31,4 +31,4 @@ enum ConfigError config_load( void config_free(struct Config *config); -#endif /* _SPEC_CONFIG_H */ +#endif /* BOOTSTRAP_CONFIG_H */ diff --git a/include/dyn_array.h b/include/dyn_array.h index 7b6133a..9839978 100644 --- a/include/dyn_array.h +++ b/include/dyn_array.h @@ -1,5 +1,5 @@ -#ifndef _SPEC_DYN_ARRAY_H -#define _SPEC_DYN_ARRAY_H +#ifndef _BOOTSTRAP_DYN_ARRAY_H +#define _BOOTSTRAP_DYN_ARRAY_H #include @@ -19,4 +19,4 @@ void dyn_array_push(struct DynArray *a, void *item); void dyn_array_free(struct DynArray *a); -#endif /* _SPEC_DYN_ARRAY_H */ +#endif /* _BOOTSTRAP_DYN_ARRAY_H */ diff --git a/main.c b/main.c index 1730755..46ee62f 100644 --- a/main.c +++ b/main.c @@ -5,18 +5,18 @@ #include "config.h" #include "dyn_array.h" -const char *ENV_SPEC_ROOT_DIR = "SPEC_ROOT_DIR"; +const char *ENV_BOOTSTRAP_ROOT_DIR = "BOOTSTRAP_ROOT_DIR"; int main(int argc, char **argv) { int num = 0; if (argc != 2) { - fprintf(stderr, "Usage: gen-flake \n"); + fprintf(stderr, "Usage: bootstrap \n"); exit(EXIT_FAILURE); } const char *cwd = getcwd(0, 0); - const char *root_dir = getenv(ENV_SPEC_ROOT_DIR); + const char *root_dir = getenv(ENV_BOOTSTRAP_ROOT_DIR); const char *target = argv[1]; struct Config *config = 0; @@ -24,8 +24,8 @@ int main(int argc, char **argv) { case CE_ENV_CWD_INVALID: fprintf(stderr, "Could not retrieve the $CWD value."); exit(EXIT_FAILURE); - case CE_ENV_SPEC_ROOT_DIR_INVALID: - fprintf(stderr, "Must specify $SPEC_ROOT_DIR environment variable."); + case CE_ENV_ROOT_DIR_INVALID: + fprintf(stderr, "Must specify $BOOTSTRAP_ROOT_DIR environment variable."); exit(EXIT_FAILURE); case CE_TARGET_INVALID: fprintf(stderr, "Target spec `%s` is invalid.", argv[1]); diff --git a/src/config.c b/src/config.c index 2d4d11a..4db0451 100644 --- a/src/config.c +++ b/src/config.c @@ -13,7 +13,7 @@ enum ConfigError config_load( return CE_ENV_CWD_INVALID; } if (root_dir == 0) { - return CE_ENV_SPEC_ROOT_DIR_INVALID; + return CE_ENV_ROOT_DIR_INVALID; } if (target == 0) { return CE_TARGET_INVALID; diff --git a/test/test_config.h b/test/test_config.h index bf7acef..b6ad262 100644 --- a/test/test_config.h +++ b/test/test_config.h @@ -1,10 +1,10 @@ -#ifndef _SPEC_TEST_CONFIG -#define _SPEC_TEST_CONFIG +#ifndef _BOOTSTRAP_TEST_CONFIG +#define _BOOTSTRAP_TEST_CONFIG #include "config.h" #include "sput.h" -static const char *SAMPLE_CWD = "/home/jrpotter/Documents/spec"; +static const char *SAMPLE_CWD = "/home/jrpotter/Documents/bootstrap"; static const char *SAMPLE_ROOT_DIR = "/usr/local/share/specs"; static const char *SAMPLE_TARGET = "example-target"; @@ -18,7 +18,7 @@ static void test_config_load_cwd_invalid() { static void test_config_load_root_dir_invalid() { struct Config *config = 0; enum ConfigError retval = config_load(SAMPLE_CWD, 0, SAMPLE_TARGET, &config); - sput_fail_unless(retval == CE_ENV_SPEC_ROOT_DIR_INVALID, "root_dir == 0"); + sput_fail_unless(retval == CE_ENV_ROOT_DIR_INVALID, "root_dir == 0"); } static void test_config_load_target_invalid() { @@ -42,4 +42,4 @@ static void test_config_load_success() { config_free(config); } -#endif /* _SPEC_TEST_CONFIG */ +#endif /* _BOOTSTRAP_TEST_CONFIG */ diff --git a/test/test_dyn_array.h b/test/test_dyn_array.h index d6d15b1..f4b9558 100644 --- a/test/test_dyn_array.h +++ b/test/test_dyn_array.h @@ -1,5 +1,5 @@ -#ifndef _SPEC_TEST_DYN_ARRAY -#define _SPEC_TEST_DYN_ARRAY +#ifndef _BOOTSTRAP_TEST_DYN_ARRAY +#define _BOOTSTRAP_TEST_DYN_ARRAY #include "dyn_array.h" #include "sput.h" @@ -44,4 +44,4 @@ static void test_dyn_array_nonzero_capacity() { dyn_array_free(a); } -#endif /* _SPEC_TEST_DYN_ARRAY */ +#endif /* _BOOTSTRAP_TEST_DYN_ARRAY */