lolcommits-loltext 0.5.0 → 0.5.1
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/.github/workflows/ci.yml +56 -0
- data/.quickhook/pre-commit/ruby-lint +3 -0
- data/.rubocop.yml +2 -0
- data/CHANGELOG.md +8 -1
- data/Gemfile +5 -1
- data/README.md +28 -33
- data/Rakefile +1 -1
- data/bin/rubocop +5 -0
- data/lib/lolcommits/loltext/version.rb +1 -1
- data/lib/lolcommits/loltext.rb +2 -2
- data/lib/lolcommits/plugin/loltext.rb +41 -42
- data/lolcommits-loltext.gemspec +6 -5
- data/test/lolcommits/plugin/loltext_test.rb +113 -0
- data/test/test_helper.rb +17 -0
- metadata +18 -14
- data/.github/workflows/build.yml +0 -27
- data/.github/workflows/push_gem.yml +0 -25
- data/.simplecov +0 -9
- data/.travis.yml +0 -29
- data/PULL_REQUEST_TEMPLATE.md +0 -16
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6f90204ac6abd91506e9813ce0db0688b16ba9f097d11c618961beff6d2c84c9
|
|
4
|
+
data.tar.gz: 0e232402c3e2405465ad978ecfe92134ccfd4bea90ab5e43fb07ff10a391c866
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6122f7df7b83b50531ace30a5e9725accd211c68bfe87a7d069c5b32fa907e8c8a42af6e15f98b48e67f654020dac9100f55ff18797424889264d828c06cc4f5
|
|
7
|
+
data.tar.gz: 01eb690928888869dac45ce7c7947fe99d24bb11772f67b0c7e174928eb34ecc56dd3e59a62baf95a198d4a90947765065b8cc5d2919feeb51a45c666ac9b8c0
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
permissions:
|
|
3
|
+
contents: read
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
branches:
|
|
8
|
+
- main
|
|
9
|
+
pull_request:
|
|
10
|
+
branches:
|
|
11
|
+
- main
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
rubocop:
|
|
15
|
+
name: RuboCop
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
env:
|
|
18
|
+
BUNDLE_ONLY: rubocop
|
|
19
|
+
steps:
|
|
20
|
+
- name: Checkout code
|
|
21
|
+
uses: actions/checkout@v4
|
|
22
|
+
- name: Setup Ruby and install gems
|
|
23
|
+
uses: ruby/setup-ruby@v1
|
|
24
|
+
with:
|
|
25
|
+
ruby-version: 3.3.0
|
|
26
|
+
bundler-cache: true
|
|
27
|
+
- name: Run Rubocop
|
|
28
|
+
run: bundle exec rubocop --parallel
|
|
29
|
+
test:
|
|
30
|
+
name: ${{ format('Unit tests (Ruby {0})', matrix.ruby-version) }}
|
|
31
|
+
runs-on: ubuntu-latest
|
|
32
|
+
strategy:
|
|
33
|
+
matrix:
|
|
34
|
+
ruby-version:
|
|
35
|
+
- "3.1"
|
|
36
|
+
- "3.2"
|
|
37
|
+
- "3.3"
|
|
38
|
+
- "3.4"
|
|
39
|
+
continue-on-error: true
|
|
40
|
+
steps:
|
|
41
|
+
- name: Checkout code
|
|
42
|
+
uses: actions/checkout@v4
|
|
43
|
+
- name: Setup Ruby and install gems
|
|
44
|
+
uses: ruby/setup-ruby@v1
|
|
45
|
+
with:
|
|
46
|
+
ruby-version: ${{ matrix.ruby-version }}
|
|
47
|
+
bundler-cache: true
|
|
48
|
+
- name: Configure Git
|
|
49
|
+
run: |
|
|
50
|
+
git config --global user.name $NAME
|
|
51
|
+
git config --global user.email $EMAIL
|
|
52
|
+
env:
|
|
53
|
+
NAME: "George Costanza"
|
|
54
|
+
EMAIL: "george.costanza@vandelay.com"
|
|
55
|
+
- name: Run tests
|
|
56
|
+
run: bundle exec rake test
|
data/.rubocop.yml
ADDED
data/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,11 @@ project adheres to [Semantic Versioning][Semver].
|
|
|
9
9
|
|
|
10
10
|
- Your contribution here!
|
|
11
11
|
|
|
12
|
+
## [0.5.1] - 2024-12-29
|
|
13
|
+
### Changed
|
|
14
|
+
- Push gems with bundler (not GitHub actions)
|
|
15
|
+
- Updated documentation links
|
|
16
|
+
|
|
12
17
|
## [0.5.0] - 2024-09-20
|
|
13
18
|
### Removed
|
|
14
19
|
- Support for Ruby < 3.1 (older rubies no longer supported)
|
|
@@ -88,7 +93,9 @@ lolcommits 0.14.0)
|
|
|
88
93
|
### Changed
|
|
89
94
|
- Initial release (Yanked)
|
|
90
95
|
|
|
91
|
-
[Unreleased]: https://github.com/lolcommits/lolcommits-loltext/compare/v0.
|
|
96
|
+
[Unreleased]: https://github.com/lolcommits/lolcommits-loltext/compare/v0.5.1...HEAD
|
|
97
|
+
[0.5.1]: https://github.com/lolcommits/lolcommits-loltext/compare/v0.5.0...v0.5.1
|
|
98
|
+
[0.5.0]: https://github.com/lolcommits/lolcommits-loltext/compare/v0.4.0...v0.5.0
|
|
92
99
|
[0.4.0]: https://github.com/lolcommits/lolcommits-loltext/compare/v0.3.0...v0.4.0
|
|
93
100
|
[0.3.0]: https://github.com/lolcommits/lolcommits-loltext/compare/v0.2.1...v0.3.0
|
|
94
101
|
[0.2.3]: https://github.com/lolcommits/lolcommits-loltext/compare/v0.1.0...v0.2.3
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Lolcommits Loltext
|
|
2
2
|
|
|
3
|
-
[](https://github.com/lolcommits/lolcommits-loltext/actions/workflows/ci.yml)
|
|
4
4
|
[](http://rubygems.org/gems/lolcommits-loltext)
|
|
5
5
|
[](https://depfu.com/github/lolcommits/lolcommits-loltext)
|
|
6
6
|
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
webcam every time you git commit code, and archives a lolcat style image
|
|
9
9
|
with it. Git blame has never been so much fun!
|
|
10
10
|
|
|
11
|
-
This plugin annotates each lolcommit with the commit message and sha
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
This plugin annotates each lolcommit with the commit message and sha text. You
|
|
12
|
+
can style and position these however you like, or add a transparent overlay
|
|
13
|
+
color that covers the entire image.
|
|
14
14
|
|
|
15
15
|
By default your lolcommit will look something like this (maybe without the
|
|
16
16
|
horse):
|
|
@@ -35,15 +35,14 @@ more information on the options available.
|
|
|
35
35
|
|
|
36
36
|
## Installation
|
|
37
37
|
|
|
38
|
-
By default, this plugin is automatically included with the main
|
|
39
|
-
|
|
40
|
-
with:
|
|
38
|
+
By default, this plugin is automatically included with the main lolcommits gem.
|
|
39
|
+
If you have uninstalled this gem, install it again with:
|
|
41
40
|
|
|
42
41
|
$ gem install lolcommits-loltext
|
|
43
42
|
|
|
44
|
-
That's it! Every lolcommit will now be stamped with your commit message
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
That's it! Every lolcommit will now be stamped with your commit message and sha.
|
|
44
|
+
This plugin is enabled by default (if no configuration for it exists). To
|
|
45
|
+
disable (so no text or overlay is applied) use:
|
|
47
46
|
|
|
48
47
|
$ lolcommits --config -p loltext
|
|
49
48
|
# and set enabled to `false`
|
|
@@ -75,10 +74,10 @@ Please note that:
|
|
|
75
74
|
* Colors can be hex values (#FC0) or strings (white, red etc.)
|
|
76
75
|
* You can set one or more `overlay_colors` to pick from, separated with commas
|
|
77
76
|
|
|
78
|
-
With these options it is possible to create your own unique lolcommit
|
|
79
|
-
|
|
80
|
-
styled](https://twitter.com/matthutchin/status/738411190343368704)' 🕶
|
|
81
|
-
|
|
77
|
+
With these options it is possible to create your own unique lolcommit format.
|
|
78
|
+
To achieve these '[hipster
|
|
79
|
+
styled](https://twitter.com/matthutchin/status/738411190343368704)' 🕶 commits,
|
|
80
|
+
try the following:
|
|
82
81
|
|
|
83
82
|
```
|
|
84
83
|
loltext:
|
|
@@ -109,11 +108,10 @@ loltext:
|
|
|
109
108
|
## Development
|
|
110
109
|
|
|
111
110
|
Check out this repo and run `bin/setup`, to install all dependencies and
|
|
112
|
-
generate docs. Run `bundle exec rake` to run all tests
|
|
113
|
-
coverage report.
|
|
111
|
+
generate docs. Run `bundle exec rake` to run all tests.
|
|
114
112
|
|
|
115
|
-
You can also run `bin/console` for an interactive prompt that will allow
|
|
116
|
-
|
|
113
|
+
You can also run `bin/console` for an interactive prompt that will allow you to
|
|
114
|
+
experiment with the gem code.
|
|
117
115
|
|
|
118
116
|
## Tests
|
|
119
117
|
|
|
@@ -130,26 +128,23 @@ Generate docs for this gem with:
|
|
|
130
128
|
## Troubles?
|
|
131
129
|
|
|
132
130
|
If you think something is broken or missing, please raise a new
|
|
133
|
-
[issue](https://github.com/lolcommits/lolcommits-loltext/issues). Take a
|
|
134
|
-
|
|
131
|
+
[issue](https://github.com/lolcommits/lolcommits-loltext/issues). Take a moment
|
|
132
|
+
to check it hasn't been raised in the past (and possibly closed).
|
|
135
133
|
|
|
136
134
|
## Contributing
|
|
137
135
|
|
|
138
|
-
Bug [reports](https://github.com/lolcommits/lolcommits-loltext/issues)
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
welcome on GitHub.
|
|
136
|
+
Bug [reports](https://github.com/lolcommits/lolcommits-loltext/issues) and [pull
|
|
137
|
+
requests](https://github.com/lolcommits/lolcommits-loltext/pulls) are welcome on
|
|
138
|
+
GitHub.
|
|
142
139
|
|
|
143
|
-
When submitting pull requests, remember to add tests covering any new
|
|
144
|
-
|
|
145
|
-
[contributing
|
|
140
|
+
When submitting pull requests, remember to add tests covering any new behaviour,
|
|
141
|
+
and ensure all tests are passing. Read the [contributing
|
|
146
142
|
guidelines](https://github.com/lolcommits/lolcommits-loltext/blob/master/CONTRIBUTING.md)
|
|
147
143
|
for more details.
|
|
148
144
|
|
|
149
|
-
This project is intended to be a safe, welcoming space for
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
See
|
|
145
|
+
This project is intended to be a safe, welcoming space for collaboration, and
|
|
146
|
+
contributors are expected to adhere to the [Contributor
|
|
147
|
+
Covenant](http://contributor-covenant.org) code of conduct. See
|
|
153
148
|
[here](https://github.com/lolcommits/lolcommits-loltext/blob/master/CODE_OF_CONDUCT.md)
|
|
154
149
|
for more details.
|
|
155
150
|
|
|
@@ -160,8 +155,8 @@ The gem is available as open source under the terms of
|
|
|
160
155
|
|
|
161
156
|
## Links
|
|
162
157
|
|
|
163
|
-
* [CI](https://github.com/lolcommits/lolcommits-loltext/actions/workflows/
|
|
164
|
-
* [RDoc](
|
|
158
|
+
* [CI](https://github.com/lolcommits/lolcommits-loltext/actions/workflows/ci.yml)
|
|
159
|
+
* [RDoc](https://rubydoc.info/gems/lolcommits-loltext)
|
|
165
160
|
* [Issues](http://github.com/lolcommits/lolcommits-loltext/issues)
|
|
166
161
|
* [Report a bug](http://github.com/lolcommits/lolcommits-loltext/issues/new)
|
|
167
162
|
* [Gem](http://rubygems.org/gems/lolcommits-loltext)
|
data/Rakefile
CHANGED
data/bin/rubocop
ADDED
data/lib/lolcommits/loltext.rb
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require
|
|
3
|
+
require "lolcommits/plugin/base"
|
|
4
4
|
|
|
5
5
|
module Lolcommits
|
|
6
6
|
module Plugin
|
|
7
7
|
class Loltext < Base
|
|
8
|
-
|
|
9
8
|
DEFAULT_FONT_PATH = File.join(
|
|
10
9
|
File.dirname(__FILE__), "../../../vendor/fonts/Impact.ttf"
|
|
11
10
|
).freeze
|
|
@@ -17,7 +16,7 @@ module Lolcommits
|
|
|
17
16
|
# @return [Array] the position(s) (:post_capture)
|
|
18
17
|
#
|
|
19
18
|
def self.runner_order
|
|
20
|
-
[:post_capture]
|
|
19
|
+
[ :post_capture ]
|
|
21
20
|
end
|
|
22
21
|
|
|
23
22
|
##
|
|
@@ -48,18 +47,18 @@ module Lolcommits
|
|
|
48
47
|
# @return [Hash] a hash of configured plugin options
|
|
49
48
|
#
|
|
50
49
|
def configure_options!
|
|
51
|
-
puts
|
|
52
|
-
puts
|
|
53
|
-
puts
|
|
54
|
-
puts
|
|
55
|
-
puts
|
|
56
|
-
puts
|
|
57
|
-
puts
|
|
58
|
-
puts
|
|
59
|
-
puts
|
|
60
|
-
puts
|
|
61
|
-
puts
|
|
62
|
-
puts
|
|
50
|
+
puts "---------------------------------------------------------------"
|
|
51
|
+
puts " LolText options "
|
|
52
|
+
puts ""
|
|
53
|
+
puts " * any blank options will use the (default)"
|
|
54
|
+
puts " * always use the full absolute path to fonts"
|
|
55
|
+
puts " * valid text positions are NE, NW, SE, SW, S, C (centered)"
|
|
56
|
+
puts " * colors can be hex #FC0 value or a string 'white'"
|
|
57
|
+
puts " - use `none` for no stroke color"
|
|
58
|
+
puts " * overlay fills your image with a random color"
|
|
59
|
+
puts " - set one or more overlay_colors with a comma seperator"
|
|
60
|
+
puts " - overlay_percent (0-100) sets the fill colorize strength"
|
|
61
|
+
puts "---------------------------------------------------------------"
|
|
63
62
|
|
|
64
63
|
super
|
|
65
64
|
end
|
|
@@ -74,13 +73,13 @@ module Lolcommits
|
|
|
74
73
|
def run_post_capture
|
|
75
74
|
debug "creating annotation overlay with MiniMagick"
|
|
76
75
|
if config_option(:overlay, :enabled)
|
|
77
|
-
color = config_option(:overlay, :overlay_colors).split(
|
|
76
|
+
color = config_option(:overlay, :overlay_colors).split(",").map(&:strip).sample
|
|
78
77
|
overlay_percent = config_option(:overlay, :overlay_percent).to_f
|
|
79
78
|
debug "adding colorized overlay (#{color} at #{overlay_percent}% opacity)"
|
|
80
79
|
overlay_percent = (255 * (overlay_percent/100)).round
|
|
81
80
|
|
|
82
81
|
runner.overlay.combine_options do |c|
|
|
83
|
-
c.fill "#{color}#{sprintf('%02X',overlay_percent)}"
|
|
82
|
+
c.fill "#{color}#{sprintf('%02X', overlay_percent)}"
|
|
84
83
|
c.draw "color 0,0 reset"
|
|
85
84
|
end
|
|
86
85
|
end
|
|
@@ -106,7 +105,7 @@ module Lolcommits
|
|
|
106
105
|
debug("annotating #{type} text (#{string})")
|
|
107
106
|
|
|
108
107
|
transformed_position = position_transform(config_option(type, :position))
|
|
109
|
-
annotate_location =
|
|
108
|
+
annotate_location = "0"
|
|
110
109
|
|
|
111
110
|
padded_annotation = 10
|
|
112
111
|
if config_option(:border, :enabled)
|
|
@@ -141,34 +140,34 @@ module Lolcommits
|
|
|
141
140
|
def default_options
|
|
142
141
|
{
|
|
143
142
|
message: {
|
|
144
|
-
color:
|
|
143
|
+
color: "white",
|
|
145
144
|
font: DEFAULT_FONT_PATH,
|
|
146
|
-
position:
|
|
145
|
+
position: "SW",
|
|
147
146
|
size: 48,
|
|
148
|
-
stroke_color:
|
|
147
|
+
stroke_color: "black",
|
|
149
148
|
uppercase: false
|
|
150
149
|
},
|
|
151
150
|
sha: {
|
|
152
|
-
color:
|
|
151
|
+
color: "white",
|
|
153
152
|
font: DEFAULT_FONT_PATH,
|
|
154
|
-
position:
|
|
153
|
+
position: "NE",
|
|
155
154
|
size: 32,
|
|
156
|
-
stroke_color:
|
|
155
|
+
stroke_color: "black",
|
|
157
156
|
uppercase: false
|
|
158
157
|
},
|
|
159
158
|
overlay: {
|
|
160
159
|
enabled: false,
|
|
161
160
|
overlay_colors: [
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
].join(
|
|
161
|
+
"#2e4970", "#674685", "#ca242f", "#1e7882", "#2884ae", "#4ba000",
|
|
162
|
+
"#187296", "#7e231f", "#017d9f", "#e52d7b", "#0f5eaa", "#e40087",
|
|
163
|
+
"#5566ac", "#ed8833", "#f8991c", "#408c93", "#ba9109"
|
|
164
|
+
].join(","),
|
|
166
165
|
overlay_percent: 50
|
|
167
166
|
},
|
|
168
167
|
border: {
|
|
169
168
|
enabled: false,
|
|
170
|
-
color:
|
|
171
|
-
size: 10
|
|
169
|
+
color: "white",
|
|
170
|
+
size: 10
|
|
172
171
|
}
|
|
173
172
|
}
|
|
174
173
|
end
|
|
@@ -176,18 +175,18 @@ module Lolcommits
|
|
|
176
175
|
# explode psuedo-names for text positioning
|
|
177
176
|
def position_transform(position)
|
|
178
177
|
case position
|
|
179
|
-
when
|
|
180
|
-
|
|
181
|
-
when
|
|
182
|
-
|
|
183
|
-
when
|
|
184
|
-
|
|
185
|
-
when
|
|
186
|
-
|
|
187
|
-
when
|
|
188
|
-
|
|
189
|
-
when
|
|
190
|
-
|
|
178
|
+
when "NE"
|
|
179
|
+
"NorthEast"
|
|
180
|
+
when "NW"
|
|
181
|
+
"NorthWest"
|
|
182
|
+
when "SE"
|
|
183
|
+
"SouthEast"
|
|
184
|
+
when "SW"
|
|
185
|
+
"SouthWest"
|
|
186
|
+
when "C"
|
|
187
|
+
"Center"
|
|
188
|
+
when "S"
|
|
189
|
+
"South"
|
|
191
190
|
end
|
|
192
191
|
end
|
|
193
192
|
|
data/lolcommits-loltext.gemspec
CHANGED
|
@@ -5,9 +5,9 @@ require 'lolcommits/loltext/version'
|
|
|
5
5
|
Gem::Specification.new do |spec|
|
|
6
6
|
spec.name = "lolcommits-loltext"
|
|
7
7
|
spec.version = Lolcommits::Loltext::VERSION
|
|
8
|
-
spec.authors = ["Matthew Hutchinson"]
|
|
9
|
-
spec.email = ["matt@hiddenloop.com"]
|
|
10
|
-
spec.summary = %q
|
|
8
|
+
spec.authors = [ "Matthew Hutchinson" ]
|
|
9
|
+
spec.email = [ "matt@hiddenloop.com" ]
|
|
10
|
+
spec.summary = %q(lolcommits commit message annotation plugin)
|
|
11
11
|
spec.homepage = "https://github.com/lolcommits/lolcommits-loltext"
|
|
12
12
|
spec.license = "LGPL-3.0"
|
|
13
13
|
|
|
@@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
|
|
|
18
18
|
|
|
19
19
|
spec.metadata = {
|
|
20
20
|
"homepage_uri" => "https://github.com/lolcommits/lolcommits-loltext",
|
|
21
|
+
"documentation_uri" => "https://rubydoc.info/gems/lolcommits-loltext",
|
|
21
22
|
"changelog_uri" => "https://github.com/lolcommits/lolcommits-loltext/blob/master/CHANGELOG.md",
|
|
22
23
|
"source_code_uri" => "https://github.com/lolcommits/lolcommits-loltext",
|
|
23
24
|
"bug_tracker_uri" => "https://github.com/lolcommits/lolcommits-loltext/issues",
|
|
@@ -28,11 +29,11 @@ Gem::Specification.new do |spec|
|
|
|
28
29
|
spec.test_files = `git ls-files -- {test,features}/*`.split("\n")
|
|
29
30
|
spec.bindir = "bin"
|
|
30
31
|
spec.executables = []
|
|
31
|
-
spec.require_paths = ["lib"]
|
|
32
|
+
spec.require_paths = [ "lib" ]
|
|
32
33
|
|
|
33
34
|
spec.required_ruby_version = ">= 3.1"
|
|
34
35
|
|
|
35
|
-
spec.add_development_dependency "lolcommits", ">= 0.17.
|
|
36
|
+
spec.add_development_dependency "lolcommits", ">= 0.17.2"
|
|
36
37
|
spec.add_development_dependency "bundler"
|
|
37
38
|
spec.add_development_dependency "rake"
|
|
38
39
|
spec.add_development_dependency "minitest"
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "test_helper"
|
|
4
|
+
|
|
5
|
+
describe Lolcommits::Plugin::Loltext do
|
|
6
|
+
include Lolcommits::TestHelpers::FakeIO
|
|
7
|
+
|
|
8
|
+
it "should run on post capturing" do
|
|
9
|
+
_(::Lolcommits::Plugin::Loltext.runner_order).must_equal [ :post_capture ]
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
describe "with a runner" do
|
|
13
|
+
def runner
|
|
14
|
+
# a simple lolcommits runner with an empty configuration Hash
|
|
15
|
+
@runner ||= Lolcommits::Runner.new
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def plugin
|
|
19
|
+
@plugin ||= Lolcommits::Plugin::Loltext.new(runner: runner)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def valid_enabled_config
|
|
23
|
+
{ enabled: true }
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
describe "initalizing" do
|
|
27
|
+
it "should assign runner and an enabled option" do
|
|
28
|
+
_(plugin.runner).must_equal runner
|
|
29
|
+
_(plugin.options).must_equal [ :enabled ]
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
describe "#enabled?" do
|
|
34
|
+
it "should be true by default" do
|
|
35
|
+
_(plugin.enabled?).must_equal true
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it "should true when configured" do
|
|
39
|
+
plugin.configuration = valid_enabled_config
|
|
40
|
+
_(plugin.enabled?).must_equal true
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
describe "configuration" do
|
|
45
|
+
it "should allow plugin options to be configured" do
|
|
46
|
+
# enabled
|
|
47
|
+
inputs = [ "true" ]
|
|
48
|
+
|
|
49
|
+
# styling message and sha
|
|
50
|
+
inputs += %w[
|
|
51
|
+
red
|
|
52
|
+
myfont.ttf
|
|
53
|
+
SE
|
|
54
|
+
38
|
|
55
|
+
orange
|
|
56
|
+
true
|
|
57
|
+
] * 2
|
|
58
|
+
|
|
59
|
+
# styling overlay
|
|
60
|
+
inputs += %w[true #2884ae,#7e231f 40]
|
|
61
|
+
|
|
62
|
+
# border options
|
|
63
|
+
inputs += %w[true #e96d46 23]
|
|
64
|
+
|
|
65
|
+
configured_plugin_options = {}
|
|
66
|
+
fake_io_capture(inputs: inputs) do
|
|
67
|
+
configured_plugin_options = plugin.configure_options!
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
_(configured_plugin_options).must_equal({
|
|
71
|
+
enabled: true,
|
|
72
|
+
message: {
|
|
73
|
+
color: "red",
|
|
74
|
+
font: "myfont.ttf",
|
|
75
|
+
position: "SE",
|
|
76
|
+
size: 38,
|
|
77
|
+
stroke_color: "orange",
|
|
78
|
+
uppercase: true
|
|
79
|
+
},
|
|
80
|
+
sha: {
|
|
81
|
+
color: "red",
|
|
82
|
+
font: "myfont.ttf",
|
|
83
|
+
position: "SE",
|
|
84
|
+
size: 38,
|
|
85
|
+
stroke_color: "orange",
|
|
86
|
+
uppercase: true
|
|
87
|
+
},
|
|
88
|
+
overlay: {
|
|
89
|
+
enabled: true,
|
|
90
|
+
overlay_colors: "#2884ae,#7e231f",
|
|
91
|
+
overlay_percent: 40
|
|
92
|
+
},
|
|
93
|
+
border: {
|
|
94
|
+
enabled: true,
|
|
95
|
+
color: "#e96d46",
|
|
96
|
+
size: 23
|
|
97
|
+
}
|
|
98
|
+
})
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
describe "#valid_configuration?" do
|
|
102
|
+
it "should be true even if config is not set" do
|
|
103
|
+
_(plugin.valid_configuration?).must_equal(true)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
it "should be true for a valid configuration" do
|
|
107
|
+
plugin.configuration = valid_enabled_config
|
|
108
|
+
_(plugin.valid_configuration?).must_equal true
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|
data/test/test_helper.rb
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
|
|
4
|
+
|
|
5
|
+
# lolcommits gem
|
|
6
|
+
require "lolcommits"
|
|
7
|
+
|
|
8
|
+
# lolcommit test helpers
|
|
9
|
+
require "lolcommits/test_helpers/git_repo"
|
|
10
|
+
require "lolcommits/test_helpers/fake_io"
|
|
11
|
+
|
|
12
|
+
# plugin gem test libs
|
|
13
|
+
require "lolcommits/loltext"
|
|
14
|
+
require "minitest/autorun"
|
|
15
|
+
|
|
16
|
+
# swallow all debug output during test runs
|
|
17
|
+
def debug(msg); end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lolcommits-loltext
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matthew Hutchinson
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-
|
|
11
|
+
date: 2024-12-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: lolcommits
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0.17.
|
|
19
|
+
version: 0.17.2
|
|
20
20
|
type: :development
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 0.17.
|
|
26
|
+
version: 0.17.2
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: bundler
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -75,36 +75,38 @@ executables: []
|
|
|
75
75
|
extensions: []
|
|
76
76
|
extra_rdoc_files: []
|
|
77
77
|
files:
|
|
78
|
-
- ".github/workflows/
|
|
79
|
-
- ".github/workflows/push_gem.yml"
|
|
78
|
+
- ".github/workflows/ci.yml"
|
|
80
79
|
- ".gitignore"
|
|
81
|
-
- ".
|
|
82
|
-
- ".
|
|
80
|
+
- ".quickhook/pre-commit/ruby-lint"
|
|
81
|
+
- ".rubocop.yml"
|
|
83
82
|
- CHANGELOG.md
|
|
84
83
|
- CODE_OF_CONDUCT.md
|
|
85
84
|
- CONTRIBUTING.md
|
|
86
85
|
- Gemfile
|
|
87
86
|
- LICENSE
|
|
88
|
-
- PULL_REQUEST_TEMPLATE.md
|
|
89
87
|
- README.md
|
|
90
88
|
- Rakefile
|
|
91
89
|
- bin/console
|
|
90
|
+
- bin/rubocop
|
|
92
91
|
- bin/setup
|
|
93
92
|
- lib/lolcommits/loltext.rb
|
|
94
93
|
- lib/lolcommits/loltext/version.rb
|
|
95
94
|
- lib/lolcommits/plugin/loltext.rb
|
|
96
95
|
- lolcommits-loltext.gemspec
|
|
96
|
+
- test/lolcommits/plugin/loltext_test.rb
|
|
97
|
+
- test/test_helper.rb
|
|
97
98
|
- vendor/fonts/Impact.ttf
|
|
98
99
|
homepage: https://github.com/lolcommits/lolcommits-loltext
|
|
99
100
|
licenses:
|
|
100
101
|
- LGPL-3.0
|
|
101
102
|
metadata:
|
|
102
103
|
homepage_uri: https://github.com/lolcommits/lolcommits-loltext
|
|
104
|
+
documentation_uri: https://rubydoc.info/gems/lolcommits-loltext
|
|
103
105
|
changelog_uri: https://github.com/lolcommits/lolcommits-loltext/blob/master/CHANGELOG.md
|
|
104
106
|
source_code_uri: https://github.com/lolcommits/lolcommits-loltext
|
|
105
107
|
bug_tracker_uri: https://github.com/lolcommits/lolcommits-loltext/issues
|
|
106
108
|
allowed_push_host: https://rubygems.org
|
|
107
|
-
post_install_message:
|
|
109
|
+
post_install_message:
|
|
108
110
|
rdoc_options: []
|
|
109
111
|
require_paths:
|
|
110
112
|
- lib
|
|
@@ -119,8 +121,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
119
121
|
- !ruby/object:Gem::Version
|
|
120
122
|
version: '0'
|
|
121
123
|
requirements: []
|
|
122
|
-
rubygems_version: 3.5.
|
|
123
|
-
signing_key:
|
|
124
|
+
rubygems_version: 3.5.22
|
|
125
|
+
signing_key:
|
|
124
126
|
specification_version: 4
|
|
125
127
|
summary: lolcommits commit message annotation plugin
|
|
126
|
-
test_files:
|
|
128
|
+
test_files:
|
|
129
|
+
- test/lolcommits/plugin/loltext_test.rb
|
|
130
|
+
- test/test_helper.rb
|
data/.github/workflows/build.yml
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
name: Tests
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [ "main" ]
|
|
6
|
-
pull_request:
|
|
7
|
-
branches: [ "main" ]
|
|
8
|
-
|
|
9
|
-
permissions:
|
|
10
|
-
contents: read
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
test:
|
|
14
|
-
runs-on: ubuntu-latest
|
|
15
|
-
strategy:
|
|
16
|
-
fail-fast: false
|
|
17
|
-
matrix:
|
|
18
|
-
ruby-version: ['3.1', '3.2', '3.3', '3.4']
|
|
19
|
-
steps:
|
|
20
|
-
- uses: actions/checkout@v4
|
|
21
|
-
- name: Set up Ruby
|
|
22
|
-
uses: ruby/setup-ruby@v1
|
|
23
|
-
with:
|
|
24
|
-
ruby-version: ${{ matrix.ruby-version }}
|
|
25
|
-
bundler-cache: true
|
|
26
|
-
- name: Run tests
|
|
27
|
-
run: bundle exec rake test
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
name: Publish gem to RubyGems.org
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
tags:
|
|
6
|
-
- v*
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
push:
|
|
10
|
-
name: Push gem to RubyGems.org
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
|
|
13
|
-
permissions:
|
|
14
|
-
id-token: write
|
|
15
|
-
contents: write
|
|
16
|
-
|
|
17
|
-
steps:
|
|
18
|
-
- uses: actions/checkout@v4
|
|
19
|
-
- name: Set up Ruby
|
|
20
|
-
uses: ruby/setup-ruby@v1
|
|
21
|
-
with:
|
|
22
|
-
bundler-cache: true
|
|
23
|
-
ruby-version: ruby
|
|
24
|
-
|
|
25
|
-
- uses: rubygems/release-gem@v1
|
data/.simplecov
DELETED
data/.travis.yml
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
sudo: false
|
|
2
|
-
language: ruby
|
|
3
|
-
cache: bundler
|
|
4
|
-
rvm:
|
|
5
|
-
- 2.5.8
|
|
6
|
-
- 2.6.6
|
|
7
|
-
- 2.7.2
|
|
8
|
-
- 3.0.0
|
|
9
|
-
- ruby-head
|
|
10
|
-
|
|
11
|
-
before_install:
|
|
12
|
-
- git --version
|
|
13
|
-
- git config --global user.email "lol@commits.org"
|
|
14
|
-
- git config --global user.name "Lolcommits"
|
|
15
|
-
|
|
16
|
-
matrix:
|
|
17
|
-
allow_failures:
|
|
18
|
-
- rvm: ruby-head
|
|
19
|
-
|
|
20
|
-
env:
|
|
21
|
-
global:
|
|
22
|
-
- CC_TEST_REPORTER_ID=8d879fff974ae19930e4c3ae89623aec6a2d86a236a350e5a128360c4142332a
|
|
23
|
-
- GIT_COMMITTED_AT=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then git log -1 --pretty=format:%ct; else git log -1 --skip 1 --pretty=format:%ct; fi)
|
|
24
|
-
before_script:
|
|
25
|
-
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
|
26
|
-
- chmod +x ./cc-test-reporter
|
|
27
|
-
- ./cc-test-reporter before-build - GIT_COMMITTED_AT=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then git log -1 --pretty=format:%ct; else git log -1 --skip 1 --pretty=format:%ct; fi)
|
|
28
|
-
after_script:
|
|
29
|
-
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
data/PULL_REQUEST_TEMPLATE.md
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
Explain what you're changing and why here.
|
|
3
|
-
|
|
4
|
-
---
|
|
5
|
-
#### :memo: Checklist
|
|
6
|
-
|
|
7
|
-
Please check this list and leave it intact for the reviewer. Thanks! :heart:
|
|
8
|
-
|
|
9
|
-
- [ ] Commit messages to provide context (why not just what, some tips [here](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)).
|
|
10
|
-
- [ ] If relevant, mention GitHub issue number above and include in a commit message.
|
|
11
|
-
- [ ] Latest code from master merged.
|
|
12
|
-
- [ ] New behaviour has test coverage.
|
|
13
|
-
- [ ] Avoid duplicating code.
|
|
14
|
-
- [ ] No commented out code.
|
|
15
|
-
- [ ] Avoid comments for your code, write code that explains itself.
|
|
16
|
-
- [ ] Changes are simple, useful, clear and brief.
|