-
Notifications
You must be signed in to change notification settings - Fork 2
Home
Casey reports it as a quick and dirty implementation. Justprep was created as a stopgap measure until such time as the ability to include common justfiles into other justfiles was made available as a feature. Now that it is, justprep is consider no longer relevant. It is for all intents and purposes feature complete. With the focus shifting to the implementation embedded within the just
tool I will no longer maintain this pre-processor implementation.
-- Jan 16. , 2023 Dewayne o-*
... is a ore-processor to CLI task runners such as JUST. It provides the ability to include other task definition file's content into your main task file invoked by a set of keyword directives that you define. It also adds a short-hand way of specifying modules that are accessible from your main task file. The module provides the concept of a sub-task.
TL;DR examples
justprep
is configured using System Environment Variables
- JUSTPREP_FOR identifies the task runner to be targeted.
- JUSTPREP_KEYWORDS specifies the inclusionary keywords that you want to use.
- JUSTPREP_MODULE_KEYWORD also allows you to specify the keyword that defines a module
-
JUSTPREP_FILENAME_IN defines the basename of files to look for that contain
justprep
keywords. -
JUSTPREP_FILENAME_OUT defines the basename of the file that
justprep
creates from its input files. Typically this value is "justfile" which is the default of thejust
program.
See Also: Command-line Options
There are two implementations of justprep
available. The Ruby Gem version and the compiled Crystal version. See Ruby And Crystal for some details.
The Ruby Gem version should be able to run on any platform that has Ruby installed.
Why two implementations? Is there a performance difference? I can't tell if there is any speed difference between the two. It there is it is so small its not worth mentioning.
The reason there are two implementation are 1) I'm researching automatic conversion of Ruby source code into compilable Crystal code; and 2) some organizations which use just
are not (shutter) using Ruby. Did I really call them dinosaurs?
Quick aside. For CPU intensive tasks, the compiled Crystal versions of some of my simple Ruby projects is over 30 times faster than their Ruby prototypes.
justprep
is a command line utility. There is no need to include it in a Gemfile. Just do:
gem install justprep
The simplest way on a MacOS platform is to use brew
brew tap madbomber/justprep
brew install --build-from-source justprep
(brew help wanted I've not been able to break the code on how to link the production of releases in the primary repo - this one - and the homebrew-justprep repo. The Formula and github actions have eluded my understanding.)
Binary releases are available. They are currently compiled for MacOS and Linux (on the x86_64 and arm64 architecture.)
The binaries are archived using TAR
Download the matching binary from https://github.com/MadBomber/justprep/releases/latest
tar xzvf justprep-*
chmod +x justprep
Move the executable to a directory in your $PATH.
mv justprep /usr/local/bin
Clone or fork the repository and compile.
Easiest way to compile the Crystal implementation is using the JUST utility. You do have just
installed right?
From the repository root (RR) directory do:
just build
This will build both the Ruby gem implementation and the Crystal implementation. If you only want to build the Crystal version do:
cd crystal
just build
Other useful tasks are available in the justfile
supplied with the repository. To see a list of those recipes just(sic) do:
just
... is not a Jet Plane. You parents might get the reference.
I use the bash
shell and JUST. I have a bash alise jj
defined. It executes justprep
and then just
like this:
alias jj='justprep && just --no-dotenv'
I use the program direnv
which defines environment variables via a .envrc
file whenever I cd
into a directory. That is why I use the "--no-dotenv" option for the just
program.
... and yes. I use the Crystal implementation of justprep
rather than the Ruby gem implementation even though they are both the same. See Ruby And Crystal for details on why there are two implementations.
I use the CLI tool direnv
(brew install direnv) extensively to establish the system environment within my different projects. By convention I have established that $RR is always the current repository's root. That is always set in a .envrc
file. Here is what the top of a .envrc
file typically looks like in one of my projects:
# <project_name>/.envrc
export RR=`pwd`
export JUSTPREP_FOR=just
I use the alias rr
to always cd
me to the repository root.
alias rr='cd $RR'
Sometimes in my examples of things I will use a Ruby or shell script in the task definitions. These can usually be found in my scripts repo.