rake_announcer 1.0.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: 9f033924b9e95ad1947563291a063111eb9f4e66de47bdcc12ab6561fd375e7d
4
+ data.tar.gz: 65250075c28fec5daf1f647f092b6c55f0814e40cb0acaa29a636191a484a7cf
5
+ SHA512:
6
+ metadata.gz: 78e89dfdc50c1e3d7dfea87a4fa91230d6264dbdc938b7ec4267bf066ad2ee067475036539fca0388ae05f07c8c5620af1f0a5c3b8167b6797fa24a72658863f
7
+ data.tar.gz: 608a4bb5122aa8b6081881cbc2d5ab2d90c3c66905613f4a78a43109efd57b3683989b8a650c665463ffe6dde95cd56fc7cd2a45cc0fa4a901def36e2d2db17c
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ## 1.0.0 (06 February 2025)
2
+
3
+ - Initial release
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 David Bull
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # RakeAnnouncer
2
+
3
+ [![Build Status](https://github.com/ukdave/rake_announcer/actions/workflows/main.yml/badge.svg)](https://github.com/ukdave/rake_announcer/actions/workflows/main.yml)
4
+ [![Release](https://img.shields.io/github/v/release/ukdave/rake_announcer)](https://github.com/ukdave/rake_announcer/releases)
5
+ [![License](https://img.shields.io/github/license/ukdave/rake_announcer)](https://github.com/ukdave/rake_announcer/blob/main/LICENSE.txt)
6
+
7
+ A small gem to enhance existing rake tasks by printing a brief message before each one is invoked. The list of tasks to wrap/enhance is configurable. Also included is a task to print a simple and colourful "All Tests Passed" message.
8
+
9
+ This gem was inspired by [Rake-n-Bake](https://github.com/RichardVickerstaff/rake-n-bake).
10
+
11
+ ![Screenshot](screenshot.png?raw=true "Screenshot")
12
+
13
+ ## Installation
14
+
15
+ Install the gem and add to the application's Gemfile by executing:
16
+
17
+ ```bash
18
+ bundle add rake_announcer
19
+ ```
20
+
21
+ If bundler is not being used to manage dependencies, install the gem by executing:
22
+
23
+ ```bash
24
+ gem install rake_announcer
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ Add the following to your Rakefile:
30
+
31
+ ```ruby
32
+ require "rake_announcer/rake_task"
33
+ RakeAnnouncer::RakeTask.new(tasks: %i[spec rubocop])
34
+ ```
35
+
36
+ Include the names of any rake tasks that you want announced in the `tasks` array. The above example will print a message before the `spec` and `rubocop` tasks.
37
+
38
+ You can also print a simple "All Tests Passed" message by adding the `rake_announcer:ok` task, e.g.:
39
+
40
+ ```ruby
41
+ task default: %i[spec rubocop rake_announcer:ok]
42
+ ```
43
+
44
+ ## Development
45
+
46
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
47
+
48
+ To install this gem onto your local machine, run `bundle exec rake install`.
49
+
50
+ To release a new version, run `bundle exec rake semver:XXX` (replacing `XXX` with `major` or `minor` or `patch`), which will bump the version number and create a git tag for the version. Then run `bundle exec rake release`, which will push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
51
+
52
+ ## Contributing
53
+
54
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ukdave/rake_announcer.
55
+
56
+ ## License
57
+
58
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rake/tasklib"
4
+ require "rake_announcer"
5
+
6
+ module RakeAnnouncer
7
+ class RakeTask < Rake::TaskLib
8
+ def initialize(name: :rake_announcer, tasks: [])
9
+ super()
10
+
11
+ namespace name do
12
+ tasks.each do |t|
13
+ RakeAnnouncer.enhance_rake_task(t)
14
+ end
15
+
16
+ desc "Print the 'ALL TESTS PASSED' message"
17
+ task :ok do
18
+ RakeAnnouncer.ok
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RakeAnnouncer
4
+ VERSION = "1.0.0"
5
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rake"
4
+ require "term/ansicolor"
5
+ require_relative "rake_announcer/version"
6
+
7
+ module RakeAnnouncer
8
+ class Error < StandardError; end
9
+
10
+ def self.enhance_rake_task(task_name)
11
+ announce_task = Rake::Task.define_task("announce_#{task_name}") do
12
+ RakeAnnouncer.announce("Running #{task_name}")
13
+ end
14
+ Rake::Task[task_name].enhance([announce_task.name])
15
+ end
16
+
17
+ def self.announce(message)
18
+ puts "\n#{Term::ANSIColor.blue}#{Term::ANSIColor.underline}● #{message}#{Term::ANSIColor.reset}"
19
+ end
20
+
21
+ # rubocop:disable Metrics/MethodLength
22
+ def self.ok(message = "ALL TESTS PASSED")
23
+ puts
24
+ print Term::ANSIColor.bold,
25
+ Term::ANSIColor.red, "*",
26
+ Term::ANSIColor.yellow, "*",
27
+ Term::ANSIColor.green, "*",
28
+ Term::ANSIColor.blue, "*",
29
+ Term::ANSIColor.magenta, "*",
30
+ Term::ANSIColor.green, " #{message} ",
31
+ Term::ANSIColor.magenta, "*",
32
+ Term::ANSIColor.blue, "*",
33
+ Term::ANSIColor.green, "*",
34
+ Term::ANSIColor.yellow, "*",
35
+ Term::ANSIColor.red, "*",
36
+ Term::ANSIColor.clear
37
+ puts
38
+ end
39
+ # rubocop:enable Metrics/MethodLength
40
+ end
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rake_announcer
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - David Bull
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 2025-02-06 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: '13'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '13'
26
+ - !ruby/object:Gem::Dependency
27
+ name: term-ansicolor
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '1.11'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.11'
40
+ description: |
41
+ A small gem to enhance existing rake tasks by printing a brief message before each one is invoked. The list of tasks
42
+ to wrap/enhance is configurable. Also included is a task to print a simple and colourful "All Tests Passed" message.
43
+ email:
44
+ - david@uk-dave.com
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - CHANGELOG.md
50
+ - LICENSE.txt
51
+ - README.md
52
+ - lib/rake_announcer.rb
53
+ - lib/rake_announcer/rake_task.rb
54
+ - lib/rake_announcer/version.rb
55
+ homepage: https://github.com/ukdave/rake_announcer
56
+ licenses:
57
+ - MIT
58
+ metadata:
59
+ homepage_uri: https://github.com/ukdave/rake_announcer
60
+ source_code_uri: https://github.com/ukdave/rake_announcer
61
+ changelog_uri: https://github.com/ukdave/rake_announcer/blob/main/CHANGELOG.md
62
+ rubygems_mfa_required: 'true'
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: 3.1.0
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubygems_version: 3.6.2
78
+ specification_version: 4
79
+ summary: Print a message before each rake task
80
+ test_files: []