trmnl_preview 0.21.0 → 0.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +14 -3
- data/lib/trmnlp/version.rb +1 -1
- data/templates/init/bin/trmnlp +19 -62
- data/templates/run_in_docker +66 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: abbaf54f1f6ccdb3a4b76b1be3d43b574a74c06f63c59e493c4a1b7e2a409bc3
|
|
4
|
+
data.tar.gz: 4275a70d54b9456786a149bbc43ff778357e06d99bc70be516b89bdf240c1509
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3931b0a7a91a3f2c8fc1eafc72211a799bf980baa7575fb1af1000fe1666b8e846acc6af68a50107349d7e887d46c0b5d01a67be535682c5f5844be43decd050
|
|
7
|
+
data.tar.gz: 1318426dd6a23949218f826bb4cdcb926914856f4f00447eb5b3a18565c496ab2920e1b5bf06e7952b3ccf578204108834ec3a5b789f98404f9f58d1b71b2cee
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
|
|
2
2
|
# Changelog
|
|
3
3
|
|
|
4
|
+
## 0.22.1
|
|
5
|
+
|
|
6
|
+
- The Docker image runs liquid 5.14 and selenium-webdriver 4.50, as TRMNL does. It had 5.13 and 4.48, so Liquid output could differ from TRMNL. Installs of the gem already took the newer versions.
|
|
7
|
+
|
|
8
|
+
## 0.22.0
|
|
9
|
+
|
|
10
|
+
- The `bin/trmnlp` script that `trmnlp init` writes takes the steps that run the Docker image from the image, once a day, so a fix to them reaches every plugin with the image. Before, each plugin kept its own copy, which changed only when `trmnlp init` ran again. A plugin made before this release gets the new script from `trmnlp init <its folder>`, answering `y` for `bin/trmnlp` only, once.
|
|
11
|
+
|
|
4
12
|
## 0.21.0
|
|
5
13
|
|
|
6
14
|
- The `bin/trmnlp` script that `trmnlp init` writes pulls a newer `trmnl/trmnlp` image once a day, so a Docker user stays on the latest release. Before, it ran whatever image was pulled first. The README shows how to install the script as `trmnlp` with Docker alone.
|
data/README.md
CHANGED
|
@@ -253,9 +253,10 @@ docker run --rm --entrypoint cat trmnl/trmnlp /app/templates/init/bin/trmnlp > ~
|
|
|
253
253
|
chmod +x ~/.local/bin/trmnlp
|
|
254
254
|
```
|
|
255
255
|
|
|
256
|
-
It runs each command in the image and pulls a newer image once a day.
|
|
257
|
-
|
|
258
|
-
|
|
256
|
+
It runs each command in the image and pulls a newer image once a day. The steps that run the image
|
|
257
|
+
come from the image too, so the script itself does not go out of date. To stay on one release, set
|
|
258
|
+
`IMAGE` in the script to a tag such as `trmnl/trmnlp:v0.22.0` (v0.22.0 or later). `trmnlp init` puts
|
|
259
|
+
the same script in each plugin as `bin/trmnlp`.
|
|
259
260
|
|
|
260
261
|
Or run the image yourself:
|
|
261
262
|
|
|
@@ -549,6 +550,16 @@ To cut a release:
|
|
|
549
550
|
|
|
550
551
|
By convention, add a matching `CHANGELOG.md` entry in the same change.
|
|
551
552
|
|
|
553
|
+
## Related guides
|
|
554
|
+
|
|
555
|
+
- [Private Plugins](https://help.trmnl.com/en/articles/9510536-private-plugins): strategies, polling and webhooks
|
|
556
|
+
- [Liquid 101](https://help.trmnl.com/en/articles/10671186-liquid-101) and the [Framework Design Docs](https://help.trmnl.com/en/articles/12410486-framework-design-docs)
|
|
557
|
+
- [Custom plugin form builder](https://help.trmnl.com/en/articles/10513740-custom-plugin-form-builder): the form fields `src/settings.yml` declares
|
|
558
|
+
- [Syncing Plugins with GitHub](https://help.trmnl.com/en/articles/13465101-syncing-plugins-with-github) and [GitHub Sync](https://help.trmnl.com/en/articles/15977899-github-sync)
|
|
559
|
+
- [Recipe best practices](https://help.trmnl.com/en/articles/11395668-recipe-best-practices) and [Demo Data for Publishing Plugins](https://help.trmnl.com/en/articles/12772238-demo-data-for-publishing-plugins)
|
|
560
|
+
- [TRMNL CLI](https://help.trmnl.com/en/articles/17226209-trmnl-cli): the rest of your account from the terminal
|
|
561
|
+
- [MCP Server](https://help.trmnl.com/en/articles/17432548-mcp-server) and our [agent skills](https://github.com/usetrmnl/trmnl-agent-skills): build plugins with an AI agent
|
|
562
|
+
|
|
552
563
|
## Contributing
|
|
553
564
|
|
|
554
565
|
Bug reports and pull requests are welcome on GitHub at https://github.com/usetrmnl/trmnlp.
|
data/lib/trmnlp/version.rb
CHANGED
data/templates/init/bin/trmnlp
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
# Use this opportunity to set up environment variables, install dependencies, etc.
|
|
5
5
|
#
|
|
6
6
|
|
|
7
|
+
# Add a tag to stay on one release, v0.22.0 or later: trmnl/trmnlp:v0.22.0
|
|
8
|
+
IMAGE=trmnl/trmnlp
|
|
9
|
+
|
|
7
10
|
# Saved on the PATH as `trmnlp`, this script is what `command -v trmnlp` finds: not a gem.
|
|
8
11
|
GEM="$(command -v trmnlp)"
|
|
9
12
|
if [ -n "$GEM" ] && ! [ "$GEM" -ef "$0" ]
|
|
@@ -23,71 +26,25 @@ Or install Docker:
|
|
|
23
26
|
exit 1
|
|
24
27
|
fi
|
|
25
28
|
|
|
26
|
-
#
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
else
|
|
30
|
-
CONFIG_DIR="$HOME/.config/trmnlp"
|
|
31
|
-
fi
|
|
32
|
-
|
|
33
|
-
# What trmnlp caches is kept as well: a plugin's OAuth tokens, its saved data and transform state.
|
|
29
|
+
# The steps that run the image live in the image, so this copy in the plugin never goes out of date.
|
|
30
|
+
# Once a day a newer image is pulled and those steps are taken from it. With no network, the image
|
|
31
|
+
# already here is used.
|
|
34
32
|
CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/trmnl"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
# Add a tag to stay on one release: trmnl/trmnlp:v0.20.0
|
|
39
|
-
IMAGE=trmnl/trmnlp
|
|
40
|
-
|
|
41
|
-
# A newer release is pulled once a day. With no network, the image already here runs.
|
|
42
|
-
PULLED_AT="$CACHE_DIR/image_pulled"
|
|
43
|
-
if [ -z "$(find "$PULLED_AT" -mtime -1 2> /dev/null)" ]; then
|
|
33
|
+
RUN_IN_DOCKER="$CACHE_DIR/run_in_docker/${IMAGE//[^a-zA-Z0-9._-]/_}"
|
|
34
|
+
if [ -z "$(find "$RUN_IN_DOCKER" -mtime -1 2> /dev/null)" ]; then
|
|
35
|
+
mkdir -p "$(dirname "$RUN_IN_DOCKER")"
|
|
44
36
|
docker pull --quiet "$IMAGE" > /dev/null 2>&1
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
CONTAINER_HOME=/root
|
|
52
|
-
SECURITY="$(docker info --format '{{.SecurityOptions}}' 2> /dev/null)"
|
|
53
|
-
if [ "$(uname)" = Linux ] && [ "$(id -u)" != 0 ] && [ -n "$SECURITY" ] && [[ "$SECURITY" != *rootless* ]]
|
|
54
|
-
then
|
|
55
|
-
CONTAINER_HOME=/tmp/home
|
|
56
|
-
# .config and .cache are made for you as well: Docker would make them root's to mount the
|
|
57
|
-
# folders below into them, and Firefox hangs when it cannot write there.
|
|
58
|
-
ARGS=(
|
|
59
|
-
--user "$(id -u):$(id -g)"
|
|
60
|
-
--env HOME=/tmp/home
|
|
61
|
-
--tmpfs "/tmp/home:exec,uid=$(id -u),gid=$(id -g)"
|
|
62
|
-
--tmpfs "/tmp/home/.config:uid=$(id -u),gid=$(id -g)"
|
|
63
|
-
--tmpfs "/tmp/home/.cache:exec,uid=$(id -u),gid=$(id -g)"
|
|
64
|
-
)
|
|
37
|
+
if docker run --rm --entrypoint cat "$IMAGE" /app/templates/run_in_docker > "$RUN_IN_DOCKER.$$" 2> /dev/null
|
|
38
|
+
then
|
|
39
|
+
mv "$RUN_IN_DOCKER.$$" "$RUN_IN_DOCKER"
|
|
40
|
+
else
|
|
41
|
+
rm -f "$RUN_IN_DOCKER.$$"
|
|
42
|
+
fi
|
|
65
43
|
fi
|
|
66
44
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
fi
|
|
71
|
-
|
|
72
|
-
# Only serve listens, so every other command can run next to it.
|
|
73
|
-
if [ "$1" = serve ]; then
|
|
74
|
-
PORT=4567
|
|
75
|
-
for ARG in "$@"; do
|
|
76
|
-
case "$PREVIOUS" in -p | --port) PORT="$ARG" ;; esac
|
|
77
|
-
case "$ARG" in --port=*) PORT="${ARG#--port=}" ;; esac
|
|
78
|
-
PREVIOUS="$ARG"
|
|
79
|
-
done
|
|
80
|
-
ARGS+=(--publish "$PORT:$PORT")
|
|
45
|
+
if ! [ -s "$RUN_IN_DOCKER" ]; then
|
|
46
|
+
echo "Could not run $IMAGE. Check that Docker is running and that the image is v0.22.0 or later."
|
|
47
|
+
exit 1
|
|
81
48
|
fi
|
|
82
49
|
|
|
83
|
-
exec
|
|
84
|
-
--rm \
|
|
85
|
-
--init \
|
|
86
|
-
--interactive \
|
|
87
|
-
"${ARGS[@]}" \
|
|
88
|
-
--env CI \
|
|
89
|
-
--env TRMNL_API_KEY \
|
|
90
|
-
--volume "$CONFIG_DIR:$CONTAINER_HOME/.config/trmnlp" \
|
|
91
|
-
--volume "$CACHE_DIR:$CONTAINER_HOME/.cache/trmnl" \
|
|
92
|
-
--volume "$(pwd):/plugin" \
|
|
93
|
-
"$IMAGE" "$@"
|
|
50
|
+
IMAGE="$IMAGE" exec bash "$RUN_IN_DOCKER" "$@"
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
#
|
|
3
|
+
# Runs a trmnlp command in the Docker image. The bin/trmnlp script that `trmnlp init` writes takes
|
|
4
|
+
# this file from the image once a day, so a fix here reaches every plugin with the image.
|
|
5
|
+
#
|
|
6
|
+
|
|
7
|
+
IMAGE="${IMAGE:-trmnl/trmnlp}"
|
|
8
|
+
|
|
9
|
+
# Determine XDG config directory on host OS
|
|
10
|
+
if [ -n "$XDG_CONFIG_HOME" ]; then
|
|
11
|
+
CONFIG_DIR="$XDG_CONFIG_HOME/trmnlp"
|
|
12
|
+
else
|
|
13
|
+
CONFIG_DIR="$HOME/.config/trmnlp"
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
# What trmnlp caches is kept as well: a plugin's OAuth tokens, its saved data and transform state.
|
|
17
|
+
CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/trmnl"
|
|
18
|
+
|
|
19
|
+
mkdir -p "$CONFIG_DIR" "$CACHE_DIR"
|
|
20
|
+
|
|
21
|
+
# On Linux the container's root is the host's root, and the files trmnlp writes (snapshots, _build,
|
|
22
|
+
# a pulled plugin) would be root's. So trmnlp runs as you, with a home of its own to write in.
|
|
23
|
+
# Docker Desktop and rootless Docker hand the files to you already.
|
|
24
|
+
CONTAINER_HOME=/root
|
|
25
|
+
SECURITY="$(docker info --format '{{.SecurityOptions}}' 2> /dev/null)"
|
|
26
|
+
if [ "$(uname)" = Linux ] && [ "$(id -u)" != 0 ] && [ -n "$SECURITY" ] && [[ "$SECURITY" != *rootless* ]]
|
|
27
|
+
then
|
|
28
|
+
CONTAINER_HOME=/tmp/home
|
|
29
|
+
# .config and .cache are made for you as well: Docker would make them root's to mount the
|
|
30
|
+
# folders below into them, and Firefox hangs when it cannot write there.
|
|
31
|
+
ARGS=(
|
|
32
|
+
--user "$(id -u):$(id -g)"
|
|
33
|
+
--env HOME=/tmp/home
|
|
34
|
+
--tmpfs "/tmp/home:exec,uid=$(id -u),gid=$(id -g)"
|
|
35
|
+
--tmpfs "/tmp/home/.config:uid=$(id -u),gid=$(id -g)"
|
|
36
|
+
--tmpfs "/tmp/home/.cache:exec,uid=$(id -u),gid=$(id -g)"
|
|
37
|
+
)
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
# A terminal only when there is one: CI and scripts have none.
|
|
41
|
+
if [ -t 0 ] && [ -t 1 ]; then
|
|
42
|
+
ARGS+=(--tty)
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
# Only serve listens, so every other command can run next to it.
|
|
46
|
+
if [ "$1" = serve ]; then
|
|
47
|
+
PORT=4567
|
|
48
|
+
for ARG in "$@"; do
|
|
49
|
+
case "$PREVIOUS" in -p | --port) PORT="$ARG" ;; esac
|
|
50
|
+
case "$ARG" in --port=*) PORT="${ARG#--port=}" ;; esac
|
|
51
|
+
PREVIOUS="$ARG"
|
|
52
|
+
done
|
|
53
|
+
ARGS+=(--publish "$PORT:$PORT")
|
|
54
|
+
fi
|
|
55
|
+
|
|
56
|
+
exec docker run \
|
|
57
|
+
--rm \
|
|
58
|
+
--init \
|
|
59
|
+
--interactive \
|
|
60
|
+
"${ARGS[@]}" \
|
|
61
|
+
--env CI \
|
|
62
|
+
--env TRMNL_API_KEY \
|
|
63
|
+
--volume "$CONFIG_DIR:$CONTAINER_HOME/.config/trmnlp" \
|
|
64
|
+
--volume "$CACHE_DIR:$CONTAINER_HOME/.cache/trmnl" \
|
|
65
|
+
--volume "$(pwd):/plugin" \
|
|
66
|
+
"$IMAGE" "$@"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: trmnl_preview
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.22.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rockwell Schrock
|
|
@@ -502,6 +502,7 @@ files:
|
|
|
502
502
|
- templates/init/src/shared.liquid
|
|
503
503
|
- templates/init/src/transform.py.example
|
|
504
504
|
- templates/init/tests/plugin_spec.rb
|
|
505
|
+
- templates/run_in_docker
|
|
505
506
|
- trmnl_preview.gemspec
|
|
506
507
|
- web/public/highlight/highlight.min.js
|
|
507
508
|
- web/public/highlight/styles/atom-one-dark.min.css
|