lolcommits-sample_plugin 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -3
- data/README.md +134 -92
- data/lib/lolcommits/plugin/sample_plugin.rb +10 -1
- data/lib/lolcommits/sample_plugin/version.rb +1 -1
- data/lolcommits-plugin-sample.gemspec +8 -15
- data/test/lolcommits/plugin/sample_plugin_test.rb +4 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 012e40f9cc88085939e10c8fe64b3956fc3534f6a9996c0de8876a4cb03108d8
|
4
|
+
data.tar.gz: 74dfbd40082fd6f60132b4db81b3874b58f2f52c59ca51f800f152104f8272c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ac9ae23daae6bebfb0eb55abdbc1af77250ce3995baacf7e197f491c5ff2cd190a2965c7896c375bfe18f6411688fe43a76b24cc16bf017340b202498789559
|
7
|
+
data.tar.gz: 162a0ad8da9e1bfc1ee52b293d2a9ca670e2c3f53c6adc6a6869501d9fa530bb4842eb04059c4e65ce3d2aea8314f8563d0855416c141a65a2ced2cf410dbddb
|
data/CHANGELOG.md
CHANGED
@@ -2,13 +2,21 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
|
5
|
-
The format is based on [Keep a Changelog][KeepAChangelog] and this
|
6
|
-
adheres to [Semantic Versioning][Semver].
|
5
|
+
The format is based on [Keep a Changelog][KeepAChangelog] and this
|
6
|
+
project adheres to [Semantic Versioning][Semver].
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
10
|
- Your contribution here!
|
11
11
|
|
12
|
+
## [0.3.0] - 2019-05-20
|
13
|
+
### Changed
|
14
|
+
- Requires at least lolcommits >= `0.14.2`
|
15
|
+
- Update README and gemspec
|
16
|
+
|
17
|
+
### Removed
|
18
|
+
- Support for lolcommits < `0.14.2`
|
19
|
+
|
12
20
|
## [0.2.0] - 2019-04-24
|
13
21
|
### Removed
|
14
22
|
- Support for Ruby < 2.3 (older rubies no longer supported)
|
@@ -46,7 +54,8 @@ adheres to [Semantic Versioning][Semver].
|
|
46
54
|
### Changed
|
47
55
|
- Initial release
|
48
56
|
|
49
|
-
[Unreleased]: https://github.com/lolcommits/lolcommits-sample_plugin/compare/v0.
|
57
|
+
[Unreleased]: https://github.com/lolcommits/lolcommits-sample_plugin/compare/v0.3.0...HEAD
|
58
|
+
[0.3.0]: https://github.com/lolcommits/lolcommits-sample_plugin/compare/v0.2.0...v0.3.0
|
50
59
|
[0.2.0]: https://github.com/lolcommits/lolcommits-sample_plugin/compare/v0.1.2...v0.2.0
|
51
60
|
[0.1.2]: https://github.com/lolcommits/lolcommits-sample_plugin/compare/v0.1.1...v0.1.2
|
52
61
|
[0.1.1]: https://github.com/lolcommits/lolcommits-sample_plugin/compare/v0.1.0...v0.1.1
|
data/README.md
CHANGED
@@ -1,45 +1,48 @@
|
|
1
1
|
# Lolcommits Sample Plugin
|
2
2
|
|
3
3
|
[![Gem](https://img.shields.io/gem/v/lolcommits-sample_plugin.svg?style=flat)](http://rubygems.org/gems/lolcommits-sample_plugin)
|
4
|
-
[![Travis](https://
|
4
|
+
[![Travis](https://img.shields.io/travis/com/lolcommits/lolcommits-sample_plugin/master.svg?style=flat)](https://travis-ci.com/lolcommits/lolcommits-sample_plugin)
|
5
5
|
[![Depfu](https://img.shields.io/depfu/lolcommits/lolcommits-sample_plugin.svg?style=flat)](https://depfu.com/github/lolcommits/lolcommits-sample_plugin)
|
6
6
|
[![Maintainability](https://api.codeclimate.com/v1/badges/ce34ea41c79820a2fc75/maintainability)](https://codeclimate.com/github/lolcommits/lolcommits-sample_plugin/maintainability)
|
7
7
|
[![Test Coverage](https://api.codeclimate.com/v1/badges/ce34ea41c79820a2fc75/test_coverage)](https://codeclimate.com/github/lolcommits/lolcommits-sample_plugin/test_coverage)
|
8
8
|
|
9
|
-
[lolcommits](https://lolcommits.github.io/) takes a snapshot with your
|
10
|
-
every time you git commit code, and archives a lolcat style image
|
11
|
-
blame has never been so much fun!
|
9
|
+
[lolcommits](https://lolcommits.github.io/) takes a snapshot with your
|
10
|
+
webcam every time you git commit code, and archives a lolcat style image
|
11
|
+
with it. Git blame has never been so much fun!
|
12
12
|
|
13
|
-
Lolcommit plugins allow developers to add features by running code
|
14
|
-
after snapshots are taken. Installed plugin gems are
|
15
|
-
the capturing process starts.
|
13
|
+
Lolcommit plugins allow developers to add features by running code
|
14
|
+
before or after snapshots are taken. Installed plugin gems are
|
15
|
+
automatically loaded before the capturing process starts.
|
16
16
|
|
17
|
-
This gem showcases an example plugin. It prints short messages to the
|
18
|
-
before and after every lolcommit. After configuring the plugin to
|
19
|
-
you'll see something like this for a capture:
|
17
|
+
This gem showcases an example plugin. It prints short messages to the
|
18
|
+
screen before and after every lolcommit. After configuring the plugin to
|
19
|
+
be enabled, you'll see something like this for a capture:
|
20
20
|
|
21
21
|
✨ Say cheese 😁 !
|
22
22
|
*** Preserving this moment in history.
|
23
23
|
📸 Snap
|
24
|
-
|
24
|
+
wow! 9e6303c at /path/to/lolcommit.jpg is your best looking commit yet!
|
25
|
+
(it was an image!)
|
25
26
|
|
26
|
-
Use this repo to jump-start development on your own plugin. It has
|
27
|
-
and hooks with useful tools; Travis, CodeClimate, Rdoc etc.
|
27
|
+
Use this repo to jump-start development on your own plugin. It has
|
28
|
+
tests, docs and hooks with useful tools; Travis, CodeClimate, Rdoc etc.
|
28
29
|
|
29
30
|
## Developing your own plugin
|
30
31
|
|
31
|
-
First, there are some things your gem *must* do to be loaded and
|
32
|
+
First, there are some things your gem *must* do to be loaded and
|
33
|
+
executed:
|
32
34
|
|
33
35
|
* The gem name must have a `lolcommits-` prefix.
|
34
|
-
* Require `lolcommits` in your `gemspec` file as a development
|
35
|
-
|
36
|
-
|
36
|
+
* Require `lolcommits` in your `gemspec` file as a development
|
37
|
+
dependency.
|
38
|
+
* Include a class that inherits from `Lolcommits::Plugin::Base` (this
|
39
|
+
will be the entry point to your plugin from the lolcommits gem).
|
37
40
|
* This main plugin class must meet the requirements explained below.
|
38
41
|
|
39
42
|
### Your Plugin Class
|
40
43
|
|
41
|
-
You plugin class must have a namespace and path that matches your gem
|
42
|
-
be in the gem's `LOAD_PATH`.
|
44
|
+
You plugin class must have a namespace and path that matches your gem
|
45
|
+
name and be in the gem's `LOAD_PATH`.
|
43
46
|
|
44
47
|
# for a gem named lolcommits-zapier you should have a plugin class:
|
45
48
|
class Lolcommits::Plugin::Zapier < Lolcommits::Plugin::Base
|
@@ -55,46 +58,50 @@ be in the gem's `LOAD_PATH`.
|
|
55
58
|
# at lib/lolcommits/plugin/super_awesome.rb
|
56
59
|
# required in a file at lib/lolcommits/super_awesome.rb
|
57
60
|
|
58
|
-
The following methods can be overridden to execute code during the
|
59
|
-
process:
|
61
|
+
The following methods can be overridden to execute code during the
|
62
|
+
capture process:
|
60
63
|
|
61
|
-
* `run_pre_capture` - executes before the capture starts, at this point
|
62
|
-
could alter the commit message/sha text.
|
63
|
-
* `run_post_capture` - executes immediately after the camera captures,
|
64
|
-
hook to manipulate the image (e.g. resize, apply filters,
|
65
|
-
|
66
|
-
|
64
|
+
* `run_pre_capture` - executes before the capture starts, at this point
|
65
|
+
you could alter the commit message/sha text.
|
66
|
+
* `run_post_capture` - executes immediately after the camera captures,
|
67
|
+
use this hook to manipulate the image (e.g. resize, apply filters,
|
68
|
+
annotate).
|
69
|
+
* `run_capture_ready` - executes after all `run_post_capture` hooks have
|
70
|
+
ran, at this point we consider the capture to be ready for exporting
|
71
|
+
or sharing.
|
67
72
|
|
68
73
|
### Plugin configuration
|
69
74
|
|
70
|
-
Available options can be defined in an Array (`@options` instance var)
|
71
|
-
Hash (by overriding the `default_options` method).
|
75
|
+
Available options can be defined in an Array (`@options` instance var)
|
76
|
+
and/or a Hash (by overriding the `default_options` method).
|
72
77
|
|
73
|
-
By default (on initialize), `@options` will be set to `[:enabled]`. This
|
74
|
-
is mandatory since `enabled?` checks `configuration[:enabled] ==
|
75
|
-
any capture hooks can run.
|
78
|
+
By default (on initialize), `@options` will be set to `[:enabled]`. This
|
79
|
+
option is mandatory since `enabled?` checks `configuration[:enabled] ==
|
80
|
+
true` before any capture hooks can run.
|
76
81
|
|
77
82
|
Using a Hash to define default options allows you to:
|
78
83
|
|
79
|
-
- fall back to default values (or nil) if the user enters nothing when
|
80
|
-
|
84
|
+
- fall back to default values (or nil) if the user enters nothing when
|
85
|
+
prompted
|
86
|
+
- define nested options (the user is prompted for each nested option
|
87
|
+
key)
|
81
88
|
|
82
|
-
`configure_option_hash` will iterate over all options prompting the user
|
83
|
-
input while building the configuration Hash.
|
89
|
+
`configure_option_hash` will iterate over all options prompting the user
|
90
|
+
for input while building the configuration Hash.
|
84
91
|
|
85
|
-
Lolcommits will save this Hash to a YAML file. During the capture
|
86
|
-
configuration is loaded, parsed and available in the plugin
|
87
|
-
`configuration`. Or if you want to fall back to default values,
|
88
|
-
the `config_option` method to dig into the Hash.
|
92
|
+
Lolcommits will save this Hash to a YAML file. During the capture
|
93
|
+
process the configuration is loaded, parsed and available in the plugin
|
94
|
+
class as `configuration`. Or if you want to fall back to default values,
|
95
|
+
you should use the `config_option` method to dig into the Hash.
|
89
96
|
|
90
97
|
Alternatively you can override these methods to fully customise the
|
91
98
|
configuration process.
|
92
99
|
|
93
|
-
* `def configure_options!` - by default this prompts the user for option
|
94
|
-
(based on option names in the `@options` array and/or
|
95
|
-
returns a Hash that will be persisted.
|
96
|
-
* `def enabled?` - by default checks if `configuration[:enabled] ==
|
97
|
-
determine if the plugin should run.
|
100
|
+
* `def configure_options!` - by default this prompts the user for option
|
101
|
+
values (based on option names in the `@options` array and/or
|
102
|
+
`default_options`) and returns a Hash that will be persisted.
|
103
|
+
* `def enabled?` - by default checks if `configuration[:enabled] ==
|
104
|
+
true` to determine if the plugin should run.
|
98
105
|
* `def valid_configuration?`- checks the persisted config Hash is valid.
|
99
106
|
|
100
107
|
By default a plugin will only run it's capture hooks if:
|
@@ -102,55 +109,83 @@ By default a plugin will only run it's capture hooks if:
|
|
102
109
|
* `valid_configuration?` returns true
|
103
110
|
* `enabled?` returns true
|
104
111
|
|
105
|
-
A `parse_user_input` method is available to help parse strings from
|
106
|
-
Ruby objects (e.g. boolean, integer or nil).
|
112
|
+
A `parse_user_input` method is available to help parse strings from
|
113
|
+
STDIN to Ruby objects (e.g. boolean, integer or nil).
|
107
114
|
|
108
|
-
During plugin configuration, your plugin class will be initialized with
|
109
|
-
optional `config` argument (and no runner). This allows you to read
|
110
|
-
saved options during configuration. E.g. to show existing
|
111
|
-
user, allowing you to ask if they want to keep or
|
112
|
-
reconfiguring.
|
115
|
+
During plugin configuration, your plugin class will be initialized with
|
116
|
+
the optional `config` argument (and no runner). This allows you to read
|
117
|
+
the existing saved options during configuration. E.g. to show existing
|
118
|
+
options back to the user, allowing you to ask if they want to keep or
|
119
|
+
change an option if reconfiguring.
|
113
120
|
|
114
|
-
__NOTE__: If your plugin does not require configuration and should be
|
115
|
-
default (on gem install) you could override the `enabled?`
|
116
|
-
return `true`. Simply uninstalling the gem will disable
|
121
|
+
__NOTE__: If your plugin does not require configuration and should be
|
122
|
+
enabled by default (on gem install) you could override the `enabled?`
|
123
|
+
method to always return `true`. Simply uninstalling the gem will disable
|
124
|
+
the plugin.
|
117
125
|
|
118
126
|
For more help, check out [the
|
119
127
|
documentation](http://www.rubydoc.info/github/lolcommits/lolcommits-sample_plugin/Lolcommits/Plugin/SamplePlugin)
|
120
128
|
for this plugin, or take a look at [other
|
121
|
-
lolcommit_plugins](https://github.com/search?q=topic%3Alolcommits-plugin+org%3Alolcommits&type=Repositories)
|
129
|
+
lolcommit_plugins](https://github.com/search?q=topic%3Alolcommits-plugin+org%3Alolcommits&type=Repositories)
|
130
|
+
in the wild.
|
122
131
|
|
123
132
|
### The Lolcommits 'runner'
|
124
133
|
|
125
134
|
The only required argument for your plugin class initializer is a
|
126
|
-
[Lolcommits::Runner](https://github.com/
|
135
|
+
[Lolcommits::Runner](https://github.com/lolcommits/lolcommits/blob/master/lib/lolcommits/runner.rb)
|
127
136
|
instance. By default, the base plugin initializer will set this in the `runner`
|
128
137
|
instance var for use in your plugin's code.
|
129
138
|
|
130
139
|
* `runner.message` - the commit message
|
131
140
|
* `runner.sha` - the sha for the current commit
|
132
141
|
* `runner.vcs_info` - a reference to the
|
133
|
-
[Lolcommits::VCSInfo](https://github.com/
|
142
|
+
[Lolcommits::VCSInfo](https://github.com/lolcommits/lolcommits/blob/master/lib/lolcommits/vcs_info.rb)
|
134
143
|
instance
|
135
144
|
* `runner.config` - a reference to the
|
136
|
-
[Lolcommits::Configuration](https://github.com/
|
145
|
+
[Lolcommits::Configuration](https://github.com/lolcommits/lolcommits/blob/master/lib/lolcommits/configuration.rb)
|
137
146
|
instance
|
147
|
+
* `runner.overlay` - blank transparent PNG (`MiniMagick::Image` instance)
|
148
|
+
* `runner.lolcommits_path` - the processed lolcommit file path (jpg, mp4 or gif)
|
149
|
+
* `runner.lolcommits_gif_path` - the processed lolcommit animated gif path (may be `nil`)
|
150
|
+
* `runner.capture_video` - `true` when a video capture was generated
|
151
|
+
* `runner.capture_gif` - `true` when an animated gif capture was generated
|
152
|
+
* `runner.capture_image` - `true` when an image (jpg) was captured, false for gifs/videos
|
138
153
|
|
139
154
|
After the capturing process completes, (i.e. in `run_post_capture` or
|
140
|
-
`run_capture_ready` hooks) use
|
155
|
+
`run_capture_ready` hooks) use `runner.lolcommit_path` to access the
|
156
|
+
lolcommit file (jpg, mp4 or gif).
|
141
157
|
|
142
|
-
|
143
|
-
|
144
|
-
|
158
|
+
__NOTE__: it is possible for both an animated gif *AND* video to be
|
159
|
+
generated, in this case `lolcommits_path` points to the `mp4` video and
|
160
|
+
`runner.lolcommits_gif_path` points to the animated `gif`.
|
145
161
|
|
146
162
|
Take a look at
|
147
|
-
[Lolcommits::Runner](https://github.com/
|
163
|
+
[Lolcommits::Runner](https://github.com/lolcommits/lolcommits/blob/master/lib/lolcommits/runner.rb)
|
148
164
|
for more details.
|
149
165
|
|
166
|
+
#### Overlay PNG
|
167
|
+
|
168
|
+
After capturing (and resizing), the
|
169
|
+
[runner](https://github.com/lolcommits/lolcommits/blob/master/lib/lolcommits/runner.rb)
|
170
|
+
provides a blank (transparent) PNG for plugins to manipulate. It
|
171
|
+
matches the width and height of the lolcommit capture.
|
172
|
+
|
173
|
+
To make use of this `runner.overlay`, reference it in any `post_capture`
|
174
|
+
hook. You can use any `MiniMagick::Image`
|
175
|
+
[utility](http://rubydoc.info/github/minimagick/minimagick) method. For
|
176
|
+
example the
|
177
|
+
[lolcommits-loltext](https://github.com/lolcommits/lolcommits-loltext)
|
178
|
+
plugin annotates text, a border and overlay colour
|
179
|
+
[here](https://github.com/lolcommits/lolcommits-loltext/blob/master/lib/lolcommits/plugin/loltext.rb#L74).
|
180
|
+
|
181
|
+
After all `post_capture` hooks finish, this overlay PNG is composited on
|
182
|
+
top of the snapshot and the final lolcommit file is available at
|
183
|
+
`runner.lolcommit_path` for `capture_ready` hooks to use.
|
184
|
+
|
150
185
|
### Testing your plugin
|
151
186
|
|
152
|
-
To make test setup easier, the lolcommits gem includes these helpers to
|
153
|
-
with command line IO and Git.
|
187
|
+
To make test setup easier, the lolcommits gem includes these helpers to
|
188
|
+
work with command line IO and Git.
|
154
189
|
|
155
190
|
# add one (or both) of these to your plugin's test_helper file
|
156
191
|
require 'lolcommits/test_helpers/git_repo'
|
@@ -162,11 +197,11 @@ with command line IO and Git.
|
|
162
197
|
|
163
198
|
Use the following methods to manage a test repo:
|
164
199
|
|
165
|
-
setup_repo
|
166
|
-
commit_repo_with_message
|
167
|
-
last_commit
|
168
|
-
teardown_repo
|
169
|
-
in_repo(&block)
|
200
|
+
setup_repo # create the test repo
|
201
|
+
commit_repo_with_message # perform a git commit in the test repo
|
202
|
+
last_commit # commit info for the last test repo commit
|
203
|
+
teardown_repo # destroy the test repo
|
204
|
+
in_repo(&block) # run lolcommits within the test repo
|
170
205
|
|
171
206
|
For STDIN and capturing IO use the `fake_io_capture` method.
|
172
207
|
|
@@ -183,8 +218,9 @@ repo](https://github.com/lolcommits/lolcommits-sample_plugin/blob/master/test/lo
|
|
183
218
|
|
184
219
|
* Use this gem as a starting point, renaming files, classes etc.
|
185
220
|
* For more examples, take a look at other published [lolcommit
|
186
|
-
plugins](https://github.com/lolcommits).
|
187
|
-
* If you feel something is missing (or out of date) in this guide. Post
|
221
|
+
plugins](https://github.com/lolcommits).
|
222
|
+
* If you feel something is missing (or out of date) in this guide. Post
|
223
|
+
an
|
188
224
|
[issue](https://github.com/lolcommits/lolcommits-sample_plugin/issues).
|
189
225
|
|
190
226
|
---
|
@@ -198,7 +234,8 @@ plugins](https://github.com/lolcommits).
|
|
198
234
|
|
199
235
|
## Installation
|
200
236
|
|
201
|
-
Follow the [install
|
237
|
+
Follow the [install
|
238
|
+
guide](https://github.com/lolcommits/lolcommits#installation) for
|
202
239
|
lolcommits first. Then run the following:
|
203
240
|
|
204
241
|
$ gem install lolcommits-sample_plugin
|
@@ -208,16 +245,17 @@ Next configure and enable this plugin with:
|
|
208
245
|
$ lolcommits --config -p sample_plugin
|
209
246
|
# set enabled to `true` and configure other options as you like
|
210
247
|
|
211
|
-
That's it! Every lolcommit now comes with it's own emoji themed
|
248
|
+
That's it! Every lolcommit now comes with it's own emoji themed
|
249
|
+
commentary!
|
212
250
|
|
213
251
|
## Development
|
214
252
|
|
215
|
-
Check out this repo and run `bin/setup`, this will install dependencies
|
216
|
-
generate docs. Run `bundle exec rake` to run all tests and generate
|
217
|
-
report.
|
253
|
+
Check out this repo and run `bin/setup`, this will install dependencies
|
254
|
+
and generate docs. Run `bundle exec rake` to run all tests and generate
|
255
|
+
a coverage report.
|
218
256
|
|
219
|
-
You can also run `bin/console` for an interactive prompt that will allow
|
220
|
-
experiment with the gem code.
|
257
|
+
You can also run `bin/console` for an interactive prompt that will allow
|
258
|
+
you to experiment with the gem code.
|
221
259
|
|
222
260
|
## Tests
|
223
261
|
|
@@ -234,25 +272,29 @@ Generate docs for this gem with:
|
|
234
272
|
## Troubles?
|
235
273
|
|
236
274
|
If you think something is broken or missing, please raise a new
|
237
|
-
[issue](https://github.com/lolcommits/lolcommits-sample_plugin/issues).
|
238
|
-
moment to check it hasn't been raised in the past (and possibly
|
275
|
+
[issue](https://github.com/lolcommits/lolcommits-sample_plugin/issues).
|
276
|
+
Take a moment to check it hasn't been raised in the past (and possibly
|
277
|
+
closed).
|
239
278
|
|
240
279
|
## Contributing
|
241
280
|
|
242
|
-
Bug
|
243
|
-
|
244
|
-
|
281
|
+
Bug
|
282
|
+
[reports](https://github.com/lolcommits/lolcommits-sample_plugin/issues)
|
283
|
+
and [pull
|
284
|
+
requests](https://github.com/lolcommits/lolcommits-sample_plugin/pulls)
|
285
|
+
are welcome on GitHub.
|
245
286
|
|
246
|
-
When submitting pull requests, remember to add tests covering any new
|
247
|
-
and ensure all tests are passing on [Travis
|
248
|
-
CI](https://travis-ci.
|
287
|
+
When submitting pull requests, remember to add tests covering any new
|
288
|
+
behaviour, and ensure all tests are passing on [Travis
|
289
|
+
CI](https://travis-ci.com/lolcommits/lolcommits-sample_plugin). Read the
|
249
290
|
[contributing
|
250
291
|
guidelines](https://github.com/lolcommits/lolcommits-sample_plugin/blob/master/CONTRIBUTING.md)
|
251
292
|
for more details.
|
252
293
|
|
253
|
-
This project is intended to be a safe, welcoming space for
|
254
|
-
contributors are expected to adhere to the
|
255
|
-
Covenant](http://contributor-covenant.org) code of conduct.
|
294
|
+
This project is intended to be a safe, welcoming space for
|
295
|
+
collaboration, and contributors are expected to adhere to the
|
296
|
+
[Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
297
|
+
See
|
256
298
|
[here](https://github.com/lolcommits/lolcommits-sample_plugin/blob/master/CODE_OF_CONDUCT.md)
|
257
299
|
for more details.
|
258
300
|
|
@@ -263,7 +305,7 @@ The gem is available as open source under the terms of
|
|
263
305
|
|
264
306
|
## Links
|
265
307
|
|
266
|
-
* [Travis CI](https://travis-ci.
|
308
|
+
* [Travis CI](https://travis-ci.com/lolcommits/lolcommits-sample_plugin)
|
267
309
|
* [Test Coverage](https://codeclimate.com/github/lolcommits/lolcommits-sample_plugin/test_coverage)
|
268
310
|
* [Code Climate](https://codeclimate.com/github/lolcommits/lolcommits-sample_plugin)
|
269
311
|
* [RDoc](http://rdoc.info/projects/lolcommits/lolcommits-sample_plugin)
|
@@ -59,7 +59,16 @@ module Lolcommits
|
|
59
59
|
#
|
60
60
|
def run_capture_ready
|
61
61
|
if config_option(:always_a_great_commit?)
|
62
|
-
puts "
|
62
|
+
puts "wow! #{self.runner.sha} at #{self.runner.lolcommit_path} is your best looking commit yet!"
|
63
|
+
end
|
64
|
+
|
65
|
+
# describe the lolcommit
|
66
|
+
if self.runner.capture_image?
|
67
|
+
puts "(it was an image!)"
|
68
|
+
elsif self.runner.capture_video
|
69
|
+
puts "(it was a video!)"
|
70
|
+
elsif self.runner.capture_gif
|
71
|
+
puts "(it was a gif!)"
|
63
72
|
end
|
64
73
|
end
|
65
74
|
|
@@ -9,25 +9,17 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.email = ["matt@hiddenloop.com"]
|
10
10
|
spec.summary = %q{Example gem for lolcommits plugin development}
|
11
11
|
spec.homepage = "https://github.com/lolcommits/lolcommits-sample_plugin"
|
12
|
-
spec.license = "LGPL-3"
|
12
|
+
spec.license = "LGPL-3.0"
|
13
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
|
-
"homepage_uri"
|
17
|
-
"changelog_uri"
|
18
|
-
"source_code_uri"
|
19
|
-
"bug_tracker_uri"
|
16
|
+
"homepage_uri" => "https://github.com/lolcommits/lolcommits-sample_plugin",
|
17
|
+
"changelog_uri" => "https://github.com/lolcommits/lolcommits-sample_plugin/blob/master/CHANGELOG.md",
|
18
|
+
"source_code_uri" => "https://github.com/lolcommits/lolcommits-sample_plugin",
|
19
|
+
"bug_tracker_uri" => "https://github.com/lolcommits/lolcommits-sample_plugin/issues",
|
20
|
+
"allowed_push_host" => "https://rubygems.org"
|
20
21
|
}
|
21
22
|
|
22
|
-
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
23
|
-
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
24
|
-
if spec.respond_to?(:metadata)
|
25
|
-
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
26
|
-
else
|
27
|
-
raise "RubyGems 2.0 or newer is required to protect against " \
|
28
|
-
"public gem pushes."
|
29
|
-
end
|
30
|
-
|
31
23
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|features)/}) }
|
32
24
|
spec.test_files = `git ls-files -- {test,features}/*`.split("\n")
|
33
25
|
spec.bindir = "bin"
|
@@ -36,7 +28,8 @@ Gem::Specification.new do |spec|
|
|
36
28
|
|
37
29
|
spec.required_ruby_version = ">= 2.3"
|
38
30
|
|
39
|
-
spec.
|
31
|
+
spec.add_runtime_dependency "lolcommits", ">= 0.14.2"
|
32
|
+
|
40
33
|
spec.add_development_dependency "bundler"
|
41
34
|
spec.add_development_dependency "rake"
|
42
35
|
spec.add_development_dependency "minitest"
|
@@ -10,7 +10,9 @@ describe Lolcommits::Plugin::SamplePlugin do
|
|
10
10
|
describe 'with a runner' do
|
11
11
|
def runner
|
12
12
|
# a simple lolcommits runner with an empty configuration Hash
|
13
|
-
@runner ||= Lolcommits::Runner.new
|
13
|
+
@runner ||= Lolcommits::Runner.new(
|
14
|
+
lolcommit_path: "/path/to/lolcommit.jpg"
|
15
|
+
)
|
14
16
|
end
|
15
17
|
|
16
18
|
def plugin
|
@@ -62,7 +64,7 @@ describe Lolcommits::Plugin::SamplePlugin do
|
|
62
64
|
it 'outputs a message to stdout' do
|
63
65
|
in_repo do
|
64
66
|
Proc.new { plugin.run_capture_ready }.
|
65
|
-
must_output "
|
67
|
+
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"
|
66
68
|
end
|
67
69
|
end
|
68
70
|
|
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.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Hutchinson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-05-20 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.
|
20
|
-
type: :
|
19
|
+
version: 0.14.2
|
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.14.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,7 +123,7 @@ files:
|
|
123
123
|
- test/test_helper.rb
|
124
124
|
homepage: https://github.com/lolcommits/lolcommits-sample_plugin
|
125
125
|
licenses:
|
126
|
-
- LGPL-3
|
126
|
+
- LGPL-3.0
|
127
127
|
metadata:
|
128
128
|
homepage_uri: https://github.com/lolcommits/lolcommits-sample_plugin
|
129
129
|
changelog_uri: https://github.com/lolcommits/lolcommits-sample_plugin/blob/master/CHANGELOG.md
|