lolcommits-loltext 0.4.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- 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 +12 -1
- data/Gemfile +5 -1
- data/README.md +31 -41
- data/Rakefile +1 -11
- 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 +7 -7
- data/test/lolcommits/plugin/loltext_test.rb +31 -32
- data/test/test_helper.rb +6 -10
- metadata +14 -26
- 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,15 @@ 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
|
+
|
17
|
+
## [0.5.0] - 2024-09-20
|
18
|
+
### Removed
|
19
|
+
- Support for Ruby < 3.1 (older rubies no longer supported)
|
20
|
+
|
12
21
|
## [0.4.0] - 2020-01-24
|
13
22
|
### Removed
|
14
23
|
- Support for Ruby < 2.4 (older rubies no longer supported)
|
@@ -84,7 +93,9 @@ lolcommits 0.14.0)
|
|
84
93
|
### Changed
|
85
94
|
- Initial release (Yanked)
|
86
95
|
|
87
|
-
[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
|
88
99
|
[0.4.0]: https://github.com/lolcommits/lolcommits-loltext/compare/v0.3.0...v0.4.0
|
89
100
|
[0.3.0]: https://github.com/lolcommits/lolcommits-loltext/compare/v0.2.1...v0.3.0
|
90
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,51 +1,48 @@
|
|
1
1
|
# Lolcommits Loltext
|
2
2
|
|
3
|
+
[![CI](https://img.shields.io/github/actions/workflow/status/lolcommits/lolcommits-loltext/ci.yml?branch=main&style=flat&label=CI)](https://github.com/lolcommits/lolcommits-loltext/actions/workflows/ci.yml)
|
3
4
|
[![Gem](https://img.shields.io/gem/v/lolcommits-loltext.svg?style=flat)](http://rubygems.org/gems/lolcommits-loltext)
|
4
|
-
[![Travis](https://img.shields.io/travis/com/lolcommits/lolcommits-loltext/master.svg?style=flat)](https://travis-ci.com/lolcommits/lolcommits-loltext)
|
5
5
|
[![Depfu](https://img.shields.io/depfu/lolcommits/lolcommits-loltext.svg?style=flat)](https://depfu.com/github/lolcommits/lolcommits-loltext)
|
6
|
-
[![Maintainability](https://api.codeclimate.com/v1/badges/2e0fa03867952572c5db/maintainability)](https://codeclimate.com/github/lolcommits/lolcommits-loltext/maintainability)
|
7
|
-
[![Test Coverage](https://api.codeclimate.com/v1/badges/2e0fa03867952572c5db/test_coverage)](https://codeclimate.com/github/lolcommits/lolcommits-loltext/test_coverage)
|
8
6
|
|
9
7
|
[lolcommits](https://lolcommits.github.io/) takes a snapshot with your
|
10
8
|
webcam every time you git commit code, and archives a lolcat style image
|
11
9
|
with it. Git blame has never been so much fun!
|
12
10
|
|
13
|
-
This plugin annotates each lolcommit with the commit message and sha
|
14
|
-
|
15
|
-
|
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.
|
16
14
|
|
17
15
|
By default your lolcommit will look something like this (maybe without the
|
18
16
|
horse):
|
19
17
|
|
20
18
|
![horse
|
21
|
-
commit](https://github.com/lolcommits/lolcommits-loltext/
|
19
|
+
commit](https://github.com/lolcommits/lolcommits-loltext/blob/main/assets/images/horse.jpg)
|
22
20
|
|
23
21
|
You can easily change the plugin options to achieve something like this:
|
24
22
|
|
25
23
|
![hipster
|
26
|
-
commit](https://github.com/lolcommits/lolcommits-loltext/
|
24
|
+
commit](https://github.com/lolcommits/lolcommits-loltext/blob/main/assets/images/hipster.jpg)
|
27
25
|
|
28
26
|
See [below](https://github.com/lolcommits/lolcommits-loltext#configuration) for
|
29
27
|
more information on the options available.
|
30
28
|
|
31
29
|
## Requirements
|
32
30
|
|
33
|
-
* Ruby >=
|
31
|
+
* Ruby >= 3.1
|
34
32
|
* A webcam
|
35
33
|
* [ImageMagick](http://www.imagemagick.org)
|
36
34
|
* [ffmpeg](https://www.ffmpeg.org) (optional) for animated gif capturing
|
37
35
|
|
38
36
|
## Installation
|
39
37
|
|
40
|
-
By default, this plugin is automatically included with the main
|
41
|
-
|
42
|
-
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:
|
43
40
|
|
44
41
|
$ gem install lolcommits-loltext
|
45
42
|
|
46
|
-
That's it! Every lolcommit will now be stamped with your commit message
|
47
|
-
|
48
|
-
|
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:
|
49
46
|
|
50
47
|
$ lolcommits --config -p loltext
|
51
48
|
# and set enabled to `false`
|
@@ -77,10 +74,10 @@ Please note that:
|
|
77
74
|
* Colors can be hex values (#FC0) or strings (white, red etc.)
|
78
75
|
* You can set one or more `overlay_colors` to pick from, separated with commas
|
79
76
|
|
80
|
-
With these options it is possible to create your own unique lolcommit
|
81
|
-
|
82
|
-
styled](https://twitter.com/matthutchin/status/738411190343368704)' 🕶
|
83
|
-
|
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:
|
84
81
|
|
85
82
|
```
|
86
83
|
loltext:
|
@@ -111,11 +108,10 @@ loltext:
|
|
111
108
|
## Development
|
112
109
|
|
113
110
|
Check out this repo and run `bin/setup`, to install all dependencies and
|
114
|
-
generate docs. Run `bundle exec rake` to run all tests
|
115
|
-
coverage report.
|
111
|
+
generate docs. Run `bundle exec rake` to run all tests.
|
116
112
|
|
117
|
-
You can also run `bin/console` for an interactive prompt that will allow
|
118
|
-
|
113
|
+
You can also run `bin/console` for an interactive prompt that will allow you to
|
114
|
+
experiment with the gem code.
|
119
115
|
|
120
116
|
## Tests
|
121
117
|
|
@@ -132,27 +128,23 @@ Generate docs for this gem with:
|
|
132
128
|
## Troubles?
|
133
129
|
|
134
130
|
If you think something is broken or missing, please raise a new
|
135
|
-
[issue](https://github.com/lolcommits/lolcommits-loltext/issues). Take a
|
136
|
-
|
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).
|
137
133
|
|
138
134
|
## Contributing
|
139
135
|
|
140
|
-
Bug [reports](https://github.com/lolcommits/lolcommits-loltext/issues)
|
141
|
-
|
142
|
-
|
143
|
-
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.
|
144
139
|
|
145
|
-
When submitting pull requests, remember to add tests covering any new
|
146
|
-
|
147
|
-
CI](https://travis-ci.com/lolcommits/lolcommits-loltext). Read the
|
148
|
-
[contributing
|
140
|
+
When submitting pull requests, remember to add tests covering any new behaviour,
|
141
|
+
and ensure all tests are passing. Read the [contributing
|
149
142
|
guidelines](https://github.com/lolcommits/lolcommits-loltext/blob/master/CONTRIBUTING.md)
|
150
143
|
for more details.
|
151
144
|
|
152
|
-
This project is intended to be a safe, welcoming space for
|
153
|
-
|
154
|
-
|
155
|
-
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
|
156
148
|
[here](https://github.com/lolcommits/lolcommits-loltext/blob/master/CODE_OF_CONDUCT.md)
|
157
149
|
for more details.
|
158
150
|
|
@@ -163,10 +155,8 @@ The gem is available as open source under the terms of
|
|
163
155
|
|
164
156
|
## Links
|
165
157
|
|
166
|
-
* [
|
167
|
-
* [
|
168
|
-
* [Code Climate](https://codeclimate.com/github/lolcommits/lolcommits-loltext)
|
169
|
-
* [RDoc](http://rdoc.info/projects/lolcommits/lolcommits-loltext)
|
158
|
+
* [CI](https://github.com/lolcommits/lolcommits-loltext/actions/workflows/ci.yml)
|
159
|
+
* [RDoc](https://rubydoc.info/gems/lolcommits-loltext)
|
170
160
|
* [Issues](http://github.com/lolcommits/lolcommits-loltext/issues)
|
171
161
|
* [Report a bug](http://github.com/lolcommits/lolcommits-loltext/issues/new)
|
172
162
|
* [Gem](http://rubygems.org/gems/lolcommits-loltext)
|
data/Rakefile
CHANGED
@@ -18,14 +18,4 @@ Rake::TestTask.new(:test) do |t|
|
|
18
18
|
t.test_files = FileList["test/**/*_test.rb"]
|
19
19
|
end
|
20
20
|
|
21
|
-
|
22
|
-
namespace :test do
|
23
|
-
desc "Run all tests and features and generate a code coverage report"
|
24
|
-
task :coverage do
|
25
|
-
ENV['COVERAGE'] = 'true'
|
26
|
-
Rake::Task['test'].execute
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
|
31
|
-
task :default => ['test:coverage']
|
21
|
+
task default: [ "test" ]
|
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,13 +29,12 @@ 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
|
-
spec.required_ruby_version = ">=
|
34
|
+
spec.required_ruby_version = ">= 3.1"
|
34
35
|
|
35
|
-
spec.add_development_dependency "lolcommits", ">= 0.
|
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"
|
39
|
-
spec.add_development_dependency "simplecov"
|
40
40
|
end
|
@@ -1,16 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "test_helper"
|
4
4
|
|
5
5
|
describe Lolcommits::Plugin::Loltext do
|
6
|
-
|
7
6
|
include Lolcommits::TestHelpers::FakeIO
|
8
7
|
|
9
|
-
it
|
10
|
-
_(::Lolcommits::Plugin::Loltext.runner_order).must_equal [:post_capture]
|
8
|
+
it "should run on post capturing" do
|
9
|
+
_(::Lolcommits::Plugin::Loltext.runner_order).must_equal [ :post_capture ]
|
11
10
|
end
|
12
11
|
|
13
|
-
describe
|
12
|
+
describe "with a runner" do
|
14
13
|
def runner
|
15
14
|
# a simple lolcommits runner with an empty configuration Hash
|
16
15
|
@runner ||= Lolcommits::Runner.new
|
@@ -24,66 +23,66 @@ describe Lolcommits::Plugin::Loltext do
|
|
24
23
|
{ enabled: true }
|
25
24
|
end
|
26
25
|
|
27
|
-
describe
|
28
|
-
it
|
26
|
+
describe "initalizing" do
|
27
|
+
it "should assign runner and an enabled option" do
|
29
28
|
_(plugin.runner).must_equal runner
|
30
|
-
_(plugin.options).must_equal [:enabled]
|
29
|
+
_(plugin.options).must_equal [ :enabled ]
|
31
30
|
end
|
32
31
|
end
|
33
32
|
|
34
|
-
describe
|
35
|
-
it
|
33
|
+
describe "#enabled?" do
|
34
|
+
it "should be true by default" do
|
36
35
|
_(plugin.enabled?).must_equal true
|
37
36
|
end
|
38
37
|
|
39
|
-
it
|
38
|
+
it "should true when configured" do
|
40
39
|
plugin.configuration = valid_enabled_config
|
41
40
|
_(plugin.enabled?).must_equal true
|
42
41
|
end
|
43
42
|
end
|
44
43
|
|
45
|
-
describe
|
46
|
-
it
|
44
|
+
describe "configuration" do
|
45
|
+
it "should allow plugin options to be configured" do
|
47
46
|
# enabled
|
48
|
-
inputs = [
|
47
|
+
inputs = [ "true" ]
|
49
48
|
|
50
49
|
# styling message and sha
|
51
|
-
inputs += %w
|
50
|
+
inputs += %w[
|
52
51
|
red
|
53
52
|
myfont.ttf
|
54
53
|
SE
|
55
54
|
38
|
56
55
|
orange
|
57
56
|
true
|
58
|
-
|
57
|
+
] * 2
|
59
58
|
|
60
59
|
# styling overlay
|
61
|
-
inputs += %w
|
60
|
+
inputs += %w[true #2884ae,#7e231f 40]
|
62
61
|
|
63
62
|
# border options
|
64
|
-
inputs += %w
|
63
|
+
inputs += %w[true #e96d46 23]
|
65
64
|
|
66
65
|
configured_plugin_options = {}
|
67
66
|
fake_io_capture(inputs: inputs) do
|
68
67
|
configured_plugin_options = plugin.configure_options!
|
69
68
|
end
|
70
69
|
|
71
|
-
_(configured_plugin_options).must_equal(
|
70
|
+
_(configured_plugin_options).must_equal({
|
72
71
|
enabled: true,
|
73
72
|
message: {
|
74
|
-
color:
|
75
|
-
font:
|
76
|
-
position:
|
73
|
+
color: "red",
|
74
|
+
font: "myfont.ttf",
|
75
|
+
position: "SE",
|
77
76
|
size: 38,
|
78
|
-
stroke_color:
|
77
|
+
stroke_color: "orange",
|
79
78
|
uppercase: true
|
80
79
|
},
|
81
80
|
sha: {
|
82
|
-
color:
|
83
|
-
font:
|
84
|
-
position:
|
81
|
+
color: "red",
|
82
|
+
font: "myfont.ttf",
|
83
|
+
position: "SE",
|
85
84
|
size: 38,
|
86
|
-
stroke_color:
|
85
|
+
stroke_color: "orange",
|
87
86
|
uppercase: true
|
88
87
|
},
|
89
88
|
overlay: {
|
@@ -93,18 +92,18 @@ describe Lolcommits::Plugin::Loltext do
|
|
93
92
|
},
|
94
93
|
border: {
|
95
94
|
enabled: true,
|
96
|
-
color:
|
97
|
-
size: 23
|
95
|
+
color: "#e96d46",
|
96
|
+
size: 23
|
98
97
|
}
|
99
98
|
})
|
100
99
|
end
|
101
100
|
|
102
|
-
describe
|
103
|
-
it
|
101
|
+
describe "#valid_configuration?" do
|
102
|
+
it "should be true even if config is not set" do
|
104
103
|
_(plugin.valid_configuration?).must_equal(true)
|
105
104
|
end
|
106
105
|
|
107
|
-
it
|
106
|
+
it "should be true for a valid configuration" do
|
108
107
|
plugin.configuration = valid_enabled_config
|
109
108
|
_(plugin.valid_configuration?).must_equal true
|
110
109
|
end
|
data/test/test_helper.rb
CHANGED
@@ -1,21 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
$LOAD_PATH.unshift File.expand_path(
|
3
|
+
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
|
4
4
|
|
5
5
|
# lolcommits gem
|
6
|
-
require
|
6
|
+
require "lolcommits"
|
7
7
|
|
8
8
|
# lolcommit test helpers
|
9
|
-
require
|
10
|
-
require
|
11
|
-
|
12
|
-
if ENV['COVERAGE']
|
13
|
-
require 'simplecov'
|
14
|
-
end
|
9
|
+
require "lolcommits/test_helpers/git_repo"
|
10
|
+
require "lolcommits/test_helpers/fake_io"
|
15
11
|
|
16
12
|
# plugin gem test libs
|
17
|
-
require
|
18
|
-
require
|
13
|
+
require "lolcommits/loltext"
|
14
|
+
require "minitest/autorun"
|
19
15
|
|
20
16
|
# swallow all debug output during test runs
|
21
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.
|
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:
|
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.
|
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.
|
26
|
+
version: 0.17.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,20 +66,6 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: simplecov
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
69
|
description: |2
|
84
70
|
Overlay the commit message and sha on your lolcommit. Configure text
|
85
71
|
style, positioning, border and coloured overlay.
|
@@ -89,18 +75,19 @@ executables: []
|
|
89
75
|
extensions: []
|
90
76
|
extra_rdoc_files: []
|
91
77
|
files:
|
78
|
+
- ".github/workflows/ci.yml"
|
92
79
|
- ".gitignore"
|
93
|
-
- ".
|
94
|
-
- ".
|
80
|
+
- ".quickhook/pre-commit/ruby-lint"
|
81
|
+
- ".rubocop.yml"
|
95
82
|
- CHANGELOG.md
|
96
83
|
- CODE_OF_CONDUCT.md
|
97
84
|
- CONTRIBUTING.md
|
98
85
|
- Gemfile
|
99
86
|
- LICENSE
|
100
|
-
- PULL_REQUEST_TEMPLATE.md
|
101
87
|
- README.md
|
102
88
|
- Rakefile
|
103
89
|
- bin/console
|
90
|
+
- bin/rubocop
|
104
91
|
- bin/setup
|
105
92
|
- lib/lolcommits/loltext.rb
|
106
93
|
- lib/lolcommits/loltext/version.rb
|
@@ -114,11 +101,12 @@ licenses:
|
|
114
101
|
- LGPL-3.0
|
115
102
|
metadata:
|
116
103
|
homepage_uri: https://github.com/lolcommits/lolcommits-loltext
|
104
|
+
documentation_uri: https://rubydoc.info/gems/lolcommits-loltext
|
117
105
|
changelog_uri: https://github.com/lolcommits/lolcommits-loltext/blob/master/CHANGELOG.md
|
118
106
|
source_code_uri: https://github.com/lolcommits/lolcommits-loltext
|
119
107
|
bug_tracker_uri: https://github.com/lolcommits/lolcommits-loltext/issues
|
120
108
|
allowed_push_host: https://rubygems.org
|
121
|
-
post_install_message:
|
109
|
+
post_install_message:
|
122
110
|
rdoc_options: []
|
123
111
|
require_paths:
|
124
112
|
- lib
|
@@ -126,15 +114,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
126
114
|
requirements:
|
127
115
|
- - ">="
|
128
116
|
- !ruby/object:Gem::Version
|
129
|
-
version: '
|
117
|
+
version: '3.1'
|
130
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
119
|
requirements:
|
132
120
|
- - ">="
|
133
121
|
- !ruby/object:Gem::Version
|
134
122
|
version: '0'
|
135
123
|
requirements: []
|
136
|
-
rubygems_version: 3.
|
137
|
-
signing_key:
|
124
|
+
rubygems_version: 3.5.22
|
125
|
+
signing_key:
|
138
126
|
specification_version: 4
|
139
127
|
summary: lolcommits commit message annotation plugin
|
140
128
|
test_files:
|
data/.simplecov
DELETED
data/.travis.yml
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
sudo: false
|
2
|
-
language: ruby
|
3
|
-
cache: bundler
|
4
|
-
rvm:
|
5
|
-
- 2.4.9
|
6
|
-
- 2.5.7
|
7
|
-
- 2.6.5
|
8
|
-
- 2.7.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.
|