lolcommits-sample_plugin 0.4.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 +12 -1
- data/Gemfile +5 -1
- data/README.md +72 -87
- data/Rakefile +1 -11
- data/bin/rubocop +5 -0
- data/lib/lolcommits/plugin/sample_plugin.rb +1 -2
- data/lib/lolcommits/sample_plugin/version.rb +1 -1
- data/lib/lolcommits/sample_plugin.rb +2 -2
- data/lolcommits-plugin-sample.gemspec +8 -9
- data/test/lolcommits/plugin/sample_plugin_test.rb +17 -19
- data/test/test_helper.rb +6 -10
- metadata +14 -40
- 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: 97ed049cbe971c2dffb65a484ea68bcaf51f477260a1cdfdce3f15210e7d151e
|
4
|
+
data.tar.gz: 79dc06a571560eb3e2d8478903d67c25c49a18b41e2718c578d473c86e2a7c2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e079b0255ccc5b871e043437504ab14891ca2c8c54fe27ee702cc1c2450ae3a76c50492caf5bded39e9e1153553caa28860c8feacb92a51afb31f41d54ba3dd3
|
7
|
+
data.tar.gz: 99da23a21319c0c67cf7d7b522ed576a8f8fd1c8a2a77a4f907ca72f580ae45f8feed50d6d0c4439ca55244cc8e04aa17f34d253ca19386a14d4e56dc55e2867
|
@@ -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-22
|
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)
|
@@ -58,7 +67,9 @@ project adheres to [Semantic Versioning][Semver].
|
|
58
67
|
### Changed
|
59
68
|
- Initial release
|
60
69
|
|
61
|
-
[Unreleased]: https://github.com/lolcommits/lolcommits-sample_plugin/compare/v0.
|
70
|
+
[Unreleased]: https://github.com/lolcommits/lolcommits-sample_plugin/compare/v0.5.1...HEAD
|
71
|
+
[0.5.1]: https://github.com/lolcommits/lolcommits-sample_plugin/compare/v0.5.0...v0.5.1
|
72
|
+
[0.5.0]: https://github.com/lolcommits/lolcommits-sample_plugin/compare/v0.4.0...v0.5.0
|
62
73
|
[0.4.0]: https://github.com/lolcommits/lolcommits-sample_plugin/compare/v0.3.0...v0.4.0
|
63
74
|
[0.3.0]: https://github.com/lolcommits/lolcommits-sample_plugin/compare/v0.2.0...v0.3.0
|
64
75
|
[0.2.0]: https://github.com/lolcommits/lolcommits-sample_plugin/compare/v0.1.2...v0.2.0
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,22 +1,20 @@
|
|
1
1
|
# Lolcommits Sample Plugin
|
2
2
|
|
3
|
+
[](https://github.com/lolcommits/lolcommits-sample_plugin/actions/workflows/ci.yml)
|
3
4
|
[](http://rubygems.org/gems/lolcommits-sample_plugin)
|
4
|
-
[](https://travis-ci.com/lolcommits/lolcommits-sample_plugin)
|
5
5
|
[](https://depfu.com/github/lolcommits/lolcommits-sample_plugin)
|
6
|
-
[](https://codeclimate.com/github/lolcommits/lolcommits-sample_plugin/maintainability)
|
7
|
-
[](https://codeclimate.com/github/lolcommits/lolcommits-sample_plugin/test_coverage)
|
8
6
|
|
9
|
-
[lolcommits](https://lolcommits.github.io/) takes a snapshot with your
|
10
|
-
|
11
|
-
|
7
|
+
[lolcommits](https://lolcommits.github.io/) takes a snapshot with your webcam
|
8
|
+
every time you git commit code, and archives a lolcat style image with it. Git
|
9
|
+
blame has never been so much fun!
|
12
10
|
|
13
|
-
Lolcommit plugins allow developers to add features by running code
|
14
|
-
|
15
|
-
|
11
|
+
Lolcommit plugins allow developers to add features by running code before or
|
12
|
+
after snapshots are taken. Installed plugin gems are automatically loaded before
|
13
|
+
the capturing process starts.
|
16
14
|
|
17
|
-
This gem showcases an example plugin. It prints short messages to the
|
18
|
-
|
19
|
-
|
15
|
+
This gem showcases an example plugin. It prints short messages to the screen
|
16
|
+
before and after every lolcommit. After configuring the plugin to be enabled,
|
17
|
+
you'll see something like this for a capture:
|
20
18
|
|
21
19
|
✨ Say cheese 😁 !
|
22
20
|
*** Preserving this moment in history.
|
@@ -24,13 +22,12 @@ be enabled, you'll see something like this for a capture:
|
|
24
22
|
wow! 9e6303c at /path/to/lolcommit.jpg is your best looking commit yet!
|
25
23
|
(it was an image!)
|
26
24
|
|
27
|
-
Use this repo to jump-start development on your own plugin. It has
|
28
|
-
|
25
|
+
Use this repo to jump-start development on your own plugin. It has tests, docs
|
26
|
+
and hooks with useful tools; CI, Rdoc etc.
|
29
27
|
|
30
28
|
## Developing your own plugin
|
31
29
|
|
32
|
-
First, there are some things your gem *must* do to be loaded and
|
33
|
-
executed:
|
30
|
+
First, there are some things your gem *must* do to be loaded and executed:
|
34
31
|
|
35
32
|
* The gem name must have a `lolcommits-` prefix.
|
36
33
|
* Require `lolcommits` in your `gemspec` file as a development
|
@@ -41,8 +38,8 @@ executed:
|
|
41
38
|
|
42
39
|
### Your Plugin Class
|
43
40
|
|
44
|
-
You plugin class must have a namespace and path that matches your gem
|
45
|
-
|
41
|
+
You plugin class must have a namespace and path that matches your gem name and
|
42
|
+
be in the gem's `LOAD_PATH`.
|
46
43
|
|
47
44
|
# for a gem named lolcommits-zapier you should have a plugin class:
|
48
45
|
class Lolcommits::Plugin::Zapier < Lolcommits::Plugin::Base
|
@@ -58,8 +55,8 @@ name and be in the gem's `LOAD_PATH`.
|
|
58
55
|
# at lib/lolcommits/plugin/super_awesome.rb
|
59
56
|
# required in a file at lib/lolcommits/super_awesome.rb
|
60
57
|
|
61
|
-
The following methods can be overridden to execute code during the
|
62
|
-
|
58
|
+
The following methods can be overridden to execute code during the capture
|
59
|
+
process:
|
63
60
|
|
64
61
|
* `run_pre_capture` - executes before the capture starts, at this point
|
65
62
|
you could alter the commit message/sha text.
|
@@ -72,12 +69,12 @@ capture process:
|
|
72
69
|
|
73
70
|
### Plugin configuration
|
74
71
|
|
75
|
-
Available options can be defined in an Array (`@options` instance var)
|
76
|
-
|
72
|
+
Available options can be defined in an Array (`@options` instance var) and/or a
|
73
|
+
Hash (by overriding the `default_options` method).
|
77
74
|
|
78
|
-
By default (on initialize), `@options` will be set to `[:enabled]`. This
|
79
|
-
|
80
|
-
|
75
|
+
By default (on initialize), `@options` will be set to `[:enabled]`. This option
|
76
|
+
is mandatory since `enabled?` checks `configuration[:enabled] == true` before
|
77
|
+
any capture hooks can run.
|
81
78
|
|
82
79
|
Using a Hash to define default options allows you to:
|
83
80
|
|
@@ -86,13 +83,13 @@ Using a Hash to define default options allows you to:
|
|
86
83
|
- define nested options (the user is prompted for each nested option
|
87
84
|
key)
|
88
85
|
|
89
|
-
`configure_option_hash` will iterate over all options prompting the user
|
90
|
-
|
86
|
+
`configure_option_hash` will iterate over all options prompting the user for
|
87
|
+
input while building the configuration Hash.
|
91
88
|
|
92
|
-
Lolcommits will save this Hash to a YAML file. During the capture
|
93
|
-
|
94
|
-
|
95
|
-
|
89
|
+
Lolcommits will save this Hash to a YAML file. During the capture process the
|
90
|
+
configuration is loaded, parsed and available in the plugin class as
|
91
|
+
`configuration`. Or if you want to fall back to default values, you should use
|
92
|
+
the `config_option` method to dig into the Hash.
|
96
93
|
|
97
94
|
Alternatively you can override these methods to fully customise the
|
98
95
|
configuration process.
|
@@ -109,25 +106,24 @@ By default a plugin will only run it's capture hooks if:
|
|
109
106
|
* `valid_configuration?` returns true
|
110
107
|
* `enabled?` returns true
|
111
108
|
|
112
|
-
A `parse_user_input` method is available to help parse strings from
|
113
|
-
|
109
|
+
A `parse_user_input` method is available to help parse strings from STDIN to
|
110
|
+
Ruby objects (e.g. boolean, integer or nil).
|
114
111
|
|
115
|
-
During plugin configuration, your plugin class will be initialized with
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
112
|
+
During plugin configuration, your plugin class will be initialized with the
|
113
|
+
optional `config` argument (and no runner). This allows you to read the existing
|
114
|
+
saved options during configuration. E.g. to show existing options back to the
|
115
|
+
user, allowing you to ask if they want to keep or change an option if
|
116
|
+
reconfiguring.
|
120
117
|
|
121
|
-
__NOTE__: If your plugin does not require configuration and should be
|
122
|
-
|
123
|
-
|
124
|
-
the plugin.
|
118
|
+
__NOTE__: If your plugin does not require configuration and should be enabled by
|
119
|
+
default (on gem install) you could override the `enabled?` method to always
|
120
|
+
return `true`. Simply uninstalling the gem will disable the plugin.
|
125
121
|
|
126
122
|
For more help, check out [the
|
127
123
|
documentation](http://www.rubydoc.info/github/lolcommits/lolcommits-sample_plugin/Lolcommits/Plugin/SamplePlugin)
|
128
124
|
for this plugin, or take a look at [other
|
129
|
-
|
130
|
-
|
125
|
+
lolcommit_plugins](https://github.com/search?q=topic%3Alolcommits-plugin+org%3Alolcommits&type=Repositories)
|
126
|
+
in the wild.
|
131
127
|
|
132
128
|
### The Lolcommits 'runner'
|
133
129
|
|
@@ -152,11 +148,11 @@ instance var for use in your plugin's code.
|
|
152
148
|
* `runner.capture_image` - `true` when an image (jpg) was captured, false for gifs/videos
|
153
149
|
|
154
150
|
After the capturing process completes, (i.e. in `run_post_capture` or
|
155
|
-
`run_capture_ready` hooks) use `runner.lolcommit_path` to access the
|
156
|
-
|
151
|
+
`run_capture_ready` hooks) use `runner.lolcommit_path` to access the lolcommit
|
152
|
+
file (jpg, mp4 or gif).
|
157
153
|
|
158
|
-
__NOTE__: it is possible for both an animated gif *AND* video to be
|
159
|
-
|
154
|
+
__NOTE__: it is possible for both an animated gif *AND* video to be generated,
|
155
|
+
in this case `lolcommits_path` points to the `mp4` video and
|
160
156
|
`runner.lolcommits_gif_path` points to the animated `gif`.
|
161
157
|
|
162
158
|
Take a look at
|
@@ -167,19 +163,18 @@ for more details.
|
|
167
163
|
|
168
164
|
After capturing (and resizing), the
|
169
165
|
[runner](https://github.com/lolcommits/lolcommits/blob/master/lib/lolcommits/runner.rb)
|
170
|
-
provides a blank (transparent) PNG for plugins to manipulate. It
|
171
|
-
|
172
|
-
|
173
|
-
To make use of this `runner.overlay`, reference it in any `post_capture`
|
174
|
-
|
175
|
-
[utility](http://rubydoc.info/github/minimagick/minimagick) method. For
|
176
|
-
|
177
|
-
[lolcommits-loltext](https://github.com/lolcommits/lolcommits-loltext)
|
166
|
+
provides a blank (transparent) PNG for plugins to manipulate. It matches the
|
167
|
+
width and height of the lolcommit capture.
|
168
|
+
|
169
|
+
To make use of this `runner.overlay`, reference it in any `post_capture` hook.
|
170
|
+
You can use any `MiniMagick::Image`
|
171
|
+
[utility](http://rubydoc.info/github/minimagick/minimagick) method. For example
|
172
|
+
the [lolcommits-loltext](https://github.com/lolcommits/lolcommits-loltext)
|
178
173
|
plugin annotates text, a border and overlay colour
|
179
174
|
[here](https://github.com/lolcommits/lolcommits-loltext/blob/master/lib/lolcommits/plugin/loltext.rb#L74).
|
180
175
|
|
181
|
-
After all `post_capture` hooks finish, this overlay PNG is composited on
|
182
|
-
|
176
|
+
After all `post_capture` hooks finish, this overlay PNG is composited on top of
|
177
|
+
the snapshot and the final lolcommit file is available at
|
183
178
|
`runner.lolcommit_path` for `capture_ready` hooks to use.
|
184
179
|
|
185
180
|
### Testing your plugin
|
@@ -227,7 +222,7 @@ repo](https://github.com/lolcommits/lolcommits-sample_plugin/blob/master/test/lo
|
|
227
222
|
|
228
223
|
## Requirements
|
229
224
|
|
230
|
-
* Ruby >=
|
225
|
+
* Ruby >= 3.1
|
231
226
|
* A webcam
|
232
227
|
* [ImageMagick](http://www.imagemagick.org)
|
233
228
|
* [ffmpeg](https://www.ffmpeg.org) (optional) for animated gif capturing
|
@@ -235,8 +230,8 @@ repo](https://github.com/lolcommits/lolcommits-sample_plugin/blob/master/test/lo
|
|
235
230
|
## Installation
|
236
231
|
|
237
232
|
Follow the [install
|
238
|
-
guide](https://github.com/lolcommits/lolcommits#installation) for
|
239
|
-
|
233
|
+
guide](https://github.com/lolcommits/lolcommits#installation) for lolcommits
|
234
|
+
first. Then run the following:
|
240
235
|
|
241
236
|
$ gem install lolcommits-sample_plugin
|
242
237
|
|
@@ -245,17 +240,15 @@ Next configure and enable this plugin with:
|
|
245
240
|
$ lolcommits --config -p sample_plugin
|
246
241
|
# set enabled to `true` and configure other options as you like
|
247
242
|
|
248
|
-
That's it! Every lolcommit now comes with it's own emoji themed
|
249
|
-
commentary!
|
243
|
+
That's it! Every lolcommit now comes with it's own emoji themed commentary!
|
250
244
|
|
251
245
|
## Development
|
252
246
|
|
253
|
-
Check out this repo and run `bin/setup`, this will install dependencies
|
254
|
-
|
255
|
-
a coverage report.
|
247
|
+
Check out this repo and run `bin/setup`, this will install dependencies and
|
248
|
+
generate docs. Run `bundle exec rake` to run all tests.
|
256
249
|
|
257
|
-
You can also run `bin/console` for an interactive prompt that will allow
|
258
|
-
|
250
|
+
You can also run `bin/console` for an interactive prompt that will allow you to
|
251
|
+
experiment with the gem code.
|
259
252
|
|
260
253
|
## Tests
|
261
254
|
|
@@ -272,29 +265,23 @@ Generate docs for this gem with:
|
|
272
265
|
## Troubles?
|
273
266
|
|
274
267
|
If you think something is broken or missing, please raise a new
|
275
|
-
[issue](https://github.com/lolcommits/lolcommits-sample_plugin/issues).
|
276
|
-
|
277
|
-
closed).
|
268
|
+
[issue](https://github.com/lolcommits/lolcommits-sample_plugin/issues). Take a
|
269
|
+
moment to check it hasn't been raised in the past (and possibly closed).
|
278
270
|
|
279
271
|
## Contributing
|
280
272
|
|
281
|
-
Bug
|
282
|
-
[
|
283
|
-
and [pull
|
284
|
-
requests](https://github.com/lolcommits/lolcommits-sample_plugin/pulls)
|
273
|
+
Bug [reports](https://github.com/lolcommits/lolcommits-sample_plugin/issues) and
|
274
|
+
[pull requests](https://github.com/lolcommits/lolcommits-sample_plugin/pulls)
|
285
275
|
are welcome on GitHub.
|
286
276
|
|
287
|
-
When submitting pull requests, remember to add tests covering any new
|
288
|
-
|
289
|
-
CI](https://travis-ci.com/lolcommits/lolcommits-sample_plugin). Read the
|
290
|
-
[contributing
|
277
|
+
When submitting pull requests, remember to add tests covering any new behaviour,
|
278
|
+
and ensure all tests are passing on CI. Read the [contributing
|
291
279
|
guidelines](https://github.com/lolcommits/lolcommits-sample_plugin/blob/master/CONTRIBUTING.md)
|
292
280
|
for more details.
|
293
281
|
|
294
|
-
This project is intended to be a safe, welcoming space for
|
295
|
-
|
296
|
-
|
297
|
-
See
|
282
|
+
This project is intended to be a safe, welcoming space for collaboration, and
|
283
|
+
contributors are expected to adhere to the [Contributor
|
284
|
+
Covenant](http://contributor-covenant.org) code of conduct. See
|
298
285
|
[here](https://github.com/lolcommits/lolcommits-sample_plugin/blob/master/CODE_OF_CONDUCT.md)
|
299
286
|
for more details.
|
300
287
|
|
@@ -305,10 +292,8 @@ The gem is available as open source under the terms of
|
|
305
292
|
|
306
293
|
## Links
|
307
294
|
|
308
|
-
* [
|
309
|
-
* [
|
310
|
-
* [Code Climate](https://codeclimate.com/github/lolcommits/lolcommits-sample_plugin)
|
311
|
-
* [RDoc](http://rdoc.info/projects/lolcommits/lolcommits-sample_plugin)
|
295
|
+
* [CI](https://github.com/lolcommits/lolcommits-sample_plugin/actions/workflows/ci.yml)
|
296
|
+
* [RDoc](https://rubydoc.info/gems/lolcommits-sample_plugin)
|
312
297
|
* [Issues](http://github.com/lolcommits/lolcommits-sample_plugin/issues)
|
313
298
|
* [Report a bug](http://github.com/lolcommits/lolcommits-sample_plugin/issues/new)
|
314
299
|
* [Gem](http://rubygems.org/gems/lolcommits-sample_plugin)
|
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
@@ -5,15 +5,16 @@ require 'lolcommits/sample_plugin/version'
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "lolcommits-sample_plugin"
|
7
7
|
spec.version = Lolcommits::SamplePlugin::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(Example gem for lolcommits plugin development)
|
11
11
|
spec.homepage = "https://github.com/lolcommits/lolcommits-sample_plugin"
|
12
12
|
spec.license = "LGPL-3.0"
|
13
|
-
spec.description = %q
|
13
|
+
spec.description = %q(Use this gem as a guide or template to get started with lolcommits plugin development)
|
14
14
|
|
15
15
|
spec.metadata = {
|
16
16
|
"homepage_uri" => "https://github.com/lolcommits/lolcommits-sample_plugin",
|
17
|
+
"documentation_uri" => "https://rubydoc.info/gems/lolcommits-sample_plugin",
|
17
18
|
"changelog_uri" => "https://github.com/lolcommits/lolcommits-sample_plugin/blob/master/CHANGELOG.md",
|
18
19
|
"source_code_uri" => "https://github.com/lolcommits/lolcommits-sample_plugin",
|
19
20
|
"bug_tracker_uri" => "https://github.com/lolcommits/lolcommits-sample_plugin/issues",
|
@@ -24,15 +25,13 @@ Gem::Specification.new do |spec|
|
|
24
25
|
spec.test_files = `git ls-files -- {test,features}/*`.split("\n")
|
25
26
|
spec.bindir = "bin"
|
26
27
|
spec.executables = []
|
27
|
-
spec.require_paths = ["lib"]
|
28
|
+
spec.require_paths = [ "lib" ]
|
28
29
|
|
29
|
-
spec.required_ruby_version = ">=
|
30
|
+
spec.required_ruby_version = ">= 3.1"
|
30
31
|
|
31
|
-
spec.add_runtime_dependency "lolcommits", ">= 0.
|
32
|
+
spec.add_runtime_dependency "lolcommits", ">= 0.17.2"
|
32
33
|
|
33
34
|
spec.add_development_dependency "bundler"
|
34
35
|
spec.add_development_dependency "rake"
|
35
36
|
spec.add_development_dependency "minitest"
|
36
|
-
spec.add_development_dependency "simplecov"
|
37
|
-
spec.add_development_dependency "pry"
|
38
37
|
end
|
@@ -1,13 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "test_helper"
|
4
4
|
|
5
5
|
describe Lolcommits::Plugin::SamplePlugin do
|
6
|
-
|
7
6
|
include Lolcommits::TestHelpers::GitRepo
|
8
7
|
include Lolcommits::TestHelpers::FakeIO
|
9
8
|
|
10
|
-
describe
|
9
|
+
describe "with a runner" do
|
11
10
|
def runner
|
12
11
|
# a simple lolcommits runner with an empty configuration Hash
|
13
12
|
@runner ||= Lolcommits::Runner.new(
|
@@ -31,10 +30,10 @@ describe Lolcommits::Plugin::SamplePlugin do
|
|
31
30
|
}
|
32
31
|
end
|
33
32
|
|
34
|
-
describe
|
33
|
+
describe "#run_pre_capture" do
|
35
34
|
before { commit_repo_with_message }
|
36
35
|
|
37
|
-
it
|
36
|
+
it "outputs a message to stdout" do
|
38
37
|
in_repo do
|
39
38
|
_(Proc.new { plugin.run_pre_capture }).
|
40
39
|
must_output "✨ Say cheese 😁 !\n"
|
@@ -44,10 +43,10 @@ describe Lolcommits::Plugin::SamplePlugin do
|
|
44
43
|
after { teardown_repo }
|
45
44
|
end
|
46
45
|
|
47
|
-
describe
|
46
|
+
describe "#run_post_capture" do
|
48
47
|
before { commit_repo_with_message }
|
49
48
|
|
50
|
-
it
|
49
|
+
it "outputs a message to stdout" do
|
51
50
|
plugin.configuration = valid_enabled_config
|
52
51
|
in_repo do
|
53
52
|
_(Proc.new { plugin.run_post_capture }).
|
@@ -58,11 +57,10 @@ describe Lolcommits::Plugin::SamplePlugin do
|
|
58
57
|
after { teardown_repo }
|
59
58
|
end
|
60
59
|
|
61
|
-
describe
|
62
|
-
|
60
|
+
describe "#run_capture_ready" do
|
63
61
|
before { commit_repo_with_message }
|
64
62
|
|
65
|
-
it
|
63
|
+
it "outputs a message to stdout" do
|
66
64
|
in_repo do
|
67
65
|
_(Proc.new { plugin.run_capture_ready }).
|
68
66
|
must_output "wow! #{last_commit.sha[0..10]} at /path/to/lolcommit.jpg is your best looking commit yet!\n(it was an image!)\n"
|
@@ -72,34 +70,34 @@ describe Lolcommits::Plugin::SamplePlugin do
|
|
72
70
|
after { teardown_repo }
|
73
71
|
end
|
74
72
|
|
75
|
-
describe
|
76
|
-
it
|
73
|
+
describe "#enabled?" do
|
74
|
+
it "returns be false by default" do
|
77
75
|
_(plugin.enabled?).must_equal false
|
78
76
|
end
|
79
77
|
|
80
|
-
it
|
78
|
+
it "returns true when configured" do
|
81
79
|
plugin.configuration = valid_enabled_config
|
82
80
|
_(plugin.enabled?).must_equal true
|
83
81
|
end
|
84
82
|
end
|
85
83
|
|
86
|
-
describe
|
87
|
-
it
|
84
|
+
describe "configuration" do
|
85
|
+
it "allows plugin options to be configured" do
|
88
86
|
configured_plugin_options = {}
|
89
87
|
|
90
|
-
fake_io_capture(inputs: %w
|
88
|
+
fake_io_capture(inputs: %w[true false true true 5]) do
|
91
89
|
configured_plugin_options = plugin.configure_options!
|
92
90
|
end
|
93
91
|
|
94
92
|
_(configured_plugin_options).must_equal(valid_enabled_config)
|
95
93
|
end
|
96
94
|
|
97
|
-
describe
|
98
|
-
it
|
95
|
+
describe "#valid_configuration?" do
|
96
|
+
it "returns false without config set" do
|
99
97
|
_(plugin.valid_configuration?).must_equal(false)
|
100
98
|
end
|
101
99
|
|
102
|
-
it
|
100
|
+
it "returns true for a valid configuration" do
|
103
101
|
plugin.configuration = valid_enabled_config
|
104
102
|
_(plugin.valid_configuration?).must_equal true
|
105
103
|
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/sample_plugin"
|
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-sample_plugin
|
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: :runtime
|
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,34 +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
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: pry
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
69
|
description: Use this gem as a guide or template to get started with lolcommits plugin
|
98
70
|
development
|
99
71
|
email:
|
@@ -102,18 +74,19 @@ executables: []
|
|
102
74
|
extensions: []
|
103
75
|
extra_rdoc_files: []
|
104
76
|
files:
|
77
|
+
- ".github/workflows/ci.yml"
|
105
78
|
- ".gitignore"
|
106
|
-
- ".
|
107
|
-
- ".
|
79
|
+
- ".quickhook/pre-commit/ruby-lint"
|
80
|
+
- ".rubocop.yml"
|
108
81
|
- CHANGELOG.md
|
109
82
|
- CODE_OF_CONDUCT.md
|
110
83
|
- CONTRIBUTING.md
|
111
84
|
- Gemfile
|
112
85
|
- LICENSE
|
113
|
-
- PULL_REQUEST_TEMPLATE.md
|
114
86
|
- README.md
|
115
87
|
- Rakefile
|
116
88
|
- bin/console
|
89
|
+
- bin/rubocop
|
117
90
|
- bin/setup
|
118
91
|
- lib/lolcommits/plugin/sample_plugin.rb
|
119
92
|
- lib/lolcommits/sample_plugin.rb
|
@@ -126,11 +99,12 @@ licenses:
|
|
126
99
|
- LGPL-3.0
|
127
100
|
metadata:
|
128
101
|
homepage_uri: https://github.com/lolcommits/lolcommits-sample_plugin
|
102
|
+
documentation_uri: https://rubydoc.info/gems/lolcommits-sample_plugin
|
129
103
|
changelog_uri: https://github.com/lolcommits/lolcommits-sample_plugin/blob/master/CHANGELOG.md
|
130
104
|
source_code_uri: https://github.com/lolcommits/lolcommits-sample_plugin
|
131
105
|
bug_tracker_uri: https://github.com/lolcommits/lolcommits-sample_plugin/issues
|
132
106
|
allowed_push_host: https://rubygems.org
|
133
|
-
post_install_message:
|
107
|
+
post_install_message:
|
134
108
|
rdoc_options: []
|
135
109
|
require_paths:
|
136
110
|
- lib
|
@@ -138,15 +112,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
138
112
|
requirements:
|
139
113
|
- - ">="
|
140
114
|
- !ruby/object:Gem::Version
|
141
|
-
version: '
|
115
|
+
version: '3.1'
|
142
116
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
117
|
requirements:
|
144
118
|
- - ">="
|
145
119
|
- !ruby/object:Gem::Version
|
146
120
|
version: '0'
|
147
121
|
requirements: []
|
148
|
-
rubygems_version: 3.
|
149
|
-
signing_key:
|
122
|
+
rubygems_version: 3.5.22
|
123
|
+
signing_key:
|
150
124
|
specification_version: 4
|
151
125
|
summary: Example gem for lolcommits plugin development
|
152
126
|
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=7fb6d4a66ca2ac21658b29d3738952994f3b68354a8e3e6318bf1108eda6c243
|
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 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.
|