Skip to content

Commit

Permalink
chore: update to 0.18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
squattingmonk committed Jun 4, 2022
1 parent d0b0e83 commit 40c872c
Show file tree
Hide file tree
Showing 3 changed files with 176 additions and 2 deletions.
174 changes: 174 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,179 @@
# nasher changelog

## 0.18.0: June 3, 2022

### Added subsections to `nasher.cfg`

`nasher.cfg` now supports subsections to allow better organization. The current
subsections allowed are `[*.sources]`, `[*.rules]`, and `[*.variables]`. These
can either be context-aware or explicitly set:

# Context aware subsections
[package]
[sources]
[target]
[sources]

# Explicit (preferred)
[package]
[package.sources]
[target]
[target.sources]

Indentation is optional, but encouraged.

The parser should be backwards compatible with existing `nasher.cfg` files, and
there are tests to check some known packages.

### Added support for user-defined variables

You can now define variables that can be referenced in any target field except for
`name`. You can set variables in the `[package.variables]` section (to apply to
all targets) or the `[target.variables]` section (to apply to a single target).
The key is the variable name, while the value is what it should resolve to. The
target variables table is merged with the package variables table to allow
missing keys to be inherited.

If a variable referenced is not found, nasher will also check the environment
variables. If a variable is not found in the table or the environment, an error
is thrown.

Variables can be referenced using the syntax `$variable` or `${variable}`. The
latter syntax allows variables to include non-alphanumeric characters or to be
adjacent to alphanumeric characters that are not part of the variable name
(e.g., `${foo}bar`).

One variable is available by default: `$target` resolves to the name of the
current target. This allows some neat things:

```toml
# This package has two targets, "foo" and "bar", that yield a file
# named "foo.hak" and "bar.hak", respectively using the source files
# in "src/foo" and "src/bar" respectively.
[package]
file = "$target.hak"

[package.sources]
include = "src/$target/*"

[target]
name = "foo"

[target]
name = "bar"
```

This feature can also be used to easily reference out-of-tree projects:

```toml
[package]

[package.variables]
sm-utils = "../sm-utils/src" # Can be used by any target or rule

[package.sources]
include = "${sm-utils}/*.{nss,json}" # include files in sm-utils
include = "src/**/*.{nss,json}"

[package.rules]
"util_*" = "${sm-utils}" # Unpack util files to sm-utils
"*" = "src/$target" # Unpack unknown file to target's source dir

[target]
name = "demo"
file = "core_framework.mod"

[target]
name = "utils"
file = "sm_utils.erf"

[target.sources]
include = "${sm-utils}/*.{nss,json}" # include only files in sm-utils
```

Since nasher checks environment variables, you can place user-specific
information in an environment variable. For example, if you want to include a
file in a target using an absolute path, you could place it directly in the
`nasher.cfg`, but this would not be useful for other users of your project:

```toml
[target]
name = "mymodule"
file = "my_module.mod"

[target.sources]
include = "src/*.{nss,json}"
include = "/home/squattingmonk/.local/src/nwscript/utils/util_i_color.nss"
```

This makes collaboration difficult, since other users of this project would have
to edit the `nasher.cfg` to change the location of the file to where it is on
their system. Instead, you can use an environment variable:

```toml
[target]
name = "mymodule"
file = "my_module.mod"

[target.sources]
include = "src/*.{nss,json}"
include = "${SM_UTILS}/util_i_color.nss"
```

```bash
export SM_UTILS=/home/squattingmonk/.local/src/nwscript/utils
```

Other users can then set the environment variable to the location of their
choice without changing the `nasher.cfg`.

### Added user-defined target groups

You can now group targets into aliases that are expanded when a
command is run. Groups are defined with the repeatable `group` directive
in `nasher.cfg`. This makes it easy to, say, pack all haks in a project:

```toml
# To pack all targets: nasher pack all
# To pack only haks: nasher pack haks
[target]
name = "demo"
file = "demo.mod"

[target]
name = "hak1"
group = "haks"
file = "hak1.hak"

[target]
name = "hak2"
group = "haks"
file = "hak2.hak"
```

### `nasher list` can now list specific targets

`nasher list` can now limit its output to the named targets (e.g., `nasher list
demo`). The default behavior is to list all targets for backwards compatibility.
To list only the first target, use `nasher list ""`. Also supports target
groups.

### Fixed relative paths not working in exclude directories
([#90](https://github.com/squattingmonk/nasher/issues/90))

### Other

- nasher commands now support the `--` operator, which causes all arguments that
come after it to be treated as positional arguments even if they look like
options. For example: `nasher config -- nssFlags "-n /opt/nwn"` prevents the
`-n` from being treated as an option with the value `/opt/nwn`.
- `--noInstall` is now correctly treated as a flag that does not require a value

---

Details: https://github.com/squattingmonk/nasher/compare/0.17.4...0.18.0


## 0.17.4: May 12, 2022

Added better error handling for the `init` command. It now shows the error
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RUN dpkg --add-architecture i386 \
&& apt upgrade -y \
&& apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 -y \
&& rm -fr /var/lib/apt/lists/* /root/.cache/* /usr/share/doc/* /var/cache/man/*
ARG NASHER_VERSION="0.17.4"
ARG NASHER_VERSION="0.18.0"
ARG NASHER_USER_ID=1000
RUN adduser nasher --disabled-password --gecos "" --uid ${NASHER_USER_ID}
RUN echo "nasher ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && usermod -aG sudo nasher
Expand Down
2 changes: 1 addition & 1 deletion nasher.nimble
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Package

version = "0.17.4"
version = "0.18.0"
author = "Michael A. Sinclair"
description = "A build tool for Neverwinter Nights projects"
license = "MIT"
Expand Down

0 comments on commit 40c872c

Please sign in to comment.