Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
name: Release
run-name: Creating release tarball...
on:
push:
tags:
- "v*.*.*"

jobs:
Create-Tarball:
runs-on: ubuntu-latest
build:
runs-on: ubuntu-22.04
permissions:
id-token: "write"
contents: "write"
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Create tarball
run: git archive --format=tar.gz --prefix=jj/ -o jj.tgz HEAD
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Run `nix build`
run: nix build .#jiujitsu
- name: Create release
uses: softprops/action-gh-release@v2
with:
files: jj.tgz
permissions:
contents: write
files: result/bin/jj.com
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,11 @@
*.log
tmp/

result/
result
.direnv/
.vagrant/

*.com*
*.tgz
.apperl/
67 changes: 57 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,71 @@
# How to run while testing
Assuming you have all the perl dependencies installed, use:
`perl -I ./lib/ bin/jiujitsu` from the repository root.
# How to Use
```bash
wget https://github.com/luccdc/jj/releases/latest/download/jj.tgz
# OR
curl -LO https://github.com/luccdc/jj/releases/latest/download/jj.tgz
```

```bash
jj.com # Runs jiujitsu

# Run as perl
cp jj.com perl
./perl

# Run as perldoc
cp jj.com perldoc
./perldoc
```

# How to Develop
You'll need to have Nix installed to work on this.
If you're on Windows, either WSL or a virtual machine work perfectly.
Once you've got Linux, please:
1. [Install nix](https://nixos.org/download/)
2. Enable flakes by adding this line in `~/.config/nix/nix.conf`:
`experimental-features = nix-command flakes`
3. Reload the nix daemon with `systemctl`.

Next, clone this repository:
(Make sure you're in an appropriate directory!)
``` shell
git clone git@github.com:luccdc/jj.git
cd jj
```
From inside the repo, running `nix develop` should bring you into the nix development environment.
The first time you do this it may take a few minutes to load, that is normal.

You can run intermediate work using `./bin/jj` from the repository root.

## Producing Builds
While developing, you can run the builder with `apperlm configure && apperlm build`.
Note that these builds are _not_ produced cleanly. They will install cosmocc and perl separately the first time you run them.
In order to produce a release build, run `nix build .#jiujitsu`. In 45 minutes or so, **boom!** `jj.com` will appear in `result/bin/`.

## Where to get dependencies from

# Where to get dependencies from
Q: I need a library that does foo, don't want to write it myself. Where can I find it?

A: CPAN! Check this list of high-quality tools:
- https://metacpan.org/pod/Task::Kensho
Or search for it:
- https://metacpan.org

# How to add a new Perl package to Nix
Once you have a good dependency in mind, [add it to nix](#how-to-add-a-new-perl-package-to-nix).

## How to add a new Perl package to Nix
1. Find the package you want to add on [CPAN](https://metacpan.org/search)
2. Search [nixpkgs](https://search.nixos.org/packages?channel=unstable) for a matching perl540Package to add inside the `perl540.withPackages` expression.
2. Search [nixpkgs](https://search.nixos.org/packages?channel=unstable) for a matching perl540Package.
3. No dice? Generate the package with the `./nix/nix-generate-from-cpan.pl` script:
`nix-generate-from-cpan.pl <cpan-pkg-name>`
4. Add the resulting expression into the `let`-expression in `nix/perl.nix`, and add the name to the final list.
- Add the resulting expression into the `let`-expression in `nix/perl.nix`, and add the name to the final object.
4. Add your package to the perlDeps list.
If you got it from nixpkgs, just the name please.
If you generated it, prefix the name with `generatedPerlPackages`.

# Argument Parsing
**NOTICE: This crappy argparser will shortly be replaced with something better.**

Argument parsing uses the [Arguments](./lib/LUCCDC/jiujitsu/Util/Arguments.pm) module.
A parser is a closure that can be called on a string representing the command-line.
Each parser takes two arguments:
Expand Down Expand Up @@ -48,6 +96,5 @@ The above exemplifies the creation and use of a parser.
A parser closure will return a hash of the arguments, keyed to the names of options.
If it encounters a subcommand, it will run that command and exit instead of returning.

# Packaging Options
- https://metacpan.org/pod/App::FatPacker
- https://metacpan.org/pod/pp
# Related Projects
Check out [jj-rs](https://github.com/luccdc/jj-rs/), our sister project and sometime-competing implementation, written by the legendary Andrew Rioux.
25 changes: 25 additions & 0 deletions apperl-project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"apperl_configs" : {
"jiujitsu" : {
"dest" : "jj.com",
"desc" : "description of this config",
"base" : "full",
"install_modules": [
".apperl/nix-links/Module-Path-0.19.tar.gz",
".apperl/nix-links/File-Grep-0.02.tar.gz",
".apperl/nix-links/strictures-2.000006.tar.gz"
],
"zip_extra_files" : {
"__perllib__/LUCCDC" : [
"lib/LUCCDC/Jiujitsu.pm",
"lib/LUCCDC/Jiujitsu/"
],
"bin" : [
"bin/jj"
]
},
"default_script" : "/zip/bin/jj"
}
},
"defaultconfig" : "jiujitsu"
}
13 changes: 0 additions & 13 deletions bin/jiujitsu

This file was deleted.

1 change: 0 additions & 1 deletion bin/jj

This file was deleted.

3 changes: 3 additions & 0 deletions bin/jj
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env perl
use LUCCDC::Jiujitsu;
LUCCDC::Jiujitsu->run;
29 changes: 28 additions & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading