rake-osc7501 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b3793bd5bf5af2934712bc5962ccbeb80cef8048675482a133d9283bad5401fb
4
+ data.tar.gz: 7226e2c5cef989c4f1d8ec0939680fb509b2f8f2c9d20e84fbf7bcfd353725e7
5
+ SHA512:
6
+ metadata.gz: 9772443fdd8848641e903512d6486c96340003ef53ab65d9e44d3b8d737c35fa2fd574287e97716b3e0bf96c8295949f20c8e044e93c729e0c70fdba43f93f7c
7
+ data.tar.gz: 5d7a32e74808f681733f5a1ae28062836b8220567599cbff40ea47941c1ae57b4d8dbe9c13e73543857efb312bbd5614dd5911756641e4830fa9df345fbcd289
data/ACCESSIBILITY.md ADDED
@@ -0,0 +1,35 @@
1
+ # Accessibility
2
+
3
+ Read command output without relying on terminal status indicators. Rake keeps
4
+ ordinary task output and errors available as text.
5
+
6
+ ## Plain text output
7
+
8
+ Disable automatic status reporting for a Rake invocation:
9
+
10
+ ```sh
11
+ RAKE_OSC7501=off RSPEC_OSC7501=off bundle exec rake
12
+ ```
13
+
14
+ `RAKE_OSC7501=off` disables parent status and automatic RSpec activation.
15
+ `RSPEC_OSC7501=off` also disables explicitly selected child status formatters.
16
+ Task-specific tools control their own text colors and output formats.
17
+
18
+ By default, Rake sends no status records to pipes, files, or terminals with
19
+ `TERM=dumb`. `RAKE_OSC7501=force` overrides those defaults.
20
+
21
+ ## Environments and limits
22
+
23
+ The gem requires MRI Ruby 2.1 or newer and Rake 12.3.3 or newer.
24
+ Terminal status requires an OSC 7501-capable terminal. The gem checks for a TTY
25
+ and honors `TERM=dumb` but does not detect OSC support.
26
+
27
+ Your terminal controls display and announcements. I have not tested the status
28
+ display with screen readers. Your screen reader may need additional settings.
29
+
30
+ ## Report a barrier
31
+
32
+ Open an [issue](https://github.com/cosgroveb/rake-osc7501/issues) describing what
33
+ you tried, what prevented you from using it, and what would help. Include your
34
+ terminal, operating system, and assistive technology versions when relevant.
35
+ You do not need to disclose a disability or other medical information.
data/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ # Changelog
2
+
3
+ ## Unreleased
4
+
5
+ ## 0.1.0 - 2026-11-11
6
+
7
+ - Report Rake tasks and managed RSpec progress ([0245b76](https://github.com/cosgroveb/rake-osc7501/commit/0245b76c4f88f18b416e20fccc62f84cfa8b3239))
8
+ - Match the RSpec repository setup ([66bf8e2](https://github.com/cosgroveb/rake-osc7501/commit/66bf8e2962137a025d9f36709d55a10cea52305d))
@@ -0,0 +1,68 @@
1
+ # Code of conduct
2
+
3
+ Everyone who participates in good faith is welcome in rake-osc7501. Treat
4
+ people with respect, regardless of race, ethnicity, caste, color, age, physical
5
+ characteristics, neurodiversity, disability, sex, gender identity or expression,
6
+ sexual orientation, language, philosophy, religion, national or social origin,
7
+ income, education, or other status.
8
+
9
+ ## Working together
10
+
11
+ Respect the project's purpose and other people's time. Discuss ideas without
12
+ attacking people. Make room for different viewpoints and experiences. Give and
13
+ accept constructive feedback. Account for differences in language, culture,
14
+ and communication when interpreting what someone says.
15
+
16
+ Take responsibility for what you submit, including code, reports, and comments
17
+ produced with AI assistance. Review it before sharing, make sure you understand
18
+ it, and respond to questions and corrections. Respect the time others spend
19
+ reviewing your work. Take responsibility for repairing harm you cause.
20
+
21
+ Do not:
22
+
23
+ - Harass people, ignore a request to stop, or violate stated boundaries.
24
+ - Make personal attacks, discriminate, or stereotype people by identity.
25
+ - Make unwanted sexual comments or advances.
26
+ - Share or use someone's private information without permission.
27
+ - Threaten, encourage, or cause violence or other harm.
28
+ - Impersonate someone or evade moderation with another identity.
29
+ - Contribute someone else's work without credit.
30
+ - Post unrelated advertising or present harmful content without appropriate
31
+ context and care.
32
+
33
+ Threatening or encouraging these behaviors also violates this policy. Other
34
+ behavior that threatens the community's well-being may warrant moderation.
35
+ Disagreement alone is not a conduct violation.
36
+
37
+ ## Reporting and enforcement
38
+
39
+ Report concerns privately to Brian Cosgrove at
40
+ [cosgroveb@gmail.com](mailto:cosgroveb@gmail.com). Include what happened and any
41
+ relevant links or messages. Do not post private reports in public issues.
42
+
43
+ I review and investigate reports, hear from the people involved as needed, and
44
+ prioritize safety and confidentiality. I share report details only as needed
45
+ to investigate and respond. I handle enforcement privately and discuss any
46
+ public resolution with the people involved. I respond as availability permits,
47
+ without a guaranteed deadline.
48
+
49
+ Depending on severity and repetition, I may issue a warning, remove content,
50
+ restrict participation, or impose a temporary or permanent ban. Serious
51
+ violations may lead to an immediate ban. Where continued participation is
52
+ appropriate, I explain what needs to change and any conditions for returning.
53
+ These rules apply to maintainers as well as other participants.
54
+
55
+ ## Scope
56
+
57
+ This policy covers project spaces and anyone officially representing the
58
+ project elsewhere, including through project accounts or at events.
59
+
60
+ ## Attribution
61
+
62
+ Adapted from [Contributor Covenant 3.0](https://www.contributor-covenant.org/version/3/0/code_of_conduct/),
63
+ stewarded by the Organization for Ethical Source. This adaptation shortens the
64
+ wording and uses a maintainer-led reporting and enforcement process.
65
+
66
+ This document is licensed under
67
+ [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/).
68
+ The software remains licensed under [Apache License 2.0](LICENSE).
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,122 @@
1
+ # Contributing
2
+
3
+ Follow the [code of conduct](CODE_OF_CONDUCT.md). Report vulnerabilities through
4
+ the private channel in [SECURITY.md](SECURITY.md).
5
+
6
+ AI-assisted contributions are welcome. Before requesting review, understand
7
+ the changes, run relevant checks, and verify claims in code, documentation,
8
+ and reports. State what you tested and what remains uncertain. Be prepared to
9
+ explain your choices and address feedback. When using an agent to help answer
10
+ a reviewer, check the answer and send only what is relevant.
11
+
12
+ Use MRI Ruby 3.4 or newer for development tooling. Install actionlint 1.7.12 on your PATH, then run all checks:
13
+
14
+ ```sh
15
+ bundle install
16
+ bundle exec rake
17
+ ```
18
+
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`,
21
+ or `spec` for individual checks. RuboCop applies default style rules to release tooling and build configuration,
22
+ and correctness cops to existing runtime code, fixtures and smoke tests.
23
+ Scoped exclusions preserve Ruby 2.1 support and exception propagation. Do not add a TODO baseline. Dependency auditing checks the
24
+ lockfile generated by `bundle install`. Keep that lockfile out of commits.
25
+
26
+ Specs run in random order and report their seed. Reproduce an ordering failure
27
+ with `bundle exec rspec --seed <seed>` and narrow it with
28
+ `bundle exec rspec --seed <seed> --bisect`. Generated subprocess fixtures keep a
29
+ defined order because their interrupt and fail-fast cases depend on sequence.
30
+
31
+ Keep runtime dependencies limited to `rake`. Cover task lifecycle behavior with real Rake subprocesses. Check paired RSpec
32
+ reporting with `Gemfile.integration` and `RSPEC_OSC7501_PATH` pointing to a
33
+ checkout that includes `rspec/osc7501/managed.rb`.
34
+
35
+ Build the gem and documentation:
36
+
37
+ ```sh
38
+ bundle exec rake package
39
+ bundle exec rake smoke
40
+ bundle exec rake rdoc
41
+ ```
42
+
43
+ The package is `pkg/rake-osc7501-<version>.gem`. Open `tmp/rdoc/index.html` to check
44
+ rendered documentation. Keep generated files out of commits.
45
+ The smoke task builds and installs the gem in a temporary directory, then checks
46
+ passing and failing tasks without loading the checkout's library.
47
+
48
+ ## Runtime compatibility
49
+
50
+ The gem requires MRI Ruby 2.1 or newer and Rake 12.3.3 or newer.
51
+ Use `Gemfile.compat` to test the runtime without modern lint, release or RDoc
52
+ dependencies. On Ruby 2.1, install Bundler 1.17.3 first. Set the RSpec version
53
+ before resolving dependencies:
54
+
55
+ ```sh
56
+ export BUNDLE_GEMFILE=Gemfile.compat
57
+ export RSPEC_MINOR=3.6
58
+ export RSPEC_CORE_VERSION=3.6.0
59
+ bundle install
60
+ bundle exec rspec spec/rake
61
+ bundle exec gem build rake-osc7501.gemspec
62
+ bundle exec ruby script/smoke.rb rake-osc7501-*.gem
63
+ ```
64
+
65
+ Remove `Gemfile.compat.lock` before changing RSpec versions. Keep it out of commits.
66
+ The compatibility bundle pins diff-lcs 1.3 so test dependencies install on Ruby 2.1.
67
+ CI checks the oldest Ruby against both RSpec endpoints, the oldest RSpec on modern
68
+ Ruby, and the Debian Bullseye and Bookworm version families. These jobs run the
69
+ runtime suite and installed-gem smoke checks. Modern jobs also test release
70
+ automation, lint and documentation.
71
+ CI also checks RSpec 4.0.0.beta1 on Ruby 4.0.
72
+
73
+ Compatibility checks use available patch releases within each Ruby series.
74
+ Supporting an older runtime does not extend its upstream security maintenance.
75
+ Unset `BUNDLE_GEMFILE`, `RSPEC_MINOR`, `RSPEC_CORE_VERSION` and `RSPEC_VERSION`
76
+ before returning to the modern development bundle.
77
+
78
+ Update usage or behavior documentation for user-visible changes. Write commit
79
+ subjects that describe the change, because release notes use those subjects.
80
+ Do not maintain `Unreleased` entries by hand. Preserve the Apache-2.0 license text.
81
+
82
+ ## Release
83
+
84
+ Release the reviewed commits on remote `main`. Replace `NEW_VERSION` with a
85
+ stable version greater than the current release (use `0.1.0` for the first release):
86
+
87
+ ```sh
88
+ gh workflow run release.yml --ref main -f version=NEW_VERSION
89
+ ```
90
+
91
+ The workflow captures `main`, updates `VERSION`, and generates CHANGELOG bullets
92
+ from non-merge commit subjects since the previous release tag. It preserves
93
+ older changelog sections and uses the same notes for the GitHub Release.
94
+ Versions must use `major.minor.patch` without a `v` prefix or prerelease suffix.
95
+ After the first release, a new version must exceed the current version and
96
+ include new commits. The first release accepts the source version and derives
97
+ notes from initial history when no release tags or dated changelog exist.
98
+
99
+ The full CI matrix tests the prepared release commit before the workflow pushes
100
+ it and its tag together. If `main` advances during testing, the workflow stops.
101
+ After the push, it publishes to RubyGems, then creates the GitHub Release. No
102
+ intermediate approval is required.
103
+
104
+ If a release fails, inspect its logs and rerun the same version. If its tag
105
+ already exists, the workflow tests and resumes that tagged release instead of
106
+ releasing newer commits on `main`.
107
+
108
+ ### One-time publishing setup
109
+
110
+ Before the first publication, configure a RubyGems pending Trusted Publisher with owner `cosgroveb`,
111
+ repository `rake-osc7501`, and workflow `release.yml`. Leave the environment
112
+ blank. The workflow uses short-lived OIDC credentials, with no RubyGems token
113
+ stored in GitHub secrets. Repository Actions permissions must permit the
114
+ workflow's `contents: write` and `id-token: write` requests.
115
+
116
+ Store a dedicated write-enabled repository deploy key as the Actions secret
117
+ `RELEASE_DEPLOY_KEY`. Only the publish job uses it to push the tested commit
118
+ and tag. Require PRs and CI checks in a separate ruleset with deploy-key bypass,
119
+ and keep deletion and force-push protection in a ruleset without bypasses.
120
+ GitHub applies this bypass to all repository deploy keys, so additional write
121
+ deploy keys would receive the same access. GitHub API calls still use the
122
+ workflow token, and RubyGems still uses OIDC.
data/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,120 @@
1
+ # rake-osc7501
2
+
3
+ Add OSC 7501 terminal status to ordinary Rake tasks.
4
+
5
+ ```ruby
6
+ # Gemfile
7
+ gem 'rake-osc7501'
8
+ ```
9
+
10
+ ```ruby
11
+ # Rakefile
12
+ require 'rake/osc7501'
13
+
14
+ task(:example) { sleep 5 }
15
+ task default: :example
16
+ ```
17
+
18
+ Run `bundle exec rake`. A supporting terminal receives one named Rake record
19
+ with task activity and the command's outcome. Ordinary command output continues.
20
+ Rake-only projects need no RSpec dependencies.
21
+
22
+ ## RSpec tasks
23
+
24
+ RubyGems release `rspec-osc7501` 0.1.3 does not include the managed entrypoint.
25
+ Until a gem release includes it, pin the reviewed companion commit in your Gemfile:
26
+
27
+ ```ruby
28
+ gem 'rspec-osc7501', git: 'https://github.com/cosgroveb/rspec-osc7501.git',
29
+ ref: '098bb55433dd05265910995b2c349e4db99869bb'
30
+ ```
31
+
32
+ Run `bundle install`, then load the standard RSpec task class before this integration:
33
+
34
+ ```ruby
35
+ require 'rspec/core/rake_task'
36
+ require 'rake/osc7501'
37
+
38
+ RSpec::Core::RakeTask.new(:spec)
39
+ task(:example) { sleep 5 }
40
+ task default: [:example, :spec]
41
+ ```
42
+
43
+ Existing and later-created standard tasks receive a unique child record for each
44
+ invocation. Automatic selection preserves RSpec's default progress formatter and
45
+ configured formatters, including their output files. An explicit OSC formatter
46
+ keeps its destination and receives no duplicate.
47
+
48
+ Missing or older `rspec-osc7501` installations without `rspec/osc7501/managed.rb`
49
+ leave the original RSpec command intact. Custom runners and reverse require order
50
+ receive generic Rake reporting. Direct `rspec` commands still need explicit OSC
51
+ formatter selection.
52
+
53
+ The adapter passes child context through the spawn environment. It preserves
54
+ parent environment variables and task options. RSpec's clean-environment option,
55
+ where available, receives only the child ID and explicit `RSPEC_OSC7501`,
56
+ `RSPEC_OSC7501_TITLE`, and `TERM` controls.
57
+
58
+ ## Output controls
59
+
60
+ | Setting | Behavior |
61
+ | --- | --- |
62
+ | `RAKE_OSC7501=auto` | Default. Report to stdout only when it is a TTY and `TERM` is not `dumb`. |
63
+ | `RAKE_OSC7501=force` | Report to stdout even when redirected. |
64
+ | `RAKE_OSC7501=off` | Disable Rake reporting and automatic RSpec activation. |
65
+
66
+ Other values raise `ArgumentError`. Explicit RSpec selections retain their own
67
+ `RSPEC_OSC7501` controls. Automatic child activation does not depend on the
68
+ parent's TTY because each child honors its RSpec-selected stream.
69
+
70
+ ## Outcomes and limits
71
+
72
+ Rake reports active task actions without a percentage. Overlapping actions show
73
+ an active count. Skipped file tasks, deduplicated invocations, task listings and
74
+ dry runs do not report executed work.
75
+
76
+ Normal completion reports `done`. Exceptions and nonzero `SystemExit` report
77
+ `error`. `Interrupt` and successful early `SystemExit` report `idle`. Reporting
78
+ preserves Rake's scheduling, exceptions and exit behavior.
79
+
80
+ Child results remain after the child and parent finish. A passing suite followed
81
+ by a failing Rake task retains the passing child and failed parent. With
82
+ `fail_on_error = false`, a failed child can accompany a successful parent.
83
+ No completion clears records.
84
+
85
+ Rake covers task execution after activation. Failures before activation or in
86
+ later process-exit handlers fall outside that result. Abrupt child termination
87
+ can leave a working record without a summary. A child summary can precede a
88
+ process failure. Rake reports the process outcome without inventing test results.
89
+
90
+ Frames stay below 4096 bytes. Messages contain sanitized UTF-8, capped at 2048
91
+ decoded bytes. Stream errors disable reporting without closing caller streams.
92
+ The gems install no process-wide exit or signal hooks and read no terminal input.
93
+ Terminals control display, dismissal and notifications. Live Rex presentation
94
+ has not been verified.
95
+
96
+ ## Compatibility and development
97
+
98
+ Runtime targets MRI Ruby >= 2.1 and Rake >= 12.3.3. The optional adapter targets
99
+ RSpec >= 3.6. The oldest paired check uses Ruby 2.1.10, Rake 12.3.3 and RSpec 3.6.0.
100
+ Linux checks also cover Ruby 2.7, 3.1, 3.3, 3.4 and 4.0 with compatible RSpec
101
+ versions, including RSpec 4.0.0.beta1 on Ruby 4.0. RSpec 3.6 has no
102
+ clean-environment option. Other Ruby engines and macOS are unverified.
103
+
104
+ On modern Ruby:
105
+
106
+ ```sh
107
+ bundle install
108
+ bundle exec rake
109
+ RSPEC_OSC7501_PATH=../rspec-osc7501 BUNDLE_GEMFILE=Gemfile.integration bundle install
110
+ BUNDLE_GEMFILE=Gemfile.integration bundle exec rake spec
111
+ bundle exec ruby script/smoke.rb pkg/rake-osc7501-*.gem
112
+ ```
113
+
114
+ `rake types` checks method annotation coverage across authored Ruby files,
115
+ generates inline RBS with pinned development tools, and validates signatures.
116
+ Generated signatures stay in ignored `tmp/`. See [CONTRIBUTING.md](CONTRIBUTING.md)
117
+ for lint, dependency audit, workflow checks and release setup. This check validates declarations,
118
+ not implementation type consistency. Compatibility checks use `Gemfile.compat`
119
+ without type tooling. Pass an RSpec gem package as the smoke script's second
120
+ argument to check installed parent/child reporting.
data/SECURITY.md ADDED
@@ -0,0 +1,22 @@
1
+ # Security policy
2
+
3
+ ## Supported versions
4
+
5
+ I provide security fixes for the latest released version of rake-osc7501.
6
+ Upgrade to the latest release before checking whether a problem still occurs.
7
+ Older releases do not receive security backports.
8
+
9
+ ## Report a vulnerability
10
+
11
+ Use [GitHub private vulnerability reporting](https://github.com/cosgroveb/rake-osc7501/security/advisories/new).
12
+ Do not disclose vulnerabilities in public issues or pull requests.
13
+
14
+ Include the affected gem, Ruby, Rake, and optional RSpec versions, steps or a small example
15
+ that reproduces the problem, and the impact. Include terminal and tmux versions
16
+ when relevant. Remove credentials and unrelated private data from examples.
17
+
18
+ I review reports and coordinate a fix and public disclosure with the reporter.
19
+ Please keep details private while we work out disclosure. I cannot guarantee
20
+ response or fix deadlines.
21
+
22
+ For ordinary bugs, use the [issue tracker](https://github.com/cosgroveb/rake-osc7501/issues).
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+ # rbs_inline: enabled
3
+
4
+ module Rake
5
+ module OSC7501
6
+ module ApplicationHook
7
+ attr_reader :osc7501_run #: Run?
8
+
9
+ #: () -> Object
10
+ def top_level
11
+ return super if options.show_tasks || options.show_prereqs || options.dryrun
12
+
13
+ previous = @osc7501_run
14
+ begin
15
+ @osc7501_run = Run.new($stdout, mode: ENV.fetch('RAKE_OSC7501', 'auto'))
16
+ @osc7501_run.during_run { super }
17
+ ensure
18
+ @osc7501_run = previous
19
+ end
20
+ end
21
+ end
22
+
23
+ module TaskHook
24
+ #: (?Object args) ?{ (*Object) -> Object } -> Object
25
+ def execute(args = nil, &block)
26
+ run = application.osc7501_run if application.respond_to?(:osc7501_run)
27
+ return super unless run
28
+
29
+ run.during_task(self) { super(args, &block) }
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+ # rbs_inline: enabled
3
+
4
+ require 'shellwords'
5
+
6
+ module Rake
7
+ module OSC7501
8
+ # Wrap only the standard RSpec task's launch; keep its status handling intact.
9
+ module RSpecTask
10
+ # @rbs @osc7501_context: [String, String]?
11
+
12
+ #: (bool) -> Object
13
+ def run_task(verbose)
14
+ previous = @osc7501_context
15
+ begin
16
+ run = Rake.application.osc7501_run if Rake.application.respond_to?(:osc7501_run)
17
+ path = managed_path if run && run.managed_children?
18
+ @osc7501_context = path ? [run.next_child_id, path] : nil
19
+ super
20
+ ensure
21
+ @osc7501_context = previous
22
+ end
23
+ end
24
+
25
+ #: () -> (String | Array[String] | nil)
26
+ def ruby_opts
27
+ options = super
28
+ return options unless @osc7501_context
29
+
30
+ [*options, "-r#{Shellwords.escape(@osc7501_context.last)}"]
31
+ end
32
+
33
+ private
34
+
35
+ #: () -> String?
36
+ def managed_path
37
+ return unless rspec_path == RSpec::Core::RakeTask::DEFAULT_RSPEC_PATH
38
+
39
+ specification = Gem.loaded_specs['rspec-osc7501'] || Gem::Specification.find_all_by_name('rspec-osc7501').first
40
+ return unless specification
41
+
42
+ path = File.join(specification.full_gem_path, 'lib/rspec/osc7501/managed.rb')
43
+ path if File.file?(path)
44
+ end
45
+
46
+ #: (*Object) -> bool?
47
+ def system(*arguments)
48
+ return super unless @osc7501_context
49
+
50
+ environment = arguments.first.is_a?(Hash) ? arguments.shift.dup : {}
51
+ environment['RSPEC_OSC7501_ID'] = @osc7501_context.first
52
+ %w[RSPEC_OSC7501 RSPEC_OSC7501_TITLE TERM].each do |key|
53
+ environment[key] = ENV[key] if ENV.key?(key) && !environment.key?(key)
54
+ end
55
+ super(environment, *arguments)
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,100 @@
1
+ # frozen_string_literal: true
2
+ # rbs_inline: enabled
3
+
4
+ require 'securerandom'
5
+ require 'thread'
6
+
7
+ module Rake
8
+ module OSC7501
9
+ # @rbs!
10
+ # interface _TaskName
11
+ # def name: () -> String
12
+ # end
13
+
14
+ class Run
15
+ # @rbs @active: Array[_TaskName]
16
+ # @rbs @counter: Integer
17
+ # @rbs @mutex: Mutex
18
+ # @rbs @id: String
19
+ # @rbs @writer: Writer
20
+ # @rbs @mode: String
21
+ # @rbs @finished: bool
22
+
23
+ #: (IO | StringIO output, mode: String) -> void
24
+ def initialize(output, mode:)
25
+ @mode = mode
26
+ @id = "rake-#{Process.pid}-#{SecureRandom.hex(6)}"
27
+ @writer = Writer.new(output, mode: mode, id: @id)
28
+ @finished = false
29
+ @active = []
30
+ @counter = 0
31
+ @mutex = Mutex.new
32
+ end
33
+
34
+ #: [T] () { () -> T } -> T
35
+ def during_run
36
+ @writer.emit(state: 'working', msg: 'Running tasks')
37
+ result = yield
38
+ finish('done', 'Completed')
39
+ result
40
+ rescue Exception => e # Preserve Rake's handling of Interrupt and SystemExit.
41
+ stopped = e.is_a?(Interrupt) || (e.is_a?(SystemExit) && e.success?)
42
+ finish(stopped ? 'idle' : 'error', stopped ? 'Stopped' : 'Failed')
43
+ raise
44
+ end
45
+
46
+ #: [T] (_TaskName) { () -> T } -> T
47
+ def during_task(task)
48
+ @mutex.synchronize do
49
+ @active << task
50
+ report_active
51
+ end
52
+ begin
53
+ yield
54
+ ensure
55
+ @mutex.synchronize do
56
+ @active.delete_at(@active.rindex(task))
57
+ report_active
58
+ end
59
+ end
60
+ end
61
+
62
+ #: () -> String
63
+ def next_child_id
64
+ @mutex.synchronize do
65
+ @counter += 1
66
+ "#{@id}/rspec-#{@counter}"
67
+ end
68
+ end
69
+
70
+ #: () -> bool
71
+ def managed_children?
72
+ @mode != 'off'
73
+ end
74
+
75
+ private
76
+
77
+ #: (String, String) -> void
78
+ def finish(state, message)
79
+ @mutex.synchronize do
80
+ @finished = true
81
+ @writer.emit(state: state, msg: message)
82
+ end
83
+ end
84
+
85
+ #: () -> void
86
+ def report_active
87
+ return if @finished
88
+
89
+ message = if @active.empty?
90
+ 'Running tasks'
91
+ elsif @active.length == 1
92
+ @active.first.name
93
+ else
94
+ "#{@active.length} active tasks"
95
+ end
96
+ @writer.emit(state: 'working', msg: message)
97
+ end
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+ # rbs_inline: enabled
3
+
4
+ module Rake
5
+ module OSC7501
6
+ VERSION = '0.1.0' #: String
7
+ end
8
+ end
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+ # rbs_inline: enabled
3
+
4
+ module Rake
5
+ module OSC7501
6
+ class Writer # :nodoc: all
7
+ # @rbs @output: IO | StringIO
8
+ # @rbs @id: String
9
+ # @rbs @enabled: bool
10
+ #: (String?) -> bool
11
+ def self.valid_id?(id)
12
+ id.is_a?(String) && id.ascii_only? && id.bytesize <= 128 &&
13
+ !!(id =~ %r{\A[A-Za-z0-9_.+-]{1,32}(?:/[A-Za-z0-9_.+-]{1,32}){0,7}\z})
14
+ end
15
+
16
+ #: (IO | StringIO output, mode: String, id: String) -> void
17
+ def initialize(output, mode:, id:)
18
+ raise ArgumentError, 'RAKE_OSC7501 must be auto, off, or force' unless %w[auto off force].include?(mode)
19
+
20
+ @output = output
21
+ @id = id
22
+ @enabled = self.class.valid_id?(id) &&
23
+ (mode == 'force' || (mode == 'auto' && automatic_output?))
24
+ rescue IOError, SystemCallError
25
+ @enabled = false
26
+ end
27
+
28
+ #: (state: String, msg: String) -> void
29
+ def emit(state:, msg:)
30
+ return unless @enabled
31
+
32
+ fields = ['app=rake', 'title=UmFrZQ==', "state=#{state}", "msg=#{encode(msg, 2048)}"]
33
+ fields << "id=#{@id}" if @id
34
+ @output.write("\e]7501;#{fields.join(':')}\e\\")
35
+ @output.flush if @output.respond_to?(:flush)
36
+ rescue IOError, SystemCallError
37
+ @enabled = false
38
+ end
39
+
40
+ private
41
+
42
+ #: () -> bool
43
+ def automatic_output?
44
+ ENV['TERM'] != 'dumb' && @output.respond_to?(:tty?) && @output.tty?
45
+ end
46
+
47
+ #: (String, Integer) -> String
48
+ def encode(text, byte_limit)
49
+ input = text.to_s.byteslice(0, sanitization_byte_limit(byte_limit))
50
+ clean = input.encode('UTF-8', invalid: :replace, undef: :replace).gsub(/[\u0000-\u001F\u007F-\u009F]/, '')
51
+ bytes = 0
52
+ bounded = clean.each_char.take_while do |char|
53
+ bytes += char.bytesize
54
+ bytes <= byte_limit
55
+ end.join
56
+ [bounded].pack('m0')
57
+ end
58
+
59
+ # Bound sanitization work with 50% headroom for stripped controls.
60
+ #: (Integer) -> Integer
61
+ def sanitization_byte_limit(output_byte_limit)
62
+ output_byte_limit + output_byte_limit / 2
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+ # rbs_inline: enabled
3
+
4
+ require 'rake'
5
+ require_relative 'osc7501/version'
6
+ require_relative 'osc7501/writer'
7
+ require_relative 'osc7501/run'
8
+ require_relative 'osc7501/hooks'
9
+
10
+ module Rake
11
+ module OSC7501
12
+ #: (?Object application) -> void
13
+ def self.install!(application = Rake.application)
14
+ application.extend(ApplicationHook) unless application.is_a?(ApplicationHook)
15
+ Rake::Task.prepend(TaskHook) unless Rake::Task.ancestors.include?(TaskHook)
16
+ return unless defined?(RSpec::Core::RakeTask)
17
+
18
+ require_relative 'osc7501/rspec_task'
19
+ RSpec::Core::RakeTask.prepend(RSpecTask) unless RSpec::Core::RakeTask.ancestors.include?(RSpecTask)
20
+ end
21
+ end
22
+ end
23
+
24
+ Rake::OSC7501.install!
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rake-osc7501
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Brian Cosgrove
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: rake
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: 12.3.3
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: 12.3.3
26
+ description: Reports Rake task activity and outcomes through OSC 7501.
27
+ email:
28
+ - cosgroveb@users.noreply.github.com
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - ACCESSIBILITY.md
34
+ - CHANGELOG.md
35
+ - CODE_OF_CONDUCT.md
36
+ - CONTRIBUTING.md
37
+ - LICENSE
38
+ - README.md
39
+ - SECURITY.md
40
+ - lib/rake/osc7501.rb
41
+ - lib/rake/osc7501/hooks.rb
42
+ - lib/rake/osc7501/rspec_task.rb
43
+ - lib/rake/osc7501/run.rb
44
+ - lib/rake/osc7501/version.rb
45
+ - lib/rake/osc7501/writer.rb
46
+ homepage: https://github.com/cosgroveb/rake-osc7501
47
+ licenses:
48
+ - Apache-2.0
49
+ metadata:
50
+ source_code_uri: https://github.com/cosgroveb/rake-osc7501
51
+ bug_tracker_uri: https://github.com/cosgroveb/rake-osc7501/issues
52
+ changelog_uri: https://github.com/cosgroveb/rake-osc7501/blob/main/CHANGELOG.md
53
+ rdoc_options: []
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '2.1'
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ requirements: []
67
+ rubygems_version: 3.6.9
68
+ specification_version: 4
69
+ summary: Opt-in OSC 7501 terminal status for Rake tasks
70
+ test_files: []