rake-osc7501 0.1.1 → 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 +18 -0
- data/CONTRIBUTING.md +13 -3
- data/README.md +26 -82
- data/lib/rake/osc7501/hooks.rb +27 -2
- data/lib/rake/osc7501/rspec_task.rb +27 -8
- data/lib/rake/osc7501/run.rb +11 -9
- data/lib/rake/osc7501/version.rb +1 -1
- data/lib/rake/osc7501/writer.rb +13 -7
- data/lib/rake/osc7501.rb +5 -0
- data/sig/rake/osc7501/hooks.rbs +45 -0
- data/sig/rake/osc7501/rspec_task.rbs +35 -0
- data/sig/rake/osc7501/run.rbs +48 -0
- data/sig/rake/osc7501/version.rbs +7 -0
- data/sig/rake/osc7501/writer.rbs +33 -0
- data/sig/rake/osc7501.rbs +11 -0
- metadata +7 -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,24 @@
|
|
|
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
|
+
|
|
13
|
+
## 0.1.2 - 2026-11-13
|
|
14
|
+
|
|
15
|
+
- Enable OSC reporting for direct RSpec runs ([ac72e7d](https://github.com/cosgroveb/rake-osc7501/commit/ac72e7db42be722561b4673f3de3ecb1ef2f9422))
|
|
16
|
+
- Check Ruby implementations against inline RBS ([4ec47b3](https://github.com/cosgroveb/rake-osc7501/commit/4ec47b379bc1396efaec97a5b824d9b4abb80277))
|
|
17
|
+
- Package generated runtime RBS signatures ([ecfcad0](https://github.com/cosgroveb/rake-osc7501/commit/ecfcad06a510bde0d6fab00580a92f0a6f845701))
|
|
18
|
+
- Build compatibility gems without type tooling ([784efd3](https://github.com/cosgroveb/rake-osc7501/commit/784efd35d2ba7e49bd3f12600196512f95fa0086))
|
|
19
|
+
- Bump actions/download-artifact from 4.3.0 to 8.0.2 ([5b2445b](https://github.com/cosgroveb/rake-osc7501/commit/5b2445be7bcfa8d563efbd42b91e759d3e9eaf8c))
|
|
20
|
+
- Bump actions/upload-artifact from 4.6.2 to 7.0.2 ([f4c30a5](https://github.com/cosgroveb/rake-osc7501/commit/f4c30a59b917398fe54e0d7a251d16081a8365bc))
|
|
21
|
+
- Install RSpec reporting after loading the Rakefile ([c35a24a](https://github.com/cosgroveb/rake-osc7501/commit/c35a24a330fa0ef62d2d1224ca6be9dff6da4c27))
|
|
22
|
+
|
|
5
23
|
## 0.1.1 - 2026-11-12
|
|
6
24
|
|
|
7
25
|
- Preserve release failure diagnostics on retries ([5e89c7b](https://github.com/cosgroveb/rake-osc7501/commit/5e89c7b0f84a9ed45342b4f5e5d8154f309f6b67))
|
data/CONTRIBUTING.md
CHANGED
|
@@ -17,12 +17,18 @@ bundle exec rake
|
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
The default task runs RuboCop with rubocop-rspec, bundler-audit, actionlint,
|
|
20
|
-
inline RBS checks, specs, installed-gem smoke tests and RDoc. Run `bundle exec rake lint`, `audit`, `workflows`,
|
|
20
|
+
inline RBS checks, specs, installed-gem smoke tests and RDoc. Run `bundle exec rake lint`, `audit`, `workflows`, `types`,
|
|
21
21
|
or `spec` for individual checks. RuboCop applies default style rules to release tooling and build configuration,
|
|
22
22
|
and correctness cops to existing runtime code, fixtures and smoke tests.
|
|
23
23
|
Scoped exclusions preserve Ruby 2.1 support and exception propagation. Do not add a TODO baseline. Dependency auditing checks the
|
|
24
24
|
lockfile generated by `bundle install`. Keep that lockfile out of commits.
|
|
25
25
|
|
|
26
|
+
`rake types` uses Steep to check runtime and tooling implementations in `lib/`
|
|
27
|
+
and `script/` against generated inline signatures. Specs and build configuration
|
|
28
|
+
receive annotation and signature validation only. Keep project types inline.
|
|
29
|
+
`sig/dependencies.rbs` fills gaps in dependency signatures, and generated files
|
|
30
|
+
stay in ignored `tmp/`.
|
|
31
|
+
|
|
26
32
|
Specs run in random order and report their seed. Reproduce an ordering failure
|
|
27
33
|
with `bundle exec rspec --seed <seed>` and narrow it with
|
|
28
34
|
`bundle exec rspec --seed <seed> --bisect`. Generated subprocess fixtures keep a
|
|
@@ -42,7 +48,9 @@ bundle exec rake rdoc
|
|
|
42
48
|
```
|
|
43
49
|
|
|
44
50
|
The package is `pkg/rake-osc7501-<version>.gem`. Open `tmp/rdoc/index.html` to check
|
|
45
|
-
rendered documentation.
|
|
51
|
+
rendered documentation. `rake package` generates runtime RBS from `lib/` into
|
|
52
|
+
`pkg/rake-osc7501-<version>/sig/` and includes it in the gem for type tools to
|
|
53
|
+
discover by gem name. Keep generated files out of commits.
|
|
46
54
|
The smoke task builds and installs the gem in a temporary directory, then checks
|
|
47
55
|
passing and failing tasks without loading the checkout's library.
|
|
48
56
|
The `pure-rake` CI job runs this check with only Rake and the built gem installed
|
|
@@ -60,13 +68,15 @@ export BUNDLE_GEMFILE=Gemfile.compat
|
|
|
60
68
|
export RSPEC_MINOR=3.6
|
|
61
69
|
export RSPEC_CORE_VERSION=3.6.0
|
|
62
70
|
bundle install
|
|
63
|
-
bundle exec rspec spec/rake
|
|
71
|
+
bundle exec rspec --options '' spec/rake
|
|
64
72
|
bundle exec gem build rake-osc7501.gemspec
|
|
65
73
|
bundle exec ruby script/smoke.rb rake-osc7501-*.gem
|
|
66
74
|
```
|
|
67
75
|
|
|
68
76
|
Remove `Gemfile.compat.lock` before changing RSpec versions. Keep it out of commits.
|
|
69
77
|
The compatibility bundle pins diff-lcs 1.3 so test dependencies install on Ruby 2.1.
|
|
78
|
+
These bare `gem build` checks omit generated signatures and need no type tooling.
|
|
79
|
+
Use the modern development bundle and `rake package` for distribution builds.
|
|
70
80
|
CI checks the oldest Ruby against both RSpec endpoints, the oldest RSpec on modern
|
|
71
81
|
Ruby, and the Debian Bullseye and Bookworm version families. These jobs run the
|
|
72
82
|
runtime suite and installed-gem smoke checks. Modern jobs also test release
|
data/README.md
CHANGED
|
@@ -15,47 +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. Custom runners and reverse require order
|
|
52
|
-
receive generic Rake reporting. Direct `rspec` commands still need explicit OSC
|
|
53
|
-
formatter selection.
|
|
54
|
-
|
|
55
|
-
The adapter passes child context through the spawn environment. It preserves
|
|
56
|
-
parent environment variables and task options. RSpec's clean-environment option,
|
|
57
|
-
where available, receives only the child ID and explicit `RSPEC_OSC7501`,
|
|
58
|
-
`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.
|
|
59
45
|
|
|
60
46
|
## Output controls
|
|
61
47
|
|
|
@@ -64,63 +50,21 @@ where available, receives only the child ID and explicit `RSPEC_OSC7501`,
|
|
|
64
50
|
| `RAKE_OSC7501=auto` | Default. Report to stdout only when it is a TTY and `TERM` is not `dumb`. |
|
|
65
51
|
| `RAKE_OSC7501=force` | Report to stdout even when redirected. |
|
|
66
52
|
| `RAKE_OSC7501=off` | Disable Rake reporting and automatic RSpec activation. |
|
|
67
|
-
|
|
68
|
-
Other values raise `ArgumentError`. Explicit RSpec selections retain their own
|
|
69
|
-
`RSPEC_OSC7501` controls. Automatic child activation does not depend on the
|
|
70
|
-
parent's TTY because each child honors its RSpec-selected stream.
|
|
53
|
+
| any other value | Raise `ArgumentError`. |
|
|
71
54
|
|
|
72
55
|
## Outcomes and limits
|
|
73
56
|
|
|
74
|
-
Rake reports active task actions without a percentage. Overlapping actions show
|
|
75
|
-
an active count. Skipped file tasks, deduplicated invocations, task listings and
|
|
76
|
-
dry runs do not report executed work.
|
|
77
|
-
|
|
78
57
|
Normal completion reports `done`. Exceptions and nonzero `SystemExit` report
|
|
79
|
-
`error
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
Rake covers task execution after activation. Failures before activation or in
|
|
88
|
-
later process-exit handlers fall outside that result. Abrupt child termination
|
|
89
|
-
can leave a working record without a summary. A child summary can precede a
|
|
90
|
-
process failure. Rake reports the process outcome without inventing test results.
|
|
91
|
-
|
|
92
|
-
Frames stay below 4096 bytes. Messages contain sanitized UTF-8, capped at 2048
|
|
93
|
-
decoded bytes. Stream errors disable reporting without closing caller streams.
|
|
94
|
-
The gems install no process-wide exit or signal hooks and read no terminal input.
|
|
95
|
-
Terminals control display, dismissal and notifications. Live Rex presentation
|
|
96
|
-
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.
|
|
97
65
|
|
|
98
66
|
## Compatibility and development
|
|
99
67
|
|
|
100
|
-
Runtime targets MRI Ruby >= 2.1 and Rake >= 12.3.3. The optional
|
|
101
|
-
RSpec >= 3.6.
|
|
102
|
-
|
|
103
|
-
versions, including RSpec 4.0.0.beta1 on Ruby 4.0. RSpec 3.6 has no
|
|
104
|
-
clean-environment option. CI also checks macOS with Ruby 3.4.
|
|
105
|
-
Other Ruby engines are unverified.
|
|
106
|
-
|
|
107
|
-
On modern Ruby:
|
|
108
|
-
|
|
109
|
-
```sh
|
|
110
|
-
bundle install
|
|
111
|
-
bundle exec rake
|
|
112
|
-
bundle exec rake spec
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
The development bundle includes the RSpec companion, so the normal suite exercises
|
|
116
|
-
both reporters. The `pure-rake` CI job checks passing and failing tasks with only
|
|
117
|
-
Rake and the built gem installed in an isolated gem directory.
|
|
118
|
-
Set `RSPEC_OSC7501_PATH` to test a local companion checkout instead of the released gem.
|
|
119
|
-
|
|
120
|
-
`rake types` checks method annotation coverage across authored Ruby files,
|
|
121
|
-
generates inline RBS with pinned development tools, and validates signatures.
|
|
122
|
-
Generated signatures stay in ignored `tmp/`. See [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
123
|
-
for lint, dependency audit, workflow checks and release setup. This check validates declarations,
|
|
124
|
-
not implementation type consistency. Compatibility checks use `Gemfile.compat`
|
|
125
|
-
without type tooling. Pass an RSpec gem package as the smoke script's second
|
|
126
|
-
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.
|
data/lib/rake/osc7501/hooks.rb
CHANGED
|
@@ -2,7 +2,29 @@
|
|
|
2
2
|
# rbs_inline: enabled
|
|
3
3
|
|
|
4
4
|
module Rake
|
|
5
|
+
# @rbs!
|
|
6
|
+
# class Application
|
|
7
|
+
# include OSC7501::ApplicationHook
|
|
8
|
+
# end
|
|
9
|
+
|
|
5
10
|
module OSC7501
|
|
11
|
+
# @rbs!
|
|
12
|
+
# interface _Application
|
|
13
|
+
# def options: () -> _Options
|
|
14
|
+
# def top_level: () -> Object
|
|
15
|
+
# end
|
|
16
|
+
# interface _Options
|
|
17
|
+
# def show_tasks: () -> (:tasks | :describe | :lines)?
|
|
18
|
+
# def show_prereqs: () -> bool
|
|
19
|
+
# def dryrun: () -> bool
|
|
20
|
+
# end
|
|
21
|
+
# interface _Task
|
|
22
|
+
# def name: () -> String
|
|
23
|
+
# def application: () -> ::Rake::Application
|
|
24
|
+
# def execute: (?Object) ?{ (*Object) -> Object } -> Object
|
|
25
|
+
# end
|
|
26
|
+
|
|
27
|
+
# @rbs module-self _Application
|
|
6
28
|
module ApplicationHook
|
|
7
29
|
attr_reader :osc7501_run #: Run?
|
|
8
30
|
|
|
@@ -10,16 +32,19 @@ module Rake
|
|
|
10
32
|
def top_level
|
|
11
33
|
return super if options.show_tasks || options.show_prereqs || options.dryrun
|
|
12
34
|
|
|
35
|
+
OSC7501.install_rspec!
|
|
13
36
|
previous = @osc7501_run
|
|
14
37
|
begin
|
|
15
|
-
|
|
16
|
-
@osc7501_run
|
|
38
|
+
run = Run.new($stdout, mode: ENV.fetch('RAKE_OSC7501', 'auto'))
|
|
39
|
+
@osc7501_run = run
|
|
40
|
+
run.during_run { super }
|
|
17
41
|
ensure
|
|
18
42
|
@osc7501_run = previous
|
|
19
43
|
end
|
|
20
44
|
end
|
|
21
45
|
end
|
|
22
46
|
|
|
47
|
+
# @rbs module-self _Task
|
|
23
48
|
module TaskHook
|
|
24
49
|
#: (?Object args) ?{ (*Object) -> Object } -> Object
|
|
25
50
|
def execute(args = nil, &block)
|
|
@@ -5,7 +5,16 @@ require 'shellwords'
|
|
|
5
5
|
|
|
6
6
|
module Rake
|
|
7
7
|
module OSC7501
|
|
8
|
-
#
|
|
8
|
+
# @rbs!
|
|
9
|
+
# interface _RSpecRakeTask
|
|
10
|
+
# def run_task: (bool) -> Object
|
|
11
|
+
# def ruby_opts: () -> (String | Array[String] | nil)
|
|
12
|
+
# def rspec_path: () -> String
|
|
13
|
+
# def system: (*String | Hash[String, String?] | Hash[Symbol, bool]) -> bool?
|
|
14
|
+
# end
|
|
15
|
+
|
|
16
|
+
# Wrap only the standard RSpec task's launch. Keep its status handling intact.
|
|
17
|
+
# @rbs module-self _RSpecRakeTask
|
|
9
18
|
module RSpecTask
|
|
10
19
|
# @rbs @osc7501_context: [String, String]?
|
|
11
20
|
|
|
@@ -15,7 +24,7 @@ module Rake
|
|
|
15
24
|
begin
|
|
16
25
|
run = Rake.application.osc7501_run if Rake.application.respond_to?(:osc7501_run)
|
|
17
26
|
path = managed_path if run && run.managed_children?
|
|
18
|
-
@osc7501_context = path ? [run.next_child_id, path] : nil
|
|
27
|
+
@osc7501_context = path && run ? [run.next_child_id, path] : nil
|
|
19
28
|
super
|
|
20
29
|
ensure
|
|
21
30
|
@osc7501_context = previous
|
|
@@ -25,9 +34,11 @@ module Rake
|
|
|
25
34
|
#: () -> (String | Array[String] | nil)
|
|
26
35
|
def ruby_opts
|
|
27
36
|
options = super
|
|
28
|
-
|
|
37
|
+
context = @osc7501_context
|
|
38
|
+
return options unless context
|
|
29
39
|
|
|
30
|
-
[
|
|
40
|
+
options = [options] if options.is_a?(String)
|
|
41
|
+
(options || []) + ["-r#{Shellwords.escape(context.last)}"]
|
|
31
42
|
end
|
|
32
43
|
|
|
33
44
|
private
|
|
@@ -43,12 +54,20 @@ module Rake
|
|
|
43
54
|
path if File.file?(path)
|
|
44
55
|
end
|
|
45
56
|
|
|
46
|
-
#: (*
|
|
57
|
+
#: (*String | Hash[String, String?] | Hash[Symbol, bool]) -> bool?
|
|
47
58
|
def system(*arguments)
|
|
48
|
-
|
|
59
|
+
context = @osc7501_context
|
|
60
|
+
return super unless context
|
|
49
61
|
|
|
50
|
-
environment
|
|
51
|
-
|
|
62
|
+
# @type var environment: Hash[String, String?]
|
|
63
|
+
first = arguments.first
|
|
64
|
+
if first.is_a?(Hash)
|
|
65
|
+
arguments.shift
|
|
66
|
+
environment = first.dup
|
|
67
|
+
else
|
|
68
|
+
environment = {}
|
|
69
|
+
end
|
|
70
|
+
environment['RSPEC_OSC7501_ID'] = context.first
|
|
52
71
|
%w[RSPEC_OSC7501 RSPEC_OSC7501_TITLE TERM].each do |key|
|
|
53
72
|
environment[key] = ENV[key] if ENV.key?(key) && !environment.key?(key)
|
|
54
73
|
end
|
data/lib/rake/osc7501/run.rb
CHANGED
|
@@ -53,7 +53,8 @@ module Rake
|
|
|
53
53
|
yield
|
|
54
54
|
ensure
|
|
55
55
|
@mutex.synchronize do
|
|
56
|
-
@active.
|
|
56
|
+
index = @active.rindex(task) #: Integer
|
|
57
|
+
@active.delete_at(index)
|
|
57
58
|
report_active
|
|
58
59
|
end
|
|
59
60
|
end
|
|
@@ -86,14 +87,15 @@ module Rake
|
|
|
86
87
|
def report_active
|
|
87
88
|
return if @finished
|
|
88
89
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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
|
|
97
99
|
end
|
|
98
100
|
end
|
|
99
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
|
|
40
|
-
input = text.to_s.byteslice(0, sanitization_byte_limit(byte_limit))
|
|
46
|
+
def sanitize(text, byte_limit)
|
|
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.
|
data/lib/rake/osc7501.rb
CHANGED
|
@@ -13,6 +13,11 @@ module Rake
|
|
|
13
13
|
def self.install!(application = Rake.application)
|
|
14
14
|
application.extend(ApplicationHook) unless application.is_a?(ApplicationHook)
|
|
15
15
|
Rake::Task.prepend(TaskHook) unless Rake::Task.ancestors.include?(TaskHook)
|
|
16
|
+
install_rspec!
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
#: () -> void
|
|
20
|
+
def self.install_rspec!
|
|
16
21
|
return unless defined?(RSpec::Core::RakeTask)
|
|
17
22
|
|
|
18
23
|
require_relative 'osc7501/rspec_task'
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Generated from lib/rake/osc7501/hooks.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Rake
|
|
4
|
+
class Application
|
|
5
|
+
include OSC7501::ApplicationHook
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
module OSC7501
|
|
9
|
+
interface _Application
|
|
10
|
+
def options: () -> _Options
|
|
11
|
+
|
|
12
|
+
def top_level: () -> Object
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
interface _Options
|
|
16
|
+
def show_tasks: () -> (:tasks | :describe | :lines)?
|
|
17
|
+
|
|
18
|
+
def show_prereqs: () -> bool
|
|
19
|
+
|
|
20
|
+
def dryrun: () -> bool
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
interface _Task
|
|
24
|
+
def name: () -> String
|
|
25
|
+
|
|
26
|
+
def application: () -> ::Rake::Application
|
|
27
|
+
|
|
28
|
+
def execute: (?Object) ?{ (*Object) -> Object } -> Object
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# @rbs module-self _Application
|
|
32
|
+
module ApplicationHook : _Application
|
|
33
|
+
attr_reader osc7501_run: Run?
|
|
34
|
+
|
|
35
|
+
# : () -> Object
|
|
36
|
+
def top_level: () -> Object
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# @rbs module-self _Task
|
|
40
|
+
module TaskHook : _Task
|
|
41
|
+
# : (?Object args) ?{ (*Object) -> Object } -> Object
|
|
42
|
+
def execute: (?Object args) ?{ (*Object) -> Object } -> Object
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Generated from lib/rake/osc7501/rspec_task.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Rake
|
|
4
|
+
module OSC7501
|
|
5
|
+
interface _RSpecRakeTask
|
|
6
|
+
def run_task: (bool) -> Object
|
|
7
|
+
|
|
8
|
+
def ruby_opts: () -> (String | Array[String] | nil)
|
|
9
|
+
|
|
10
|
+
def rspec_path: () -> String
|
|
11
|
+
|
|
12
|
+
def system: (*String | Hash[String, String?] | Hash[Symbol, bool]) -> bool?
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Wrap only the standard RSpec task's launch. Keep its status handling intact.
|
|
16
|
+
# @rbs module-self _RSpecRakeTask
|
|
17
|
+
module RSpecTask : _RSpecRakeTask
|
|
18
|
+
@osc7501_context: [ String, String ]?
|
|
19
|
+
|
|
20
|
+
# : (bool) -> Object
|
|
21
|
+
def run_task: (bool) -> Object
|
|
22
|
+
|
|
23
|
+
# : () -> (String | Array[String] | nil)
|
|
24
|
+
def ruby_opts: () -> (String | Array[String] | nil)
|
|
25
|
+
|
|
26
|
+
private
|
|
27
|
+
|
|
28
|
+
# : () -> String?
|
|
29
|
+
def managed_path: () -> String?
|
|
30
|
+
|
|
31
|
+
# : (*String | Hash[String, String?] | Hash[Symbol, bool]) -> bool?
|
|
32
|
+
def system: (*String | Hash[String, String?] | Hash[Symbol, bool]) -> bool?
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Generated from lib/rake/osc7501/run.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Rake
|
|
4
|
+
module OSC7501
|
|
5
|
+
interface _TaskName
|
|
6
|
+
def name: () -> String
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
class Run
|
|
10
|
+
@active: Array[_TaskName]
|
|
11
|
+
|
|
12
|
+
@counter: Integer
|
|
13
|
+
|
|
14
|
+
@mutex: Mutex
|
|
15
|
+
|
|
16
|
+
@id: String
|
|
17
|
+
|
|
18
|
+
@writer: Writer
|
|
19
|
+
|
|
20
|
+
@mode: String
|
|
21
|
+
|
|
22
|
+
@finished: bool
|
|
23
|
+
|
|
24
|
+
# : (IO | StringIO output, mode: String) -> void
|
|
25
|
+
def initialize: (IO | StringIO output, mode: String) -> void
|
|
26
|
+
|
|
27
|
+
# : [T] () { () -> T } -> T
|
|
28
|
+
def during_run: [T] () { () -> T } -> T
|
|
29
|
+
|
|
30
|
+
# : [T] (_TaskName) { () -> T } -> T
|
|
31
|
+
def during_task: [T] (_TaskName) { () -> T } -> T
|
|
32
|
+
|
|
33
|
+
# : () -> String
|
|
34
|
+
def next_child_id: () -> String
|
|
35
|
+
|
|
36
|
+
# : () -> bool
|
|
37
|
+
def managed_children?: () -> bool
|
|
38
|
+
|
|
39
|
+
private
|
|
40
|
+
|
|
41
|
+
# : (String, String) -> void
|
|
42
|
+
def finish: (String, String) -> void
|
|
43
|
+
|
|
44
|
+
# : () -> void
|
|
45
|
+
def report_active: () -> void
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Generated from lib/rake/osc7501/writer.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Rake
|
|
4
|
+
module OSC7501
|
|
5
|
+
class Writer
|
|
6
|
+
@output: IO | StringIO
|
|
7
|
+
|
|
8
|
+
@enabled: bool
|
|
9
|
+
|
|
10
|
+
TITLE_BYTE_LIMIT: ::Integer
|
|
11
|
+
|
|
12
|
+
TITLE_PREFIX: String
|
|
13
|
+
|
|
14
|
+
# : (IO | StringIO output, mode: String) -> void
|
|
15
|
+
def initialize: (IO | StringIO output, mode: String) -> void
|
|
16
|
+
|
|
17
|
+
# : (state: String, msg: String, ?window_title: String?) -> void
|
|
18
|
+
def emit: (state: String, msg: String, ?window_title: String?) -> void
|
|
19
|
+
|
|
20
|
+
private
|
|
21
|
+
|
|
22
|
+
# : () -> bool
|
|
23
|
+
def automatic_output?: () -> bool
|
|
24
|
+
|
|
25
|
+
# : (String, Integer) -> String
|
|
26
|
+
def sanitize: (String, Integer) -> String
|
|
27
|
+
|
|
28
|
+
# Bound sanitization work with 50% headroom for stripped controls.
|
|
29
|
+
# : (Integer) -> Integer
|
|
30
|
+
def sanitization_byte_limit: (Integer) -> Integer
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rake-osc7501
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brian Cosgrove
|
|
@@ -43,6 +43,12 @@ files:
|
|
|
43
43
|
- lib/rake/osc7501/run.rb
|
|
44
44
|
- lib/rake/osc7501/version.rb
|
|
45
45
|
- lib/rake/osc7501/writer.rb
|
|
46
|
+
- sig/rake/osc7501.rbs
|
|
47
|
+
- sig/rake/osc7501/hooks.rbs
|
|
48
|
+
- sig/rake/osc7501/rspec_task.rbs
|
|
49
|
+
- sig/rake/osc7501/run.rbs
|
|
50
|
+
- sig/rake/osc7501/version.rbs
|
|
51
|
+
- sig/rake/osc7501/writer.rbs
|
|
46
52
|
homepage: https://github.com/cosgroveb/rake-osc7501
|
|
47
53
|
licenses:
|
|
48
54
|
- Apache-2.0
|