minitest-flash 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 45843ba5a15f1ed1ac8b516a3c98b37db272d6d151b52920a94b1d274c5a301a
4
+ data.tar.gz: 579b725590cda01c4e5fc251757615972eef9188eb4c2d941953655eec43bff8
5
+ SHA512:
6
+ metadata.gz: 45e33fc268707560c25097c7cee70085e7007de8265d741c7dd4188fa6492bb299e5b74bed0f56a94ed6115c5e4ef9acf34fbfe7d29618e1f448bd055d9ff3b2
7
+ data.tar.gz: 8a404161ea44fbb6c4293f4e0edd58c637eecfc77d479cb562e492d9b415858c392b3862593d76964d861f2e3fcfb90dd08b29c20afba238a2c27ac6cc1a3614
checksums.yaml.gz.sig ADDED
Binary file
data/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ ## Main
2
+
3
+ Nothing so far
4
+
5
+ ## 0.1.0
6
+
7
+ #### Initial Implementation
8
+ * Require Ruby 3
9
+ * Reporter which calls `minitest-flash` executable if present
10
+ * Demo sound effects
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Sven Schwyn
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,114 @@
1
+ [![Version](https://img.shields.io/gem/v/minitest-flash.svg?style=flat)](https://rubygems.org/gems/minitest-flash)
2
+ [![Tests](https://img.shields.io/github/actions/workflow/status/svoop/minitest-flash/test.yml?style=flat&label=tests)](https://github.com/svoop/minitest-flash/actions?workflow=Test)
3
+ [![Code Climate](https://img.shields.io/codeclimate/maintainability/svoop/minitest-flash.svg?style=flat)](https://codeclimate.com/github/svoop/minitest-flash/)
4
+ [![Donorbox](https://img.shields.io/badge/donate-on_donorbox-yellow.svg)](https://donorbox.org/bitcetera)
5
+
6
+ # Minitest::Flash
7
+
8
+ Simple Minitest reporter to indicate the result of test runs in as fancy a way you like. Here's how I like it: Flash the macOS menu bar in green or red and play a short and mutable sound effect.
9
+
10
+ * [Homepage](https://github.com/svoop/minitest-flash)
11
+ * [API](https://www.rubydoc.info/gems/minitest-flash)
12
+ * Author: [Sven Schwyn - Bitcetera](https://bitcetera.com)
13
+
14
+ ## Install
15
+
16
+ This gem is [cryptographically signed](https://guides.rubygems.org/security/#using-gems) in order to assure it hasn't been tampered with. Unless already done, please add the author's public key as a trusted certificate now:
17
+
18
+ ```
19
+ gem cert --add <(curl -Ls https://raw.github.com/svoop/minitest-flash/main/certs/svoop.pem)
20
+ ```
21
+
22
+ Add the following to the <tt>Gemfile</tt> or <tt>gems.rb</tt> of your [Bundler](https://bundler.io) powered Ruby project:
23
+
24
+ ```ruby
25
+ gem 'minitest-flash'
26
+ ```
27
+
28
+ And then install the bundle:
29
+
30
+ ```
31
+ bundle install --trust-policy MediumSecurity
32
+ ```
33
+
34
+ Finally, require this gem in your `test_helper.rb` or `spec_helper.rb`:
35
+
36
+ ```ruby
37
+ require 'minitest/flash'
38
+ ```
39
+
40
+ ## Usage
41
+
42
+ After every test run, the reporter simply invokes the `minitest-flash` executable:
43
+
44
+ * `minitest-flash green` if the run passed
45
+ * `minitest-flash red` if the run failed or has errors
46
+
47
+ It's your job to create the `minitest-flash` executable to your liking and to place it somewhere in the `PATH`.
48
+
49
+ Other people might work on the same code and prefer not use `minitest-flash`. This is no problem as it won't do a thing unless a `minitest-flash` executable exists.
50
+
51
+ ## Example
52
+
53
+ I'm on macOS and like things to be as obvious and unobtrusive as possible: Flash the menu bar either in green or red and optionally play a sound effect.
54
+
55
+ ![Screenshot](https://github.com/svoop/minitest-flash/raw/main/doc/screenshot.gif)
56
+
57
+ Here's what my `/usr/local/bin/minitest-flash` executable looks like:
58
+
59
+ ```zsh
60
+ #!/bin/zsh
61
+
62
+ declare -A colors
63
+ colors[red]=bb0000
64
+ colors[green]=00bb00
65
+
66
+ if [ -z "$MINITEST_FLASH_NO_SOUND" ]; then
67
+ mpg123 $0.d/$1.mp3 2>/dev/null &
68
+ fi
69
+
70
+ for i in {1..2}; do
71
+ $0.d/ChangeMenuBarColor SolidColor "$colors[$1]" >/dev/null
72
+ $0.d/ChangeMenuBarColor SolidColor "000000" >/dev/null
73
+ done
74
+ ```
75
+
76
+ As you see, the sound effects can easily be muted with:
77
+
78
+ ```zsh
79
+ export MINITEST_FLASH_NO_SOUND=1
80
+ ```
81
+
82
+ For the above to work, you have to install `mpg123` easiest through [Homebrew](https://brew.sh/):
83
+
84
+ ```zsh
85
+ brew install mpg123
86
+ ```
87
+
88
+ A few support files are also necessary, let's create the directory for them:
89
+
90
+ ```zsh
91
+ sudo mkdir /usr/local/bin/minitest-flash.d
92
+ ```
93
+
94
+ In there you have to put three files:
95
+
96
+ * the latest binary release of [ChangeMenuBarColor](https://github.com/igorkulman/ChangeMenuBarColor)
97
+ * a [sound file `green.mp3`](https://github.com/svoop/minitest-flash/raw/main/doc/green.mp3) for successful runs
98
+ * a [sound file `red.mp3`](https://github.com/svoop/minitest-flash/raw/main/doc/red.mp3) for failed or errored runs
99
+
100
+ ## Development
101
+
102
+ To install the development dependencies and then run the test suite:
103
+
104
+ ```
105
+ bundle install
106
+ bundle exec rake # run tests once
107
+ bundle exec guard # run tests whenever files are modified
108
+ ```
109
+
110
+ You're welcome to [submit issues](https://github.com/svoop/minitest-flash/issues) and contribute code by [forking the project and submitting pull requests](https://docs.github.com/en/get-started/quickstart/fork-a-repo).
111
+
112
+ ## License
113
+
114
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Minitest
4
+ module Flash
5
+ class Reporter < StatisticsReporter
6
+ def report
7
+ super
8
+ begin
9
+ `minitest-flash #{test_color}`
10
+ rescue Errno::ENOENT
11
+ end
12
+ end
13
+
14
+ def test_color
15
+ errors == 0 && failures == 0 ? :green : :red
16
+ end
17
+
18
+ # When using the following methods together with `minitest-reporters`,
19
+ # they are required.
20
+ def add_defaults(defaults); end
21
+ def before_test(test); end
22
+ def after_test(test); end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Minitest
4
+ module Flash
5
+ VERSION = "0.1.0"
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'flash/version'
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'flash'
4
+ require_relative 'flash/reporter'
5
+
6
+ module Minitest
7
+ def self.plugin_flash_init(*)
8
+ self.reporter << Minitest::Flash::Reporter.new
9
+ end
10
+ end
data.tar.gz.sig ADDED
Binary file
metadata ADDED
@@ -0,0 +1,203 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: minitest-flash
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Sven Schwyn
8
+ autorequire:
9
+ bindir: bin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vrVbGP
28
+ DyYhlBeRWyQKQ0WDIsiTSRhzK8HwSTUWjvPwx7SEdIU/HZgyrk0ETObKPakVu6bH
29
+ kAyiRqgxF4dJviwtqI7mZIomWL63+kXLgjOjMe1SHxfIPo/0ji6+r1p4KYa7o41v
30
+ fwIwU1MKlFBdsjkd
31
+ -----END CERTIFICATE-----
32
+ date: 2023-08-16 00:00:00.000000000 Z
33
+ dependencies:
34
+ - !ruby/object:Gem::Dependency
35
+ name: minitest
36
+ requirement: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '5'
41
+ type: :runtime
42
+ prerelease: false
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '5'
48
+ - !ruby/object:Gem::Dependency
49
+ name: debug
50
+ requirement: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rake
64
+ requirement: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ type: :development
70
+ prerelease: false
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ - !ruby/object:Gem::Dependency
77
+ name: minitest
78
+ requirement: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ type: :development
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ - !ruby/object:Gem::Dependency
91
+ name: minitest-focus
92
+ requirement: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ type: :development
98
+ prerelease: false
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ - !ruby/object:Gem::Dependency
105
+ name: guard
106
+ requirement: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ type: :development
112
+ prerelease: false
113
+ version_requirements: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ - !ruby/object:Gem::Dependency
119
+ name: guard-minitest
120
+ requirement: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ type: :development
126
+ prerelease: false
127
+ version_requirements: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ - !ruby/object:Gem::Dependency
133
+ name: yard
134
+ requirement: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ type: :development
140
+ prerelease: false
141
+ version_requirements: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ description: |
147
+ Simple Minitest reporter to indicate the result of test runs. After every
148
+ test run, the reporter invokes the `minitest-flash` executable (created by
149
+ you and to your liking) with either the argument "green" or "red" to reflect
150
+ the result of the run.
151
+ email:
152
+ - ruby@bitcetera.com
153
+ executables: []
154
+ extensions: []
155
+ extra_rdoc_files:
156
+ - README.md
157
+ - CHANGELOG.md
158
+ - LICENSE.txt
159
+ files:
160
+ - CHANGELOG.md
161
+ - LICENSE.txt
162
+ - README.md
163
+ - lib/minitest/flash.rb
164
+ - lib/minitest/flash/reporter.rb
165
+ - lib/minitest/flash/version.rb
166
+ - lib/minitest/flash_plugin.rb
167
+ homepage: https://github.com/svoop/minitest-flash
168
+ licenses:
169
+ - MIT
170
+ metadata:
171
+ homepage_uri: https://github.com/svoop/minitest-flash
172
+ changelog_uri: https://github.com/svoop/minitest-flash/blob/main/CHANGELOG.md
173
+ source_code_uri: https://github.com/svoop/minitest-flash
174
+ documentation_uri: https://www.rubydoc.info/gems/minitest-flash
175
+ bug_tracker_uri: https://github.com/svoop/minitest-flash/issues
176
+ post_install_message:
177
+ rdoc_options:
178
+ - "--title"
179
+ - Minitest::Flash
180
+ - "--main"
181
+ - README.md
182
+ - "--line-numbers"
183
+ - "--inline-source"
184
+ - "--quiet"
185
+ require_paths:
186
+ - lib
187
+ required_ruby_version: !ruby/object:Gem::Requirement
188
+ requirements:
189
+ - - ">="
190
+ - !ruby/object:Gem::Version
191
+ version: 3.0.0
192
+ required_rubygems_version: !ruby/object:Gem::Requirement
193
+ requirements:
194
+ - - ">="
195
+ - !ruby/object:Gem::Version
196
+ version: '0'
197
+ requirements: []
198
+ rubygems_version: 3.4.18
199
+ signing_key:
200
+ specification_version: 4
201
+ summary: Simple Minitest reporter to indicate the result of test runs in as fancy
202
+ a way you like
203
+ test_files: []
metadata.gz.sig ADDED
Binary file