rake-osc7501 0.1.2 → 0.2.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 +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +26 -85
- data/lib/rake/osc7501/rspec_task.rb +1 -1
- data/lib/rake/osc7501/run.rb +9 -8
- data/lib/rake/osc7501/version.rb +1 -1
- data/lib/rake/osc7501/writer.rb +12 -6
- data/sig/rake/osc7501/rspec_task.rbs +1 -1
- data/sig/rake/osc7501/writer.rbs +7 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 89755b6d174f1e11bab04ce496d87064e69a3f725c3376a4f5aee2e434f8e6b4
|
|
4
|
+
data.tar.gz: ca8fd4f577ec6ee2dc1851ed2906433bde5c8428855bfc10a9f53c5f90faed51
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c96c512bbe23d1ad3dd3b3f9f47b86427febe3ee4c93783638a03357734643b1d4d88849c760d532bc446044d655b64fa1a845ebaaca050c5cfee467dac33285
|
|
7
|
+
data.tar.gz: 8cf05515e6c032b054e0875403b1d310bc5fe20755e63fdab5fafde51fcea6920c4e4dead0b12afbbaebbc071178ae6454d59c80f4288ca194a79b08e4745f95
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.2.0 - 2026-11-15
|
|
6
|
+
|
|
7
|
+
- Shorten README and fix prose findings \(\#14\) ([18e54ef](https://github.com/cosgroveb/rake-osc7501/commit/18e54efd71e8aff4858ba8850d86d7bd29c6e19a))
|
|
8
|
+
- Drop require-order detail from README \(\#15\) ([ea39746](https://github.com/cosgroveb/rake-osc7501/commit/ea39746bd9ace01f1b1b2a73f6467c0c11b3ae48))
|
|
9
|
+
- Name the RSpec integration in the README \(\#16\) ([fb8672d](https://github.com/cosgroveb/rake-osc7501/commit/fb8672de8bf5a83238bb82fcc29db6d59a8b46f5))
|
|
10
|
+
- Show current Rake task in terminal title \(\#17\) ([0780ec3](https://github.com/cosgroveb/rake-osc7501/commit/0780ec313ac46ce919769e3a02633f8ad360b54a))
|
|
11
|
+
- Add version policy and release mechanics to AGENTS.md \(\#18\) ([4087500](https://github.com/cosgroveb/rake-osc7501/commit/4087500d90190fa872a412e8dc7886cf45547bce))
|
|
12
|
+
|
|
5
13
|
## 0.1.2 - 2026-11-13
|
|
6
14
|
|
|
7
15
|
- Enable OSC reporting for direct RSpec runs ([ac72e7d](https://github.com/cosgroveb/rake-osc7501/commit/ac72e7db42be722561b4673f3de3ecb1ef2f9422))
|
data/README.md
CHANGED
|
@@ -15,48 +15,33 @@ task(:example) { sleep 5 }
|
|
|
15
15
|
task default: :example
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
Run `bundle exec rake`. A supporting terminal receives the
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
Rake-only projects need no RSpec dependencies.
|
|
18
|
+
Run `bundle exec rake`. A supporting terminal receives the run as its root
|
|
19
|
+
record with task activity and the outcome. Each new run replaces it, and
|
|
20
|
+
ordinary command output continues.
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
Reporting also sets the terminal title. While one task executes, the title is
|
|
23
|
+
`rake › <task>`. While several tasks run in parallel, it is
|
|
24
|
+
`rake › <n> active tasks`. The title returns to `rake` after the last task,
|
|
25
|
+
on completion, and on error or stop.
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
gem 'rspec-osc7501', '>= 0.1.4'
|
|
29
|
-
```
|
|
27
|
+
## RSpec tasks
|
|
30
28
|
|
|
31
|
-
|
|
29
|
+
For managed child reporting, add `rspec-osc7501` 0.1.4 or newer and use the
|
|
30
|
+
standard RSpec task class:
|
|
32
31
|
|
|
33
32
|
```ruby
|
|
34
33
|
require 'rspec/core/rake_task'
|
|
35
34
|
require 'rake/osc7501'
|
|
36
35
|
|
|
37
36
|
RSpec::Core::RakeTask.new(:spec)
|
|
38
|
-
task(:example) { sleep 5 }
|
|
39
37
|
task default: [:example, :spec]
|
|
40
38
|
```
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
configured formatters, including their output files. An explicit OSC formatter
|
|
48
|
-
keeps its destination and receives no duplicate.
|
|
49
|
-
|
|
50
|
-
Missing or older `rspec-osc7501` installations without `rspec/osc7501/managed.rb`
|
|
51
|
-
leave the original RSpec command intact. Either require order works when RSpec's
|
|
52
|
-
Rake tasks are loaded before top-level execution. Custom runners receive generic
|
|
53
|
-
Rake reporting. Direct `rspec` commands still need explicit OSC
|
|
54
|
-
formatter selection.
|
|
55
|
-
|
|
56
|
-
The adapter passes child context through the spawn environment. It preserves
|
|
57
|
-
parent environment variables and task options. RSpec's clean-environment option,
|
|
58
|
-
where available, receives only the child ID and explicit `RSPEC_OSC7501`,
|
|
59
|
-
`RSPEC_OSC7501_TITLE`, and `TERM` controls.
|
|
40
|
+
Each task invocation gets a unique child record, and a new run replaces only
|
|
41
|
+
the root record. Automatic selection preserves RSpec's configured formatters.
|
|
42
|
+
Missing or older `rspec-osc7501` installations leave the original RSpec
|
|
43
|
+
command intact, and direct `rspec` commands still need explicit OSC formatter
|
|
44
|
+
selection.
|
|
60
45
|
|
|
61
46
|
## Output controls
|
|
62
47
|
|
|
@@ -65,65 +50,21 @@ where available, receives only the child ID and explicit `RSPEC_OSC7501`,
|
|
|
65
50
|
| `RAKE_OSC7501=auto` | Default. Report to stdout only when it is a TTY and `TERM` is not `dumb`. |
|
|
66
51
|
| `RAKE_OSC7501=force` | Report to stdout even when redirected. |
|
|
67
52
|
| `RAKE_OSC7501=off` | Disable Rake reporting and automatic RSpec activation. |
|
|
68
|
-
|
|
69
|
-
Other values raise `ArgumentError`. Explicit RSpec selections retain their own
|
|
70
|
-
`RSPEC_OSC7501` controls. Automatic child activation does not depend on the
|
|
71
|
-
parent's TTY because each child honors its RSpec-selected stream.
|
|
53
|
+
| any other value | Raise `ArgumentError`. |
|
|
72
54
|
|
|
73
55
|
## Outcomes and limits
|
|
74
56
|
|
|
75
|
-
Rake reports active task actions without a percentage. Overlapping actions show
|
|
76
|
-
an active count. Skipped file tasks, deduplicated invocations, task listings and
|
|
77
|
-
dry runs do not report executed work.
|
|
78
|
-
|
|
79
57
|
Normal completion reports `done`. Exceptions and nonzero `SystemExit` report
|
|
80
|
-
`error
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
Rake covers task execution after activation. Failures before activation or in
|
|
89
|
-
later process-exit handlers fall outside that result. Abrupt child termination
|
|
90
|
-
can leave a working record without a summary. A child summary can precede a
|
|
91
|
-
process failure. Rake reports the process outcome without inventing test results.
|
|
92
|
-
|
|
93
|
-
Frames stay below 4096 bytes. Messages contain sanitized UTF-8, capped at 2048
|
|
94
|
-
decoded bytes. Stream errors disable reporting without closing caller streams.
|
|
95
|
-
The gems install no process-wide exit or signal hooks and read no terminal input.
|
|
96
|
-
Terminals control display, dismissal and notifications. Live Rex presentation
|
|
97
|
-
has not been verified.
|
|
58
|
+
`error`, and `Interrupt` or early successful `SystemExit` report `idle`. The
|
|
59
|
+
gem leaves Rake's scheduling, exceptions and exit behavior intact. Frames
|
|
60
|
+
stay below 4096 bytes. The gem sanitizes messages and titles, resolves
|
|
61
|
+
invalid UTF-8 by replacement, caps messages at 2048 decoded bytes and titles
|
|
62
|
+
at 512 bytes including the `rake › ` prefix. It installs no process-wide exit
|
|
63
|
+
or signal hooks and reads no terminal input. Terminals control display,
|
|
64
|
+
dismissal and notifications. We have not verified live Rex presentation.
|
|
98
65
|
|
|
99
66
|
## Compatibility and development
|
|
100
67
|
|
|
101
|
-
Runtime targets MRI Ruby >= 2.1 and Rake >= 12.3.3. The optional
|
|
102
|
-
RSpec >= 3.6.
|
|
103
|
-
|
|
104
|
-
versions, including RSpec 4.0.0.beta1 on Ruby 4.0. RSpec 3.6 has no
|
|
105
|
-
clean-environment option. CI also checks macOS with Ruby 3.4.
|
|
106
|
-
Other Ruby engines are unverified.
|
|
107
|
-
|
|
108
|
-
On modern Ruby:
|
|
109
|
-
|
|
110
|
-
```sh
|
|
111
|
-
bundle install
|
|
112
|
-
bundle exec rake
|
|
113
|
-
bundle exec rake spec
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
The development bundle includes the RSpec companion, so the normal suite exercises
|
|
117
|
-
both reporters. The `pure-rake` CI job checks passing and failing tasks with only
|
|
118
|
-
Rake and the built gem installed in an isolated gem directory.
|
|
119
|
-
Set `RSPEC_OSC7501_PATH` to test a local companion checkout instead of the released gem.
|
|
120
|
-
|
|
121
|
-
`rake types` checks method annotation coverage across authored Ruby files,
|
|
122
|
-
generates inline RBS, and uses Steep to check implementations in `lib/` and
|
|
123
|
-
`script/` against their signatures. Specs and build configuration receive
|
|
124
|
-
annotation and signature validation, not implementation checking.
|
|
125
|
-
Generated project signatures stay in ignored `tmp/`. `sig/dependencies.rbs`
|
|
126
|
-
supplies missing dependency declarations. See [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
127
|
-
for lint, dependency audit, workflow checks and release setup. Compatibility checks use `Gemfile.compat`
|
|
128
|
-
without type tooling. Pass an RSpec gem package as the smoke script's second
|
|
129
|
-
argument to check installed parent/child reporting.
|
|
68
|
+
Runtime targets MRI Ruby >= 2.1 and Rake >= 12.3.3. The optional RSpec task
|
|
69
|
+
integration targets RSpec >= 3.6. See [CONTRIBUTING.md](CONTRIBUTING.md) for
|
|
70
|
+
the full checks, release setup and compatibility instructions.
|
|
@@ -13,7 +13,7 @@ module Rake
|
|
|
13
13
|
# def system: (*String | Hash[String, String?] | Hash[Symbol, bool]) -> bool?
|
|
14
14
|
# end
|
|
15
15
|
|
|
16
|
-
# Wrap only the standard RSpec task's launch
|
|
16
|
+
# Wrap only the standard RSpec task's launch. Keep its status handling intact.
|
|
17
17
|
# @rbs module-self _RSpecRakeTask
|
|
18
18
|
module RSpecTask
|
|
19
19
|
# @rbs @osc7501_context: [String, String]?
|
data/lib/rake/osc7501/run.rb
CHANGED
|
@@ -87,14 +87,15 @@ module Rake
|
|
|
87
87
|
def report_active
|
|
88
88
|
return if @finished
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
90
|
+
if @active.empty?
|
|
91
|
+
@writer.emit(state: 'working', msg: 'Running tasks')
|
|
92
|
+
elsif @active.length == 1
|
|
93
|
+
message = @active.first.name
|
|
94
|
+
@writer.emit(state: 'working', msg: message, window_title: message)
|
|
95
|
+
else
|
|
96
|
+
message = "#{@active.length} active tasks"
|
|
97
|
+
@writer.emit(state: 'working', msg: message, window_title: message)
|
|
98
|
+
end
|
|
98
99
|
end
|
|
99
100
|
end
|
|
100
101
|
end
|
data/lib/rake/osc7501/version.rb
CHANGED
data/lib/rake/osc7501/writer.rb
CHANGED
|
@@ -7,6 +7,9 @@ module Rake
|
|
|
7
7
|
# @rbs @output: IO | StringIO
|
|
8
8
|
# @rbs @enabled: bool
|
|
9
9
|
|
|
10
|
+
TITLE_BYTE_LIMIT = 512
|
|
11
|
+
TITLE_PREFIX = 'rake' #: String
|
|
12
|
+
|
|
10
13
|
#: (IO | StringIO output, mode: String) -> void
|
|
11
14
|
def initialize(output, mode:)
|
|
12
15
|
raise ArgumentError, 'RAKE_OSC7501 must be auto, off, or force' unless %w[auto off force].include?(mode)
|
|
@@ -17,11 +20,15 @@ module Rake
|
|
|
17
20
|
@enabled = false
|
|
18
21
|
end
|
|
19
22
|
|
|
20
|
-
#: (state: String, msg: String) -> void
|
|
21
|
-
def emit(state:, msg:)
|
|
23
|
+
#: (state: String, msg: String, ?window_title: String?) -> void
|
|
24
|
+
def emit(state:, msg:, window_title: nil)
|
|
22
25
|
return unless @enabled
|
|
23
26
|
|
|
24
|
-
|
|
27
|
+
# Compose only after sanitizing the name so binary input cannot mix encodings.
|
|
28
|
+
name = window_title && sanitize(window_title, TITLE_BYTE_LIMIT)
|
|
29
|
+
title = name && !name.empty? && sanitize(TITLE_PREFIX + ' › ' + name, TITLE_BYTE_LIMIT)
|
|
30
|
+
@output.write("\e]2;#{title || TITLE_PREFIX}\e\\")
|
|
31
|
+
fields = ['app=rake', 'title=UmFrZQ==', "state=#{state}", "msg=#{[sanitize(msg, 2048)].pack('m0')}"]
|
|
25
32
|
@output.write("\e]7501;#{fields.join(':')}\e\\")
|
|
26
33
|
@output.flush if @output.respond_to?(:flush)
|
|
27
34
|
rescue IOError, SystemCallError
|
|
@@ -36,15 +43,14 @@ module Rake
|
|
|
36
43
|
end
|
|
37
44
|
|
|
38
45
|
#: (String, Integer) -> String
|
|
39
|
-
def
|
|
46
|
+
def sanitize(text, byte_limit)
|
|
40
47
|
input = text.to_s.byteslice(0, sanitization_byte_limit(byte_limit)) #: String
|
|
41
48
|
clean = input.encode('UTF-8', invalid: :replace, undef: :replace).gsub(/[\u0000-\u001F\u007F-\u009F]/, '')
|
|
42
49
|
bytes = 0
|
|
43
|
-
|
|
50
|
+
clean.each_char.take_while do |char|
|
|
44
51
|
bytes += char.bytesize
|
|
45
52
|
bytes <= byte_limit
|
|
46
53
|
end.join
|
|
47
|
-
[bounded].pack('m0')
|
|
48
54
|
end
|
|
49
55
|
|
|
50
56
|
# Bound sanitization work with 50% headroom for stripped controls.
|
|
@@ -12,7 +12,7 @@ module Rake
|
|
|
12
12
|
def system: (*String | Hash[String, String?] | Hash[Symbol, bool]) -> bool?
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
# Wrap only the standard RSpec task's launch
|
|
15
|
+
# Wrap only the standard RSpec task's launch. Keep its status handling intact.
|
|
16
16
|
# @rbs module-self _RSpecRakeTask
|
|
17
17
|
module RSpecTask : _RSpecRakeTask
|
|
18
18
|
@osc7501_context: [ String, String ]?
|
data/sig/rake/osc7501/writer.rbs
CHANGED
|
@@ -7,11 +7,15 @@ module Rake
|
|
|
7
7
|
|
|
8
8
|
@enabled: bool
|
|
9
9
|
|
|
10
|
+
TITLE_BYTE_LIMIT: ::Integer
|
|
11
|
+
|
|
12
|
+
TITLE_PREFIX: String
|
|
13
|
+
|
|
10
14
|
# : (IO | StringIO output, mode: String) -> void
|
|
11
15
|
def initialize: (IO | StringIO output, mode: String) -> void
|
|
12
16
|
|
|
13
|
-
# : (state: String, msg: String) -> void
|
|
14
|
-
def emit: (state: String, msg: String) -> void
|
|
17
|
+
# : (state: String, msg: String, ?window_title: String?) -> void
|
|
18
|
+
def emit: (state: String, msg: String, ?window_title: String?) -> void
|
|
15
19
|
|
|
16
20
|
private
|
|
17
21
|
|
|
@@ -19,7 +23,7 @@ module Rake
|
|
|
19
23
|
def automatic_output?: () -> bool
|
|
20
24
|
|
|
21
25
|
# : (String, Integer) -> String
|
|
22
|
-
def
|
|
26
|
+
def sanitize: (String, Integer) -> String
|
|
23
27
|
|
|
24
28
|
# Bound sanitization work with 50% headroom for stripped controls.
|
|
25
29
|
# : (Integer) -> Integer
|