build(treewide): Update tooling to be ready for the first release
This commit is contained in:
parent
6b0bb9c505
commit
4fc61b2398
21
.envrc
21
.envrc
|
@ -1,25 +1,8 @@
|
||||||
# Copyright (C) 2023 The Trinitrix Project <soispha@vhack.eu, antifallobst@systemausfall.org>
|
|
||||||
#
|
|
||||||
# This file is part of the Trinitry crate for Trinitrix.
|
|
||||||
#
|
|
||||||
# Trinitry is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the Lesser GNU General Public License as
|
|
||||||
# published by the Free Software Foundation, either version 3 of
|
|
||||||
# the License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# and the Lesser GNU General Public License along with this program.
|
|
||||||
# If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
use flake || use nix
|
use flake || use nix
|
||||||
watch_file flake.nix
|
watch_file flake.nix
|
||||||
|
|
||||||
|
PATH_add ./scripts
|
||||||
|
|
||||||
if on_git_branch; then
|
if on_git_branch; then
|
||||||
echo && git status --short --branch &&
|
echo && git status --short --branch &&
|
||||||
echo && git fetch --verbose
|
echo && git fetch --verbose
|
||||||
|
|
108
.licensure.yml
108
.licensure.yml
|
@ -2,15 +2,13 @@
|
||||||
# Regexes which if matched by a file path will always be excluded from
|
# Regexes which if matched by a file path will always be excluded from
|
||||||
# getting a license header
|
# getting a license header
|
||||||
excludes:
|
excludes:
|
||||||
- \.gitignore
|
|
||||||
- .*lock
|
- .*lock
|
||||||
- \.git/.*
|
- \.git/.*
|
||||||
- \.licensure\.yml
|
|
||||||
- README.*
|
|
||||||
- LICENSE.spdx
|
- LICENSE.spdx
|
||||||
|
- LICENSE
|
||||||
- COPYING
|
- COPYING
|
||||||
- COPYING.LESSER
|
- COPYING.LESSER
|
||||||
- .*\.(md|rst|txt|pdf)
|
- .*\.(rst|txt|pdf)
|
||||||
# Definition of the licenses used on this project and to what files
|
# Definition of the licenses used on this project and to what files
|
||||||
# they should apply.
|
# they should apply.
|
||||||
#
|
#
|
||||||
|
@ -25,29 +23,29 @@ licenses:
|
||||||
#
|
#
|
||||||
# If "any" is provided all files will match this license.
|
# If "any" is provided all files will match this license.
|
||||||
- files: any
|
- files: any
|
||||||
#
|
#
|
||||||
# The license identifier, a list of common identifiers can be
|
# The license identifier, a list of common identifiers can be
|
||||||
# found at: https://spdx.org/licenses/ but existence of the ident
|
# found at: https://spdx.org/licenses/ but existence of the ident
|
||||||
# in this list it is not enforced unless auto_template is set to
|
# in this list it is not enforced unless auto_template is set to
|
||||||
# true.
|
# true.
|
||||||
ident: LGPL-3.0-or-later
|
ident: LGPL-3.0-or-later
|
||||||
#
|
#
|
||||||
# A list of authors who hold copyright over these files
|
# A list of authors who hold copyright over these files
|
||||||
authors:
|
authors:
|
||||||
# Provide either your full name or company name for copyright purposes
|
- name: "The Trinitrix Project"
|
||||||
- name: The Trinitrix Project
|
email: "bpeetz@b-peetz.de, antifallobst@systemausfall.org"
|
||||||
# Optionally provide email for copyright purposes
|
|
||||||
email: "soispha@vhack.eu, antifallobst@systemausfall.org"
|
# The template that will be rendered to generate the header before
|
||||||
#
|
# comment characters are applied. Available variables are:
|
||||||
# The template that will be rendered to generate the header before
|
# - [year]: substituted with the current year.
|
||||||
# comment characters are applied. Available variables are:
|
# - [name of author]: Substituted with name of the author and email
|
||||||
# - [year]: substituted with the current year.
|
# if provided. If email is provided the output appears as Full
|
||||||
# - [name of author]: Substituted with name of the author and email
|
# Name <email@example.com>. If multiple authors are provided the
|
||||||
# if provided. If email is provided the output appears as Full
|
# list is concatenated together with commas.
|
||||||
# Name <email@example.com>. If multiple authors are provided the
|
|
||||||
# list is concatenated together with commas.
|
|
||||||
template: |
|
template: |
|
||||||
Copyright (C) [year] [name of author]
|
Copyright (C) 2024 - [year]:
|
||||||
|
[name of author]
|
||||||
|
SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
|
||||||
This file is part of the Trinitry crate for Trinitrix.
|
This file is part of the Trinitry crate for Trinitrix.
|
||||||
|
|
||||||
|
@ -64,23 +62,24 @@ licenses:
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
and the Lesser GNU General Public License along with this program.
|
and the Lesser GNU General Public License along with this program.
|
||||||
If not, see <https://www.gnu.org/licenses/>.
|
If not, see <https://www.gnu.org/licenses/>.
|
||||||
#
|
|
||||||
# If auto_template is true then template is ignored and the SPDX
|
|
||||||
# API will be queried with the ident value to automatically
|
# If auto_template is true then template is ignored and the SPDX
|
||||||
# determine the license header template. auto_template works best
|
# API will be queried with the ident value to automatically
|
||||||
# with licenses that have a standardLicenseHeader field defined in
|
# determine the license header template. auto_template works best
|
||||||
# their license info JSON, if it is not then we will use the full
|
# with licenses that have a standardLicenseHeader field defined in
|
||||||
# licenseText to generate the header which works fine for short
|
# their license info JSON, if it is not then we will use the full
|
||||||
# licenses like MIT but can be quite lengthy for other licenses
|
# licenseText to generate the header which works fine for short
|
||||||
# like BSD-4-Clause. The above default template is valid for most
|
# licenses like MIT but can be quite lengthy for other licenses
|
||||||
# licenses and is recommended for MIT, and BSD licenses. Common
|
# like BSD-4-Clause. The above default template is valid for most
|
||||||
# licenses that work well with the auto_template feature are GPL
|
# licenses and is recommended for MIT, and BSD licenses. Common
|
||||||
# variants, and the Apache 2.0 license.
|
# licenses that work well with the auto_template feature are GPL
|
||||||
#
|
# variants, and the Apache 2.0 license.
|
||||||
# Important Note: this means the ident must be a valid SPDX identifier
|
#
|
||||||
# auto_template: true
|
# Important Note: this means the ident must be a valid SPDX identifier
|
||||||
#
|
# auto_template: true
|
||||||
# If true try to detect the text wrapping of the template, and unwrap it
|
|
||||||
|
# If true try to detect the text wrapping of the template, and unwrap it
|
||||||
unwrap_text: false
|
unwrap_text: false
|
||||||
|
|
||||||
# Define type of comment characters to apply based on file extensions.
|
# Define type of comment characters to apply based on file extensions.
|
||||||
|
@ -103,7 +102,7 @@ comments:
|
||||||
commenter:
|
commenter:
|
||||||
type: line
|
type: line
|
||||||
comment_char: "//"
|
comment_char: "//"
|
||||||
trailing_lines: 2
|
trailing_lines: 1
|
||||||
|
|
||||||
- extensions:
|
- extensions:
|
||||||
- rs
|
- rs
|
||||||
|
@ -111,6 +110,7 @@ comments:
|
||||||
- css
|
- css
|
||||||
- cpp
|
- cpp
|
||||||
- c
|
- c
|
||||||
|
- h
|
||||||
# This demonstrates a block commenter configuration. A block
|
# This demonstrates a block commenter configuration. A block
|
||||||
# commenter type will add start_block_char as the first character
|
# commenter type will add start_block_char as the first character
|
||||||
# in the license header and add end_block_char as the last character
|
# in the license header and add end_block_char as the last character
|
||||||
|
@ -125,15 +125,16 @@ comments:
|
||||||
start_block_char: "/*\n"
|
start_block_char: "/*\n"
|
||||||
end_block_char: "*/\n"
|
end_block_char: "*/\n"
|
||||||
per_line_char: "*"
|
per_line_char: "*"
|
||||||
trailing_lines: 2
|
trailing_lines: 1
|
||||||
|
|
||||||
# In this case extension is singular and a single string extension is provided.
|
- extension:
|
||||||
- extension: html
|
- html
|
||||||
|
- md
|
||||||
commenter:
|
commenter:
|
||||||
type: block
|
type: block
|
||||||
start_block_char: "<!--\n"
|
start_block_char: "<!--\n"
|
||||||
end_block_char: "-->\n"
|
end_block_char: "-->\n"
|
||||||
trailing_lines: 2
|
trailing_lines: 1
|
||||||
|
|
||||||
- extensions:
|
- extensions:
|
||||||
- el
|
- el
|
||||||
|
@ -141,16 +142,15 @@ comments:
|
||||||
commenter:
|
commenter:
|
||||||
type: line
|
type: line
|
||||||
comment_char: ";;;"
|
comment_char: ";;;"
|
||||||
trailing_lines: 2
|
trailing_lines: 1
|
||||||
|
|
||||||
- extensions:
|
- extensions:
|
||||||
- ebnf
|
- tex
|
||||||
|
- bib
|
||||||
commenter:
|
commenter:
|
||||||
type: block
|
type: line
|
||||||
start_block_char: "#(*\n"
|
comment_char: "%"
|
||||||
end_block_char: "#*)\n"
|
trailing_lines: 1
|
||||||
per_line_char: "#"
|
|
||||||
trailing_lines: 2
|
|
||||||
|
|
||||||
# The extension string "any" is special and so will match any file
|
# The extension string "any" is special and so will match any file
|
||||||
# extensions. Commenter configurations are always checked in the
|
# extensions. Commenter configurations are always checked in the
|
||||||
|
@ -164,4 +164,4 @@ comments:
|
||||||
commenter:
|
commenter:
|
||||||
type: line
|
type: line
|
||||||
comment_char: '#'
|
comment_char: '#'
|
||||||
trailing_lines: 2
|
trailing_lines: 1
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "TODO"
|
||||||
|
version = "0.1.0"
|
22
Cargo.toml
22
Cargo.toml
|
@ -1,24 +1,6 @@
|
||||||
# Copyright (C) 2023 The Trinitrix Project <soispha@vhack.eu, antifallobst@systemausfall.org>
|
|
||||||
#
|
|
||||||
# This file is part of the Trinitry crate for Trinitrix.
|
|
||||||
#
|
|
||||||
# Trinitry is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the Lesser GNU General Public License as
|
|
||||||
# published by the Free Software Foundation, either version 3 of
|
|
||||||
# the License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# and the Lesser GNU General Public License along with this program.
|
|
||||||
# If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "trinitry"
|
name = "trinitry"
|
||||||
|
description = "A very simple programming language, used to map functions to commands"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
|
@ -30,4 +12,4 @@ pest_derive = {version = "2.7.5", features = ["grammar-extras"]}
|
||||||
|
|
||||||
# The header imports katex, a js latex parser, into the doc comments
|
# The header imports katex, a js latex parser, into the doc comments
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
rustdoc-args = [ "--html-in-header", "./docs-header.html" ]
|
rustdoc-args = [ "--html-in-header", "./docs/docs-header.html" ]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
SPDXVersion: SPDX-2.3
|
SPDXVersion: SPDX-2.3
|
||||||
DataLicense: CC0-1.0
|
DataLicense: CC0-1.0
|
||||||
Creator: trinitrix contributers
|
Creator: flake template init
|
||||||
PackageName: Trinitrix-trinitry
|
PackageName: trinitry
|
||||||
PackageOriginator: trinitrix contributers
|
PackageOriginator: Benedikt Peetz
|
||||||
PackageHomePage: https://git.nerdcult.net/trinitrix/trinitry
|
PackageHomePage: https://git.nerdcult.net/trinitrix/trinitry
|
||||||
PackageLicenseDeclared: LGPL-3.0-or-later
|
PackageLicenseDeclared: LGPL-3.0-or-later
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
# Trinitry
|
||||||
|
|
||||||
|
> A very simple programming language, used to map functions to commands
|
||||||
|
|
||||||
|
## Licence
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the Lesser GNU General Public License as published
|
||||||
|
by the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
42
cog.toml
42
cog.toml
|
@ -1,47 +1,25 @@
|
||||||
# Copyright (C) 2023 The Trinitrix Project <soispha@vhack.eu, antifallobst@systemausfall.org>
|
|
||||||
#
|
|
||||||
# This file is part of the Trinitry crate for Trinitrix.
|
|
||||||
#
|
|
||||||
# Trinitry is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the Lesser GNU General Public License as
|
|
||||||
# published by the Free Software Foundation, either version 3 of
|
|
||||||
# the License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# and the Lesser GNU General Public License along with this program.
|
|
||||||
# If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
tag_prefix = "v"
|
tag_prefix = "v"
|
||||||
branch_whitelist = [ "prime" ]
|
branch_whitelist = ["main", "prime"]
|
||||||
ignore_merge_commits = false
|
ignore_merge_commits = false
|
||||||
|
|
||||||
[commit_types]
|
|
||||||
|
|
||||||
pre_bump_hooks = [
|
pre_bump_hooks = [
|
||||||
"licensur -p -i" # update the license header in each file
|
"nix flake check", # verify the project builds
|
||||||
"nix build", # verify the project builds
|
"./scripts/renew_copyright_header.sh", # update the license header in each file
|
||||||
"cargo fmt --all" # format
|
"cargo set-version {{version}}", # bump version in Cargo.toml
|
||||||
"cargo set-version {{version}}", # bump version in Cargo.toml
|
"nix fmt", # format
|
||||||
]
|
]
|
||||||
post_bump_hooks = [
|
post_bump_hooks = [
|
||||||
"git push",
|
"git push",
|
||||||
"cargo publish",
|
"cargo publish",
|
||||||
"git push origin v{{version}}", # push the new tag to origin
|
"git push origin v{{version}}", # push the new tag to origin
|
||||||
]
|
]
|
||||||
|
|
||||||
[bump_profiles]
|
[bump_profiles]
|
||||||
|
|
||||||
[changelog]
|
[changelog]
|
||||||
path = "NEWS.md"
|
path = "NEWS.md"
|
||||||
|
template = "remote"
|
||||||
remote = "git.nerdcult.net"
|
remote = "git.nerdcult.net"
|
||||||
repository = "trinitry"
|
repository = "trinitry"
|
||||||
owner = "trinitrix"
|
owner = "trinitrix"
|
||||||
authors = [
|
authors = [{ signature = "Benedikt Peetz", username = "soispha" }]
|
||||||
{ signature = "Soispha", username = "soispha" },
|
|
||||||
]
|
|
||||||
|
|
68
flake.lock
68
flake.lock
|
@ -7,11 +7,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1703089493,
|
"lastModified": 1711681752,
|
||||||
"narHash": "sha256-WUjYqUP/Lhhop9+aiHVFREgElunx1AHEWxqMT8ePfzo=",
|
"narHash": "sha256-LEg6/dmEFxx6Ygti5DO9MOhGNpyB7zdxdWtzv/FCTXk=",
|
||||||
"owner": "ipetkov",
|
"owner": "ipetkov",
|
||||||
"repo": "crane",
|
"repo": "crane",
|
||||||
"rev": "2a5136f14a9ac93d9d370d64a36026c5de3ae8a4",
|
"rev": "ada0fb4dcce4561acb1eb17c59b7306d9d4a95f3",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -38,14 +38,16 @@
|
||||||
},
|
},
|
||||||
"flake-utils": {
|
"flake-utils": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"systems": "systems"
|
"systems": [
|
||||||
|
"systems"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1701680307,
|
"lastModified": 1710146030,
|
||||||
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
|
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
|
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -56,16 +58,16 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1703349974,
|
"lastModified": 1711715736,
|
||||||
"narHash": "sha256-BcR1wW63W4baNtWbpg25d/mt0DVkEBIFssAY9JPNpZg=",
|
"narHash": "sha256-9slQ609YqT9bT/MNX9+5k5jltL9zgpn36DpFB7TkttM=",
|
||||||
"owner": "soispha",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "7e33c3c5db1c69a50efc2143ffa53539e8b4c0ed",
|
"rev": "807c549feabce7eddbf259dbdcec9e0600a0660d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "soispha",
|
"owner": "NixOS",
|
||||||
"ref": "licensure",
|
"ref": "nixpkgs-unstable",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
@ -76,7 +78,9 @@
|
||||||
"flake-compat": "flake-compat",
|
"flake-compat": "flake-compat",
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"rust-overlay": "rust-overlay"
|
"rust-overlay": "rust-overlay",
|
||||||
|
"systems": "systems",
|
||||||
|
"treefmt-nix": "treefmt-nix"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rust-overlay": {
|
"rust-overlay": {
|
||||||
|
@ -89,11 +93,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1703297543,
|
"lastModified": 1711851236,
|
||||||
"narHash": "sha256-d4QlzcoSNzb/iZheWtjOyRxoBSaLETSpViENGEkxv9g=",
|
"narHash": "sha256-EJ03x3N9ihhonAttkaCrqxb0djDq3URCuDpmVPbNZhA=",
|
||||||
"owner": "oxalica",
|
"owner": "oxalica",
|
||||||
"repo": "rust-overlay",
|
"repo": "rust-overlay",
|
||||||
"rev": "fc77c8b416b1537522d30c710baaaaebf769f816",
|
"rev": "f258266af947599e8069df1c2e933189270f143a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -104,16 +108,36 @@
|
||||||
},
|
},
|
||||||
"systems": {
|
"systems": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1681028828,
|
"lastModified": 1680978846,
|
||||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
"narHash": "sha256-Gtqg8b/v49BFDpDetjclCYXm8mAnTrUzR0JnE2nv5aw=",
|
||||||
"owner": "nix-systems",
|
"owner": "nix-systems",
|
||||||
"repo": "default",
|
"repo": "x86_64-linux",
|
||||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
"rev": "2ecfcac5e15790ba6ce360ceccddb15ad16d08a8",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nix-systems",
|
"owner": "nix-systems",
|
||||||
"repo": "default",
|
"repo": "x86_64-linux",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"treefmt-nix": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1711803027,
|
||||||
|
"narHash": "sha256-Qic3OvsVLpetchzaIe2hJqgliWXACq2Oee6mBXa/IZQ=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "treefmt-nix",
|
||||||
|
"rev": "1810d51a015c1730f2fe05a255258649799df416",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "treefmt-nix",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
111
flake.nix
111
flake.nix
|
@ -1,32 +1,14 @@
|
||||||
# Copyright (C) 2023 The Trinitrix Project <soispha@vhack.eu, antifallobst@systemausfall.org>
|
|
||||||
#
|
|
||||||
# This file is part of the Trinitry crate for Trinitrix.
|
|
||||||
#
|
|
||||||
# Trinitry is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the Lesser GNU General Public License as
|
|
||||||
# published by the Free Software Foundation, either version 3 of
|
|
||||||
# the License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# and the Lesser GNU General Public License along with this program.
|
|
||||||
# If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
description = "A very simple programming language used to map functions to commands";
|
description = "A very simple programming language, used to map functions to commands";
|
||||||
inputs = {
|
|
||||||
# nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
||||||
nixpkgs.url = "github:soispha/nixpkgs/licensure";
|
|
||||||
|
|
||||||
# inputs for following
|
inputs = {
|
||||||
flake-compat = {
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||||
url = "github:edolstra/flake-compat";
|
|
||||||
flake = false;
|
treefmt-nix = {
|
||||||
|
url = "github:numtide/treefmt-nix";
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
crane = {
|
crane = {
|
||||||
|
@ -35,10 +17,6 @@
|
||||||
nixpkgs.follows = "nixpkgs";
|
nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
flake-utils = {
|
|
||||||
url = "github:numtide/flake-utils";
|
|
||||||
inputs = {};
|
|
||||||
};
|
|
||||||
rust-overlay = {
|
rust-overlay = {
|
||||||
url = "github:oxalica/rust-overlay";
|
url = "github:oxalica/rust-overlay";
|
||||||
inputs = {
|
inputs = {
|
||||||
|
@ -46,12 +24,29 @@
|
||||||
flake-utils.follows = "flake-utils";
|
flake-utils.follows = "flake-utils";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# inputs for following
|
||||||
|
systems = {
|
||||||
|
url = "github:nix-systems/x86_64-linux"; # only evaluate for this system
|
||||||
|
};
|
||||||
|
flake-compat = {
|
||||||
|
url = "github:edolstra/flake-compat";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
flake-utils = {
|
||||||
|
url = "github:numtide/flake-utils";
|
||||||
|
inputs = {
|
||||||
|
systems.follows = "systems";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {
|
outputs = {
|
||||||
|
self,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
crane,
|
|
||||||
flake-utils,
|
flake-utils,
|
||||||
|
treefmt-nix,
|
||||||
|
crane,
|
||||||
rust-overlay,
|
rust-overlay,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
@ -62,54 +57,44 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
nightly = false;
|
nightly = false;
|
||||||
rust =
|
rust_minimal =
|
||||||
if nightly
|
if nightly
|
||||||
then
|
then pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.minimal)
|
||||||
(pkgs.rust-bin.selectLatestNightlyWith (toolchain:
|
|
||||||
toolchain.default))
|
|
||||||
.override {
|
|
||||||
extensions = ["rustc-codegen-cranelift-preview"];
|
|
||||||
}
|
|
||||||
else pkgs.rust-bin.stable.latest.default;
|
|
||||||
rust_min =
|
|
||||||
if nightly
|
|
||||||
then
|
|
||||||
(pkgs.rust-bin.selectLatestNightlyWith (toolchain:
|
|
||||||
toolchain.minimal))
|
|
||||||
.override {
|
|
||||||
extensions = ["rustc-codegen-cranelift-preview"];
|
|
||||||
}
|
|
||||||
else pkgs.rust-bin.stable.latest.minimal;
|
else pkgs.rust-bin.stable.latest.minimal;
|
||||||
|
rust_default =
|
||||||
|
if nightly
|
||||||
|
then pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default)
|
||||||
|
else pkgs.rust-bin.stable.latest.default;
|
||||||
|
|
||||||
craneLib = (crane.mkLib pkgs).overrideToolchain rust_min;
|
craneLib = (crane.mkLib pkgs).overrideToolchain rust_minimal;
|
||||||
|
|
||||||
nativeBuildInputs = [];
|
|
||||||
buildInputs = [];
|
|
||||||
|
|
||||||
craneBuild = craneLib.buildPackage {
|
craneBuild = craneLib.buildPackage {
|
||||||
src = craneLib.cleanCargoSource ./.;
|
src = craneLib.cleanCargoSource ./.;
|
||||||
|
|
||||||
doCheck = true;
|
doCheck = true;
|
||||||
inherit nativeBuildInputs buildInputs;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
treefmtEval = import ./treefmt.nix {inherit treefmt-nix pkgs;};
|
||||||
in {
|
in {
|
||||||
checks.default = craneBuild;
|
packages.default = craneBuild;
|
||||||
packages = {
|
|
||||||
default = craneBuild;
|
checks = {
|
||||||
|
inherit craneBuild;
|
||||||
|
formatting = treefmtEval.config.build.check self;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
formatter = treefmtEval.config.build.wrapper;
|
||||||
|
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
alejandra
|
|
||||||
|
|
||||||
cocogitto
|
cocogitto
|
||||||
licensure
|
|
||||||
|
|
||||||
rust
|
rust_default
|
||||||
cargo-edit
|
cargo-edit
|
||||||
cargo-expand
|
|
||||||
|
licensure
|
||||||
];
|
];
|
||||||
inherit nativeBuildInputs buildInputs;
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
# vim: ts=2
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,92 @@
|
||||||
|
#! /usr/bin/env sh
|
||||||
|
|
||||||
|
# NOTE: This is the line length of the .licensure.yml header template **plus** the extra
|
||||||
|
# line after the template comment.
|
||||||
|
TEMPLATE_LINE_LENGTH=20
|
||||||
|
LATEX_TEMPLATE_LINE_LENGTH=9
|
||||||
|
|
||||||
|
PROJECT_ROOT="$(git rev-parse --show-toplevel)"
|
||||||
|
|
||||||
|
remove() {
|
||||||
|
extension="$1"
|
||||||
|
file="$2"
|
||||||
|
|
||||||
|
# We need to differentiate, when removing the old copyright header, as some
|
||||||
|
# formatters do weird things to the file
|
||||||
|
case "$extension" in
|
||||||
|
# normal '#' comments (these are $TEMPLATE_LINE_LENGTH lines long)
|
||||||
|
"Makefile" | "toml" | "envrc" | "yml" | "gitignore" | "awk")
|
||||||
|
sed --in-place "1,${TEMPLATE_LINE_LENGTH}d" "$file"
|
||||||
|
;;
|
||||||
|
# LaTeX files (or TeX files in general) have a different license, use the
|
||||||
|
# $LATEX_TEMPLATE_LINE_LENGTH variable.
|
||||||
|
"tex")
|
||||||
|
sed --in-place "1,${LATEX_TEMPLATE_LINE_LENGTH}d" "$file"
|
||||||
|
;;
|
||||||
|
# normal '/* ... */' like comments (these are $TEMPLATE_LINE_LENGTH + 2 lines long)
|
||||||
|
"c" | "h" | "md" | "rs")
|
||||||
|
length="$((TEMPLATE_LINE_LENGTH + 2))"
|
||||||
|
sed --in-place "1,${length}d;" "$file"
|
||||||
|
;;
|
||||||
|
# alejandra (the nix formatter) removes the blank line after the comment,
|
||||||
|
# thus only $TEMPLATE_LINE_LENGTH - 1 lines
|
||||||
|
"nix")
|
||||||
|
length="$((TEMPLATE_LINE_LENGTH - 1))"
|
||||||
|
sed --in-place "1,${length}d;" "$file"
|
||||||
|
;;
|
||||||
|
# Shell needs a shebang on the first line, only after the first line can we
|
||||||
|
# remove the $TEMPLATE_LINE_LENGTH lines
|
||||||
|
"sh")
|
||||||
|
sed --in-place "2,${TEMPLATE_LINE_LENGTH}d;" "$file"
|
||||||
|
licensure --in-place "$file"
|
||||||
|
|
||||||
|
TEMPLATE_LINE_LENGTH_NEW="$(($(yq --raw-output '.licenses | map(.template) | join("")' "$PROJECT_ROOT/.licensure.yml" | wc -l) + $(yq '.comments | last | .commenter.trailing_lines' "$PROJECT_ROOT/.licensure.yml")))"
|
||||||
|
|
||||||
|
# delete the current shebang
|
||||||
|
to="$((TEMPLATE_LINE_LENGTH_NEW + 1))"
|
||||||
|
sed --in-place "${TEMPLATE_LINE_LENGTH_NEW},${to}d;" "$file"
|
||||||
|
|
||||||
|
# add a new one
|
||||||
|
sed --in-place "1i#! /usr/bin/env sh" "$file"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "File '$file' with extension '$extension' is not know yet, please add it!"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
list() {
|
||||||
|
echo "$extension -> $file"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -f "$1" ]; then
|
||||||
|
file="$(realpath "$1")"
|
||||||
|
filename="$(basename -- "$file")"
|
||||||
|
extension="${filename##*.}"
|
||||||
|
filename="${filename%.*}"
|
||||||
|
|
||||||
|
if [ -n "$DRY_RUN" ]; then
|
||||||
|
list "$extension" "$file"
|
||||||
|
else
|
||||||
|
remove "$extension" "$file"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
fd --type file --hidden . | while read -r file; do
|
||||||
|
if grep --quiet 'SPDX-License-Identifier' "$file"; then
|
||||||
|
filename="$(basename -- "$file")"
|
||||||
|
extension="${filename##*.}"
|
||||||
|
filename="${filename%.*}"
|
||||||
|
|
||||||
|
if [ -n "$DRY_RUN" ]; then
|
||||||
|
list "$extension" "$file"
|
||||||
|
else
|
||||||
|
remove "$extension" "$file"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -z "$DRY_RUN" ]; then
|
||||||
|
licensure --in-place --project
|
||||||
|
nix fmt
|
||||||
|
fi
|
||||||
|
fi
|
|
@ -0,0 +1,108 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
# Copyright (C) 2023 The Trinitrix Project <soispha@vhack.eu, antifallobst@systemausfall.org>
|
||||||
|
#
|
||||||
|
# This file is part of the Trinitry crate for Trinitrix.
|
||||||
|
#
|
||||||
|
# Trinitry is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the Lesser GNU General Public License as
|
||||||
|
# published by the Free Software Foundation, either version 3 of
|
||||||
|
# the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# and the Lesser GNU General Public License along with this program.
|
||||||
|
# If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
# This script generates ./src/tests.rs
|
||||||
|
|
||||||
|
# Library {{{
|
||||||
|
mktmp() {
|
||||||
|
ensure_tmp_dir
|
||||||
|
mktemp -p "$LIB_TEMP_DIR_FOR_SCRIPT"
|
||||||
|
}
|
||||||
|
ensure_tmp_dir() {
|
||||||
|
if ! [ -d "$LIB_TEMP_DIR_FOR_SCRIPT" ]; then
|
||||||
|
LIB_TEMP_DIR_FOR_SCRIPT="$(mktemp -d)"
|
||||||
|
export LIB_TEMP_DIR_FOR_SCRIPT
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
remove_tmp_dir() {
|
||||||
|
# The test is here because some scripts still delete this on their own
|
||||||
|
if [ -d "$LIB_TEMP_DIR_FOR_SCRIPT" ]; then
|
||||||
|
rm -r "$LIB_TEMP_DIR_FOR_SCRIPT"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
trap remove_tmp_dir EXIT
|
||||||
|
ensure_tmp_dir # ensure that the variable has been set, even in subshells
|
||||||
|
# }}}
|
||||||
|
|
||||||
|
tmp="$(mktmp)"
|
||||||
|
|
||||||
|
curl https://raw.githubusercontent.com/minimaxir/big-list-of-naughty-strings/master/blns.txt |
|
||||||
|
awk '!/^#/' |
|
||||||
|
awk '!/^[\s\t]*$/' |
|
||||||
|
awk -v s="'" '!/.*s.*/' |
|
||||||
|
|
||||||
|
# This entry contains duplicated spaces, just ignore it
|
||||||
|
awk '!/Power/' |
|
||||||
|
iconv -c -f utf-8 -t ascii \
|
||||||
|
>"$tmp"
|
||||||
|
|
||||||
|
counter=0
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
// DO NOT EDIT
|
||||||
|
// This file is automatically generated by the 'update.sh' file, with data from:
|
||||||
|
// https://raw.githubusercontent.com/minimaxir/big-list-of-naughty-strings/master/blns.txt
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use crate::Trinitry;
|
||||||
|
EOF
|
||||||
|
|
||||||
|
while read -r name; do
|
||||||
|
tmp2="$(mktmp)"
|
||||||
|
printf "%s" "$name" >"$tmp2"
|
||||||
|
if rg '^[A-Za-z0-9_.-]+$' "$tmp2" -q; then
|
||||||
|
cat <<EOF
|
||||||
|
#[test]
|
||||||
|
fn parse_$counter() {
|
||||||
|
let p = Trinitry::new(r##"$name"##).unwrap_or_else(|e| {
|
||||||
|
panic!("{}", e);
|
||||||
|
});
|
||||||
|
assert_eq!(r##"$name"##, &p.to_string());
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
elif rg '^[A-Za-z0-9_.-]+ [A-Za-z0-9_.(){}<>?!+^@&*~|=,/\\ -]*$' "$tmp2" -q; then
|
||||||
|
cat <<EOF
|
||||||
|
#[test]
|
||||||
|
fn parse_$counter() {
|
||||||
|
let p = Trinitry::new(r##"$name"##).unwrap_or_else(|e| {
|
||||||
|
panic!("{}", e);
|
||||||
|
});
|
||||||
|
assert_eq!(r##"$name"##, &p.to_string());
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
else
|
||||||
|
cat <<EOF
|
||||||
|
#[test]
|
||||||
|
fn parse_$counter() {
|
||||||
|
let p = Trinitry::new(r##"$name"##);
|
||||||
|
assert!(p.is_err());
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
counter=$((counter + 1))
|
||||||
|
done <"$tmp"
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# vim: ft=sh
|
21
src/tests.rs
21
src/tests.rs
|
@ -1,24 +1,3 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2023 The Trinitrix Project <soispha@vhack.eu, antifallobst@systemausfall.org>
|
|
||||||
*
|
|
||||||
* This file is part of the Trinitry crate for Trinitrix.
|
|
||||||
*
|
|
||||||
* Trinitry is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the Lesser GNU General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of
|
|
||||||
* the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* and the Lesser GNU General Public License along with this program.
|
|
||||||
* If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// DO NOT EDIT
|
// DO NOT EDIT
|
||||||
// This file is automatically generated by the 'update.sh' file, with data from:
|
// This file is automatically generated by the 'update.sh' file, with data from:
|
||||||
// https://raw.githubusercontent.com/minimaxir/big-list-of-naughty-strings/master/blns.txt
|
// https://raw.githubusercontent.com/minimaxir/big-list-of-naughty-strings/master/blns.txt
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
{
|
||||||
|
treefmt-nix,
|
||||||
|
pkgs,
|
||||||
|
}:
|
||||||
|
treefmt-nix.lib.evalModule pkgs (
|
||||||
|
{pkgs, ...}: {
|
||||||
|
# Used to find the project root
|
||||||
|
projectRootFile = "flake.nix";
|
||||||
|
|
||||||
|
programs = {
|
||||||
|
alejandra.enable = true;
|
||||||
|
rustfmt.enable = true;
|
||||||
|
clang-format.enable = true;
|
||||||
|
mdformat.enable = true;
|
||||||
|
shfmt = {
|
||||||
|
enable = true;
|
||||||
|
indent_size = 4;
|
||||||
|
};
|
||||||
|
shellcheck.enable = true;
|
||||||
|
prettier = {
|
||||||
|
settings = {
|
||||||
|
arrowParens = "always";
|
||||||
|
bracketSameLine = false;
|
||||||
|
bracketSpacing = true;
|
||||||
|
editorconfig = true;
|
||||||
|
embeddedLanguageFormatting = "auto";
|
||||||
|
endOfLine = "lf";
|
||||||
|
# experimentalTernaries = false;
|
||||||
|
htmlWhitespaceSensitivity = "css";
|
||||||
|
insertPragma = false;
|
||||||
|
jsxSingleQuote = true;
|
||||||
|
printWidth = 80;
|
||||||
|
proseWrap = "always";
|
||||||
|
quoteProps = "consistent";
|
||||||
|
requirePragma = false;
|
||||||
|
semi = true;
|
||||||
|
singleAttributePerLine = true;
|
||||||
|
singleQuote = true;
|
||||||
|
trailingComma = "all";
|
||||||
|
useTabs = false;
|
||||||
|
vueIndentScriptAndStyle = false;
|
||||||
|
|
||||||
|
tabWidth = 4;
|
||||||
|
overrides = {
|
||||||
|
files = ["*.js"];
|
||||||
|
options.tabwidth = 2;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
stylua.enable = true;
|
||||||
|
ruff = {
|
||||||
|
enable = true;
|
||||||
|
format = true;
|
||||||
|
};
|
||||||
|
taplo.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
global.excludes = [
|
||||||
|
"CHANGELOG.md"
|
||||||
|
"NEWS.md"
|
||||||
|
];
|
||||||
|
formatter = {
|
||||||
|
clang-format = {
|
||||||
|
options = ["--style" "GNU"];
|
||||||
|
};
|
||||||
|
shfmt = {
|
||||||
|
includes = ["*.bash"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
)
|
107
update.sh
107
update.sh
|
@ -1,106 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# Copyright (C) 2023 The Trinitrix Project <soispha@vhack.eu, antifallobst@systemausfall.org>
|
|
||||||
#
|
|
||||||
# This file is part of the Trinitry crate for Trinitrix.
|
|
||||||
#
|
|
||||||
# Trinitry is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the Lesser GNU General Public License as
|
|
||||||
# published by the Free Software Foundation, either version 3 of
|
|
||||||
# the License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# and the Lesser GNU General Public License along with this program.
|
|
||||||
# If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
nix flake update
|
||||||
# Library {{{
|
cargo update
|
||||||
mktmp() {
|
[ "$1" = "upgrade" ] && cargo upgrade
|
||||||
ensure_tmp_dir
|
|
||||||
mktemp -p "$LIB_TEMP_DIR_FOR_SCRIPT"
|
|
||||||
}
|
|
||||||
ensure_tmp_dir() {
|
|
||||||
if ! [ -d "$LIB_TEMP_DIR_FOR_SCRIPT" ]; then
|
|
||||||
LIB_TEMP_DIR_FOR_SCRIPT="$(mktemp -d)"
|
|
||||||
export LIB_TEMP_DIR_FOR_SCRIPT
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
remove_tmp_dir() {
|
|
||||||
# The test is here because some scripts still delete this on their own
|
|
||||||
if [ -d "$LIB_TEMP_DIR_FOR_SCRIPT" ]; then
|
|
||||||
rm -r "$LIB_TEMP_DIR_FOR_SCRIPT"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
trap remove_tmp_dir EXIT
|
|
||||||
ensure_tmp_dir # ensure that the variable has been set, even in subshells
|
|
||||||
# }}}
|
|
||||||
|
|
||||||
tmp="$(mktmp)"
|
|
||||||
|
|
||||||
curl https://raw.githubusercontent.com/minimaxir/big-list-of-naughty-strings/master/blns.txt |
|
|
||||||
awk '!/^#/' |
|
|
||||||
awk '!/^[\s\t]*$/' |
|
|
||||||
awk -v s="'" '!/.*s.*/' |
|
|
||||||
|
|
||||||
# This entry contains duplicated spaces, just ignore it
|
|
||||||
awk '!/Power/' |
|
|
||||||
iconv -c -f utf-8 -t ascii \
|
|
||||||
>"$tmp"
|
|
||||||
|
|
||||||
counter=0
|
|
||||||
|
|
||||||
cat <<EOF
|
|
||||||
// DO NOT EDIT
|
|
||||||
// This file is automatically generated by the 'update.sh' file, with data from:
|
|
||||||
// https://raw.githubusercontent.com/minimaxir/big-list-of-naughty-strings/master/blns.txt
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod test {
|
|
||||||
use crate::Trinitry;
|
|
||||||
EOF
|
|
||||||
|
|
||||||
while read -r name; do
|
|
||||||
tmp2="$(mktmp)"
|
|
||||||
printf "%s" "$name" >"$tmp2"
|
|
||||||
if rg '^[A-Za-z0-9_.-]+$' "$tmp2" -q; then
|
|
||||||
cat <<EOF
|
|
||||||
#[test]
|
|
||||||
fn parse_$counter() {
|
|
||||||
let p = Trinitry::new(r##"$name"##).unwrap_or_else(|e| {
|
|
||||||
panic!("{}", e);
|
|
||||||
});
|
|
||||||
assert_eq!(r##"$name"##, &p.to_string());
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
elif rg '^[A-Za-z0-9_.-]+ [A-Za-z0-9_.(){}<>?!+^@&*~|=,/\\ -]*$' "$tmp2" -q; then
|
|
||||||
cat <<EOF
|
|
||||||
#[test]
|
|
||||||
fn parse_$counter() {
|
|
||||||
let p = Trinitry::new(r##"$name"##).unwrap_or_else(|e| {
|
|
||||||
panic!("{}", e);
|
|
||||||
});
|
|
||||||
assert_eq!(r##"$name"##, &p.to_string());
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
else
|
|
||||||
cat <<EOF
|
|
||||||
#[test]
|
|
||||||
fn parse_$counter() {
|
|
||||||
let p = Trinitry::new(r##"$name"##);
|
|
||||||
assert!(p.is_err());
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
counter=$((counter + 1))
|
|
||||||
done <"$tmp"
|
|
||||||
|
|
||||||
cat <<EOF
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# vim: ft=sh
|
|
||||||
|
|
Loading…
Reference in New Issue