dante 0.2.0 → 0.4.0

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 CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NWJkYTJiOTVkOWY1OTYzMzFhNGFmMzIzZmM5YjI0NWMxMzIxY2UwYQ==
5
- data.tar.gz: !binary |-
6
- NTViMjBkMGYwYWM2ZDE2YjBlMzJiZWQ1YjFlZDU0OWM2YWUzODU4NQ==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- MzIwNDBlMGNjY2Y0YmQwMjEzNzMzMjU4MmE4Y2ZkNDhhNTUwMDg5NmRlNWEy
10
- ZDY3MWE5NjZiYTE4Y2U3NzFiZDA5ZmZmMWM4YTdkZGU0ZjBkMTI4MjEyMGFm
11
- YjVhNTY1NjJhMjY4MjA0NmNjY2JjN2Q1MjdmNTNhMDZjMWQ3NWM=
12
- data.tar.gz: !binary |-
13
- YmQ4YTExNDIxYzc3YWUzNDA0MjBjMzUzYTcyMjI5NTY1OGM5YTQwOWJlYjZk
14
- NThhNWRiYTM5ZmQ0MGVjOTlkNmVhZTgwOTM1ZWNhY2FjNjVjMWI2NmM5Mjhh
15
- NmRlMzE3Y2JlMmQ5Yzg5YWMzOTAzNjg1MjJiYzg3NDc3MDY2NzU=
2
+ SHA256:
3
+ metadata.gz: 91147e1905316ceab12eff8d686555b8f2daa27d81d5065ab11d9b44e8594a2a
4
+ data.tar.gz: 2d385615f43931b2f3375dce1a32ccaa6655111722e208461adb44e850e26435
5
+ SHA512:
6
+ metadata.gz: 22daf007c266f02863001eaca06415e7ab8711083e9cde13fee5be196f4fbeae5af9382fc58410952df1ad8702c3cb1d2caa3f1a47faf971740973c2656a729d
7
+ data.tar.gz: b06a655e3de739bb52ec35163d6000bed1903c83a7ee37639ff5cf5e43edaf7a65074e902612c36d5b92008db51289400031a4c6c6c7dbe03dca294871fc26cb
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "github-actions"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
@@ -0,0 +1,30 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ "master" ]
6
+ pull_request:
7
+ branches: [ "master" ]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ test:
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ ruby-version: ['2.7', '3.0', '3.1', '3.2', '3.3', '3.4', '4.0']
19
+
20
+ steps:
21
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
22
+ - name: Set up Ruby
23
+ uses: ruby/setup-ruby@de492cf36cbab201753d720ce4f4e336cd688c94 # v1.336.0
24
+ with:
25
+ ruby-version: ${{ matrix.ruby-version }}
26
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
27
+ - name: Run tests
28
+ run: bundle exec rake test
29
+ - name: Run the user and group switching tests as root
30
+ run: sudo -E env "PATH=$PATH" bundle exec ruby -Ilib -Itest test/user_switch_test.rb
@@ -0,0 +1,69 @@
1
+ # Creates the GitHub release page for a tag that already exists, with GitHub's generated notes (merged
2
+ # PRs and new contributors since the previous release) after a link to CHANGELOG.md as of that tag (the
3
+ # default branch's for an old tag that has none).
4
+ # release.yml runs it after it publishes; "Run workflow" here (with the tag) creates the page for an
5
+ # earlier release. A tag that already has a release is left alone, so running it twice is harmless.
6
+ # A tag that isn't the newest vX.Y.Z tag is created with --latest=false; the API otherwise marks every
7
+ # new release as Latest.
8
+
9
+ name: github-release
10
+ run-name: github release ${{ inputs.tag }}
11
+
12
+ on:
13
+ workflow_dispatch:
14
+ inputs:
15
+ tag:
16
+ description: 'An existing tag, e.g. v1.2.0'
17
+ required: true
18
+ type: string
19
+ workflow_call:
20
+ inputs:
21
+ tag:
22
+ required: true
23
+ type: string
24
+
25
+ permissions:
26
+ contents: read
27
+
28
+ jobs:
29
+ release-page:
30
+ if: github.repository == 'nesquena/dante'
31
+ runs-on: ubuntu-latest
32
+ permissions:
33
+ contents: write # creates the release
34
+ steps:
35
+ - name: Create the GitHub release
36
+ shell: bash -eo pipefail {0}
37
+ env:
38
+ TAG: ${{ inputs.tag }}
39
+ CHANGELOG: CHANGELOG.md
40
+ GH_TOKEN: ${{ github.token }}
41
+ run: |
42
+ [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "::error::'$TAG' is not a tag like v1.2.3"; exit 1; }
43
+ if gh release view "$TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
44
+ echo "$TAG already has a release; leaving it alone"
45
+ exit 0
46
+ fi
47
+ # Compare with the newest vX.Y.Z tag rather than the "Latest" release, so a failed lookup stops the
48
+ # step (pipefail) instead of letting an older tag become Latest
49
+ newest=$(gh api --paginate "repos/$GITHUB_REPOSITORY/git/matching-refs/tags/v" --jq '.[].ref' |
50
+ sed -nE 's#^refs/tags/(v[0-9]+\.[0-9]+\.[0-9]+)$#\1#p' | sort -V | tail -n 1) ||
51
+ { echo "::error::could not list the repository's tags"; exit 1; }
52
+ [ -n "$newest" ] || { echo "::error::found no vX.Y.Z tag (is $TAG pushed?)"; exit 1; }
53
+ flags=()
54
+ if [ "$newest" != "$TAG" ]; then
55
+ echo "$TAG is not the newest tag ($newest): not marking it as latest"
56
+ flags=(--latest=false)
57
+ fi
58
+ # Link the changelog as of the tag, or the default branch's for an old tag without one. Any error
59
+ # but a 404 stops the step.
60
+ ref=$TAG
61
+ if ! err=$(gh api "repos/$GITHUB_REPOSITORY/contents/$CHANGELOG?ref=$TAG" --silent 2>&1 >/dev/null); then
62
+ [[ "$err" == *"HTTP 404"* ]] || { echo "::error::could not look up $CHANGELOG at $TAG: $err"; exit 1; }
63
+ echo "$TAG has no $CHANGELOG; linking the default branch's"
64
+ ref=HEAD
65
+ fi
66
+ # --verify-tag: refuse rather than create the tag. With --generate-notes, GitHub puts these notes
67
+ # before the generated ones.
68
+ gh release create "$TAG" --repo "$GITHUB_REPOSITORY" --verify-tag --title "$TAG" --generate-notes "${flags[@]}" \
69
+ --notes "What changed, and what to do when upgrading: [$CHANGELOG](https://github.com/$GITHUB_REPOSITORY/blob/$ref/$CHANGELOG)."
@@ -0,0 +1,221 @@
1
+ # Publishes a dante release to rubygems.org with trusted publishing, gated by the "release"
2
+ # environment: the owner approves each publish.
3
+ #
4
+ # Usual path: merge the release PR (the version in lib/dante/version.rb and the CHANGELOG.md heading
5
+ # stamped with the date, e.g. "## 0.3.0 (2026-11-01)"), then "Run workflow" on master with the
6
+ # version. build checks the version, that the changelog's first heading is that version with a date,
7
+ # and the branch, and builds the gem reproducibly; publish waits for approval, pushes the gem with
8
+ # short-lived trusted-publishing credentials, then creates the tag vX.Y.Z on the built commit. Pushing
9
+ # a vX.Y.Z tag on a master commit runs the same checks. "Re-run failed jobs" (not "Re-run all jobs",
10
+ # which rebuilds) resumes a release that stopped partway.
11
+ # If the gem is pushed but the tag step keeps failing, push the tag by hand at the built commit: that
12
+ # tag push's run skips the push (same sum).
13
+ # Then github-release.yml creates the GitHub release page for the tag (it can also be run by hand for
14
+ # an earlier tag).
15
+ #
16
+ # Dry run: tick dry_run to check the wiring. Everything runs except the changelog checks, the tag, the
17
+ # push and the release page; the credential exchange fails unless the trusted publisher is set up.
18
+ #
19
+ # The "release" environment's protection rules are the ONLY gate on publishing (required reviewer, no
20
+ # admin bypass, deployments only from master and v*.*.* tags): RubyGems trusts any run of this file
21
+ # that uses that environment, and a branch or tag can carry its own modified copy of it. The trusted
22
+ # publisher on rubygems.org must name the environment. Before approving a deployment, check
23
+ # who started the run, the event, that the commit is the release PR's merge commit, and the build
24
+ # log's "is on master" line. Reject any run you won't approve: a waiting run blocks the next one.
25
+ # A deployment rule for X.Y-stable lets anyone with write access create such a branch carrying its own
26
+ # copy of this file: add one only for a maintenance release, and remove it after.
27
+
28
+ name: release
29
+ run-name: release ${{ inputs.version || github.ref_name }}${{ inputs.dry_run && ' (dry run)' || '' }}
30
+
31
+ on:
32
+ push:
33
+ tags: ['v[0-9]+.[0-9]+.[0-9]+']
34
+ workflow_dispatch:
35
+ inputs:
36
+ version:
37
+ description: 'Version to release (already in the version file of this branch), e.g. 1.2.0'
38
+ required: true
39
+ type: string
40
+ dry_run:
41
+ description: 'Dry run: check, build and exchange credentials, but create no tag and push nothing'
42
+ required: false
43
+ type: boolean
44
+ default: false
45
+
46
+ permissions:
47
+ contents: read
48
+
49
+ concurrency:
50
+ group: release
51
+ cancel-in-progress: false
52
+
53
+ jobs:
54
+ build:
55
+ if: github.repository == 'nesquena/dante'
56
+ runs-on: ubuntu-latest
57
+ env:
58
+ TRUNK: master
59
+ TAG_PREFIX: v
60
+ GEMS: 'dante:.'
61
+ VERSION_FILE: lib/dante/version.rb
62
+ CHANGELOG: CHANGELOG.md
63
+ CHANGELOG_HEADING: '^## '
64
+ CHANGELOG_TOP: '^## ([0-9]+\.[0-9]+\.[0-9]+)( |$)'
65
+ outputs:
66
+ version: ${{ steps.check.outputs.version }}
67
+ tag: ${{ steps.check.outputs.tag }}
68
+ steps:
69
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
70
+ with:
71
+ fetch-depth: 0
72
+ submodules: true
73
+ persist-credentials: false
74
+ - uses: ruby/setup-ruby@de492cf36cbab201753d720ce4f4e336cd688c94 # v1.336.0
75
+ with:
76
+ ruby-version: '3.3'
77
+ - name: Check the version
78
+ id: check
79
+ shell: bash -eo pipefail {0}
80
+ env:
81
+ INPUT_VERSION: ${{ inputs.version }}
82
+ DRY_RUN: ${{ inputs.dry_run }}
83
+ run: |
84
+ if [ "$GITHUB_EVENT_NAME" = workflow_dispatch ]; then
85
+ version="$INPUT_VERSION"
86
+ [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "::error::the version input is not a plain version like 1.2.3"; exit 1; }
87
+ case "$GITHUB_REF" in
88
+ "refs/heads/$TRUNK"|"refs/heads/${version%.*}-stable") ;;
89
+ *) echo "::error::run this on $TRUNK or ${version%.*}-stable, not $GITHUB_REF"; exit 1 ;;
90
+ esac
91
+ tag="$TAG_PREFIX$version"
92
+ tagged=$(git ls-remote origin "refs/tags/$tag*" | awk -v t="refs/tags/$tag" '$2 == t || $2 == t "^{}" { print $1 }')
93
+ [ -z "$tagged" ] || echo "$tagged" | grep -qx "$GITHUB_SHA" ||
94
+ { echo "::error::tag $tag already exists at another commit"; exit 1; }
95
+ else
96
+ tag="$GITHUB_REF_NAME"
97
+ version="${tag#"$TAG_PREFIX"}"
98
+ [[ "$tag" == "$TAG_PREFIX"* && "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "::error::tag $tag is not ${TAG_PREFIX}X.Y.Z"; exit 1; }
99
+ fi
100
+ file_version=$(ruby -e 'puts File.binread(ENV["VERSION_FILE"])[/\bVERSION\s*=\s*["\x27]([^"\x27]+)/, 1]')
101
+ [ "$version" = "$file_version" ] || { echo "::error::version $version but $VERSION_FILE says $file_version"; exit 1; }
102
+ if [ "$DRY_RUN" = true ]; then
103
+ echo "::warning::dry run: not checking $CHANGELOG"
104
+ else
105
+ heading=$(grep -m1 -E "$CHANGELOG_HEADING" "$CHANGELOG") || { echo "::error::$CHANGELOG has no heading matching '$CHANGELOG_HEADING'"; exit 1; }
106
+ top=$(echo "$heading" | sed -nE "s/$CHANGELOG_TOP.*/\1/p")
107
+ [ "$top" = "$version" ] || { echo "::error::$CHANGELOG starts with '$heading', not release $version: merge the release PR first, and nothing after it"; exit 1; }
108
+ rest="${heading#*"$version"}"
109
+ [[ "$rest" =~ (19|20)[0-9][0-9] ]] && ! echo "$rest" | grep -qiwE 'unreleased|tbd|tba' ||
110
+ { echo "::error::$CHANGELOG's '$heading' isn't stamped with a date yet"; exit 1; }
111
+ fi
112
+ series="${version%.*}-stable"
113
+ on=""
114
+ for b in "$series" "$TRUNK"; do
115
+ git merge-base --is-ancestor "$GITHUB_SHA" "refs/remotes/origin/$b" 2>/dev/null && on="$b"
116
+ done
117
+ [ -n "$on" ] || { echo "::error::$version ($GITHUB_SHA) is not on $TRUNK or $series"; exit 1; }
118
+ echo "version=$version" >> "$GITHUB_OUTPUT"
119
+ echo "tag=$tag" >> "$GITHUB_OUTPUT"
120
+ echo "$version ($GITHUB_SHA) is on $on"
121
+ - name: Build the gems
122
+ shell: bash -eo pipefail {0}
123
+ env:
124
+ VERSION: ${{ steps.check.outputs.version }}
125
+ run: |
126
+ SOURCE_DATE_EPOCH=$(git log -1 --format=%ct "$GITHUB_SHA"); export SOURCE_DATE_EPOCH
127
+ mkdir dist
128
+ for spec in $GEMS; do
129
+ g="${spec%%:*}"; dir="${spec#*:}"; [ "$dir" = "$spec" ] && dir=.
130
+ out="$GITHUB_WORKSPACE/dist/$g-$VERSION.gem"
131
+ (cd "$dir" && gem build "$g.gemspec" --output "$out")
132
+ [ "$(gem spec "$out" name)" = "--- $g" ] && [ "$(gem spec "$out" version | sed -n 's/^version: //p')" = "$VERSION" ] ||
133
+ { echo "::error::$out is not $g $VERSION:"; gem spec "$out" name; gem spec "$out" version; exit 1; }
134
+ echo "$g" >> dist/ORDER
135
+ done
136
+ echo "SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH (ruby $(ruby -e 'print RUBY_VERSION'), rubygems $(gem -v))"
137
+ (cd dist && sha256sum *.gem > SHA256SUMS && cat ORDER SHA256SUMS)
138
+ - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
139
+ with:
140
+ name: gems-${{ steps.check.outputs.version }}
141
+ path: dist/
142
+ if-no-files-found: error
143
+
144
+ publish:
145
+ needs: build
146
+ runs-on: ubuntu-latest
147
+ environment: release
148
+ permissions:
149
+ contents: write # creates the tag on a dispatched release
150
+ id-token: write # the RubyGems trusted-publishing exchange
151
+ steps:
152
+ - name: Refuse a stale run (the tag is somewhere else)
153
+ shell: bash -eo pipefail {0}
154
+ env:
155
+ TAG: ${{ needs.build.outputs.tag }}
156
+ run: |
157
+ tagged=$(git ls-remote "https://github.com/$GITHUB_REPOSITORY" "refs/tags/$TAG*" |
158
+ awk -v t="refs/tags/$TAG" '$2 == t || $2 == t "^{}" { print $1 }')
159
+ if [ -z "$tagged" ] && [ "$GITHUB_EVENT_NAME" = workflow_dispatch ]; then
160
+ echo "tag $TAG will be created at $GITHUB_SHA"
161
+ else
162
+ echo "$tagged" | grep -qx "$GITHUB_SHA" || { echo "::error::tag $TAG is not at $GITHUB_SHA (now: ${tagged:-gone}); this run is stale"; exit 1; }
163
+ fi
164
+ - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
165
+ with:
166
+ name: gems-${{ needs.build.outputs.version }}
167
+ path: dist
168
+ - name: Check the sums
169
+ working-directory: dist
170
+ run: sha256sum -c SHA256SUMS
171
+ - uses: ruby/setup-ruby@de492cf36cbab201753d720ce4f4e336cd688c94 # v1.336.0
172
+ with:
173
+ ruby-version: '3.3'
174
+ - uses: rubygems/configure-rubygems-credentials@dc5a8d8553e6ee01fc26761a49e99e733d17954a # v2.1.0
175
+ - name: Dry run ends here
176
+ if: inputs.dry_run
177
+ run: echo "Credentials exchange succeeded, so the trusted publisher works. No tag created, nothing pushed."
178
+ - name: Push the gems
179
+ if: ${{ !inputs.dry_run }}
180
+ shell: bash -eo pipefail {0}
181
+ working-directory: dist
182
+ env:
183
+ VERSION: ${{ needs.build.outputs.version }}
184
+ run: |
185
+ while read -r g; do
186
+ sum=$(sha256sum "$g-$VERSION.gem" | cut -d' ' -f1)
187
+ published=$(curl -fsS "https://rubygems.org/api/v1/versions/$g.json" 2>/dev/null |
188
+ ruby -rjson -e 'b = $stdin.read; v = (b.empty? ? [] : JSON.parse(b)).find { |x| x["number"] == ENV["VERSION"] && x["platform"] == "ruby" }; print v ? v["sha"].to_s : ""' || true)
189
+ if [ -z "$published" ]; then
190
+ gem push "$g-$VERSION.gem" </dev/null
191
+ elif [ "$published" = "$sum" ]; then
192
+ echo "$g $VERSION is already on rubygems.org with this sum; skipping"
193
+ else
194
+ echo "::error::$g $VERSION is already on rubygems.org with sha256 $published, not this build's $sum"; exit 1
195
+ fi
196
+ done < ORDER
197
+ - name: Create the tag
198
+ if: github.event_name == 'workflow_dispatch' && !inputs.dry_run
199
+ shell: bash -eo pipefail {0}
200
+ env:
201
+ TAG: ${{ needs.build.outputs.tag }}
202
+ GH_TOKEN: ${{ github.token }}
203
+ run: |
204
+ tagged=$(git ls-remote "https://github.com/$GITHUB_REPOSITORY" "refs/tags/$TAG*" |
205
+ awk -v t="refs/tags/$TAG" '$2 == t || $2 == t "^{}" { print $1 }')
206
+ if [ -z "$tagged" ]; then
207
+ gh api "repos/$GITHUB_REPOSITORY/git/refs" -f ref="refs/tags/$TAG" -f sha="$GITHUB_SHA"
208
+ elif echo "$tagged" | grep -qx "$GITHUB_SHA"; then
209
+ echo "tag $TAG is already at $GITHUB_SHA"
210
+ else
211
+ echo "::error::tag $TAG is not at $GITHUB_SHA (now: $tagged)"; exit 1
212
+ fi
213
+
214
+ release-page:
215
+ needs: [build, publish]
216
+ if: ${{ !inputs.dry_run }}
217
+ permissions:
218
+ contents: write # github-release.yml creates the release
219
+ uses: ./.github/workflows/github-release.yml
220
+ with:
221
+ tag: ${{ needs.build.outputs.tag }}
data/CHANGELOG.md ADDED
@@ -0,0 +1,153 @@
1
+ # Changelog
2
+
3
+ ## 0.4.0 (2026-11-01)
4
+
5
+ Changes since 0.3.0:
6
+
7
+ - Fixed: the daemon writes its pid file to a new file in the same directory and renames it into place, so a
8
+ symlink or another file already at the pid file's path is replaced instead of written through, and a reader
9
+ never sees a half-written pid file. The pid file now always belongs to the daemon's user, with mode 0666 less
10
+ the umask; an existing pid file used to keep its owner and mode. In a directory the daemon's user cannot write
11
+ (a pid file an init script created and handed to that user, say), it writes the existing pid file in place as
12
+ before, except through a symlink. **What to do:** if another user's tool reads the pid file (a monitor such as
13
+ god), start the daemon with a umask that leaves it readable (022 gives 0644). (#31, @nesquena)
14
+ - Fixed: stopping (`-k`, `stop`) and `daemon_running?` ignore a pid file that another user could have written to
15
+ have the process it names stopped: a symlink, a file with other hard links, or a file owned by neither root, nor
16
+ the user stopping, nor any of the uids the process runs as. A stop then keeps the pid file and returns false,
17
+ saying "No <name> processes are running" for a symlink and why for the others (for one, "pid file X is owned by
18
+ uid A but process P belongs to uid B; not stopping it"), and a start goes ahead and replaces the pid file. The owner is checked through `/proc` (Linux); elsewhere only symlinks and
19
+ hard links are. **What to do:** nothing for pid files the daemon writes itself, including a daemon started with
20
+ `sudo ... -u nobody` and stopped with `sudo ... -k`; a pid file written by another tool must be a plain file
21
+ belonging to root or to the daemon's user. (#31, @nesquena)
22
+ - Fixed: the log file is no longer given mode 0644 at every start. An existing log file keeps its mode (through a
23
+ symlinked log path, so does the file it points to), and a new one is created with mode 0644 less the umask:
24
+ 0644 with the usual umask of 022, 0640 with 027. **What to do:** for a log file other users can read under a
25
+ stricter umask, create it with the mode you want before starting, or set the umask. (#31, @nesquena)
26
+ - New `:argv` option: `Dante::Runner.new(name, :argv => [...])`, `Dante.run(name, :argv => [...])` or
27
+ `execute(:argv => [...])` parses the options in that array instead of `ARGV`, so dante can run inside a program
28
+ that has options of its own (a test runner, for one) without failing on them; `:argv => []` parses nothing. The
29
+ array is not changed. Without `:argv`, `ARGV` is parsed as before. Reported by @neomantic-zz in #4.
30
+ (#33, @nesquena)
31
+ - Fixed: a daemon's standard input is now `/dev/null`. It stayed on the terminal or pipe it was started from, so a
32
+ daemon reading stdin read the user's keystrokes, and a terminal or pty that started it never saw end-of-file
33
+ while the daemon ran. (#30, @nesquena)
34
+ - Fixed: stopping (`-k`, `stop`) reads the pid file once, then signals and waits for that daemon, and removes the
35
+ pid file only if it still names it. Two stops at once no longer fail with `Errno::ENOENT`; a new daemon that
36
+ records its pid while an old one stops keeps its pid file, and `--force` no longer sends it SIGKILL. A pid file
37
+ path containing `[`, `*` or `?` can now be stopped. The `-k` help text now says what it does: it stops the daemon
38
+ in the pid file, and ignores its optional argument. (#30, @nesquena)
39
+ - Fixed: stopping checks whether the daemon has exited every 0.1 seconds instead of every second, so `-k` returns
40
+ as soon as the daemon has stopped rather than after a second at least. It still waits up to 5 seconds (and 5
41
+ more with `--force`). (#30, @nesquena)
42
+ - Fixed: `:kill => false` and `:restart => false` passed to `execute` are now off. Before, giving either key at
43
+ all stopped the daemon (`:kill`) or stopped and restarted it (`:restart`), whatever its value. `:kill => nil`, as
44
+ `-k` sets it, still stops. (#30, @nesquena)
45
+ - Fixed: `:daemonize => false` with a `:log_path` now writes the output to the log file, as leaving `:daemonize`
46
+ out does; before, the log path was ignored. (#30, @nesquena)
47
+ - Fixed: `Runner#restart` starts the service as a daemon when `:daemonize` is set, as `execute` does; it used to
48
+ run it in the foreground, in the calling process. **What to do:** to keep running the service in the calling
49
+ process, call `restart` on a runner without `:daemonize`. (#30, @nesquena)
50
+ - For subclasses of `Dante::Runner`: `stop` now reads the pid file and checks the process itself instead of calling
51
+ `daemon_running?` and `daemon_stopped?`, and the protected `kill_pid` and `wait_for_stop` now take the pid first
52
+ (`kill_pid(pid, k, sig)`, `wait_for_stop(pid, signalled)`). (#30, @nesquena)
53
+ - Documentation: the README's `-u nobody -G nogroup` example now gives pid and log paths that user can write (with
54
+ the defaults, the daemon failed to start), says what `-k` and `-f`/`--force` do, lists all the options, and adds
55
+ the requirements (MRI on Unix, for `fork`), running under systemd, and log rotation with `copytruncate` (SIGHUP
56
+ stops the daemon). (#30, @nesquena)
57
+ - The gemspec links the source code, this changelog and the issue tracker (shown on rubygems.org), and sets
58
+ `rubygems_mfa_required`, so pushes of the gem to rubygems.org now require MFA. (#30, @nesquena)
59
+
60
+ ## 0.3.0 (2026-10-31)
61
+
62
+ Changes since 0.2.0:
63
+
64
+ - **Ruby 2.7 or newer is now required** (the gemspec declares it). Stay on 0.2.0 for older Rubies. (#21, @nesquena)
65
+ - **New `-f`/`--force` option** (`:force => true`): when a stop's SIGTERM does not stop the daemon within 5 seconds,
66
+ dante sends SIGKILL. (#13, @hayesgm)
67
+ - **Changed: stopping keeps the pid file until the daemon has stopped.** `-k`/`stop` used to delete the pid file
68
+ before signalling; it now deletes it only once the daemon has exited, and keeps it (and says "Failed to kill
69
+ daemonized process") when the daemon survives. The log line is now "Sent SIGTERM to PID: ..." instead of
70
+ "Stopped PID: ...": update anything that matches the old text. (#13, @hayesgm)
71
+ - **Changed: user and group switching as root** (`-u`, `-G`, `:user`, `:group`). Everything is looked up before
72
+ anything changes. `-u` now takes the user's primary group (or the `-G` group) and the user's own supplementary
73
+ groups; before, the daemon kept gid 0 and root's supplementary groups. `-G` alone leaves only that group. If your
74
+ daemon relied on root's groups, add the user to the groups it needs or pass `-G`. Where root may not change its
75
+ groups (a restricted capability set, or a user namespace that denies setgroups), `-u` now fails at startup with
76
+ `Errno::EPERM`, as `su` does. A non-root process changes only what it was given, as before. (#22, @nesquena)
77
+ - **Changed: the daemon keeps the caller's umask** instead of setting it to 0000, so new files are 644 and
78
+ directories 755 under umask 022 (they were 666 and 777). If the daemon must create world-writable files, set
79
+ `File.umask` in the startup block. The log file stays 0644. (#22, @nesquena)
80
+ - **Changed: a daemon now counts as started only if it is still running 1 second after it was forked**, so
81
+ `-d` takes up to a second longer. A daemon that exits at once (its startup block raised, or returned) is now
82
+ reported as "Daemonized process couldn't be started", `daemonize` returns false, and the pid file it left is
83
+ removed; before, it could be reported as started, and its stale pid stayed in the pid file. The exit status of
84
+ your executable doesn't change (dante doesn't set it): to act on a failed start, check what `execute` returns.
85
+ (#24, @nesquena)
86
+ - **Changed: the process between the caller and the daemon no longer runs the program's `at_exit` handlers**; it
87
+ leaves with `exit!`, as Ruby's `Process.daemon` does. They used to run in the two intermediate processes right
88
+ after the fork, so a cleanup handler (stripe-ruby-mock's `kill_server`, say) ran there too. Handlers still run in
89
+ the caller and in the daemon; nothing to do unless you relied on that extra run. (#24, @nesquena)
90
+ - Fixed: output redirection when the standard streams are sockets (Spring, Zeus): output now goes to the log
91
+ instead of raising `can't change access mode`. Reported by @antonfefilov in #20. (#22, @nesquena)
92
+ - Fixed: a pid file naming another user's process no longer crashes with `Errno::EPERM`: starting prints "Process
93
+ is already started", and `-k` reports that it could not stop the process and keeps the pid file. (#22, @nesquena)
94
+ - Fixed: `-k` on another user's process gives up at once (in about 0.2 seconds) instead of waiting 5 seconds, or
95
+ 10 with `--force`, for a process it cannot signal. (#24, @nesquena)
96
+ - Fixed: an empty pid file (left by a crash between creating and writing it), or one holding 0 or a negative
97
+ number, counts as no daemon. Before, starting refused with "Process is already started", and `-k` sent SIGTERM
98
+ to its own process group, killing itself and the processes started alongside it. A number too large for a pid
99
+ counts as no daemon too, where it raised `RangeError`. (#24, @nesquena)
100
+ - Fixed: daemonizing from a program that ignores SIGCHLD (`trap('CHLD', 'IGNORE')`) raised `Errno::ECHILD`; it now
101
+ reports whether the daemon started. (#24, @nesquena)
102
+ - Fixed: INT and TERM are handled before the pid file is written, so a `-k` right after start goes through
103
+ dante's handler. (#22, @nesquena)
104
+ - The gemspec now declares the MIT license and points its homepage at github.com/nesquena/dante, and the
105
+ deprecated `rubyforge_project` setting is gone. (#27, @nesquena)
106
+ - Development: the test suite is reliable on current Ruby and minitest (mocha is no longer needed), `rake` runs
107
+ it, and GitHub Actions runs it on Ruby 2.7 to 4.0. Reported by @balasankarc in #19. (#21, #23, @nesquena)
108
+
109
+ ## 0.2.0 (2013-12-04)
110
+
111
+ - A `verify_options_hook` to validate options; daemon mode logs to `/var/log/<name>.log` by default; a log file
112
+ given in the foreground is used. (#7, #9, #10, @rkatti)
113
+ - The daemonizing process reaps its child, leaving no zombie. (#5, @jonigata)
114
+
115
+ ## 0.1.5 (2012-06-21)
116
+
117
+ - Fixes for `kill_pid`, `interrupt` and `log`. (@mckern)
118
+
119
+ ## 0.1.4 (2012-06-20)
120
+
121
+ - Fixed user and group switching and log redirection; cleaner shutdown message. (#1, @mckern)
122
+
123
+ ## 0.1.3 (2012-01-30)
124
+
125
+ - `-l`/`--log`: a log file for the daemon's output.
126
+
127
+ ## 0.1.2 (2011-12-06)
128
+
129
+ - `daemon_running?` and `daemon_stopped?` are public.
130
+
131
+ ## 0.1.1 (2011-12-06)
132
+
133
+ - Better handling of the debug option.
134
+
135
+ ## 0.1.0 (2011-12-06)
136
+
137
+ - A more robust runner: stops and starts are checked, and `restart` is added.
138
+
139
+ ## 0.0.4 (2011-11-30)
140
+
141
+ - Stopping sends INT instead of KILL. (@joshbuddy)
142
+
143
+ ## 0.0.3 (2011-11-30)
144
+
145
+ - Cleaner process stopping.
146
+
147
+ ## 0.0.2 (2011-11-28)
148
+
149
+ - Custom options (`with_options`), a custom banner, and options passed to the startup block.
150
+
151
+ ## 0.0.1 (2011-11-21)
152
+
153
+ - First release.
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source "http://rubygems.org"
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in dante.gemspec
4
4
  gemspec
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011 Miso
1
+ Copyright (c) 2011-2026 Nathan Esquenazi
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -17,4 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
17
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
18
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
19
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.