lolcommits 0.13.1 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +3 -3
- data/CHANGELOG.md +18 -7
- data/Gemfile +2 -0
- data/README.md +101 -76
- data/Rakefile +3 -1
- data/bin/console +1 -0
- data/bin/lolcommits +37 -32
- data/config/cucumber.yml +1 -1
- data/features/bugs.feature +2 -2
- data/features/lolcommits.feature +42 -17
- data/features/step_definitions/lolcommits_steps.rb +7 -3
- data/lib/lolcommits/animated_gif.rb +77 -0
- data/lib/lolcommits/backends/git_info.rb +15 -11
- data/lib/lolcommits/backends/installation_git.rb +4 -3
- data/lib/lolcommits/backends/installation_mercurial.rb +1 -1
- data/lib/lolcommits/backends/mercurial_info.rb +13 -9
- data/lib/lolcommits/capturer.rb +14 -6
- data/lib/lolcommits/capturer/capture_cygwin.rb +3 -14
- data/lib/lolcommits/capturer/capture_fake.rb +8 -2
- data/lib/lolcommits/capturer/capture_linux.rb +11 -10
- data/lib/lolcommits/capturer/capture_linux_video.rb +15 -0
- data/lib/lolcommits/capturer/capture_mac.rb +6 -11
- data/lib/lolcommits/capturer/capture_mac_video.rb +23 -0
- data/lib/lolcommits/capturer/capture_windows.rb +14 -9
- data/lib/lolcommits/capturer/capture_windows_video.rb +46 -0
- data/lib/lolcommits/cli/fatals.rb +1 -1
- data/lib/lolcommits/cli/launcher.rb +1 -1
- data/lib/lolcommits/cli/timelapse_gif.rb +28 -12
- data/lib/lolcommits/configuration.rb +4 -26
- data/lib/lolcommits/platform.rb +4 -4
- data/lib/lolcommits/plugin/base.rb +2 -2
- data/lib/lolcommits/plugin/configuration_helper.rb +1 -1
- data/lib/lolcommits/runner.rb +138 -69
- data/lib/lolcommits/version.rb +2 -2
- data/lolcommits.gemspec +4 -2
- data/test/assets/test_image.jpg +0 -0
- data/test/assets/test_video.mp4 +0 -0
- metadata +12 -9
- data/lib/lolcommits/capturer/capture_linux_animated.rb +0 -74
- data/lib/lolcommits/capturer/capture_mac_animated.rb +0 -75
- data/lib/lolcommits/capturer/capture_windows_animated.rb +0 -110
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4225dde2c474dff419dbeb58619e1d9358af4862997e51726e6a9c0f0841bfc8
|
4
|
+
data.tar.gz: 9d09ffafba3cf5d9c50004c7106f272cbc54816c9b9e46be37bc94b548da20da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0c21b9d900549127a694a640d088e4a7c6c24bd84b1a791481b13234cd54efc5f96f45fcde31a3360b95573f2c654866e2dc071f1005c107283e1b8069d30a3
|
7
|
+
data.tar.gz: c4fb82801d5ed3b145fd55b007f065a7b4d8d53ff5c231aa4b45dbe3d7b7c18a03e4775357bbcd4a27f3d2ee76e5fd3753a5e4260d88b5b675f9e668a75436c3
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -39,11 +39,11 @@ Metrics/BlockLength:
|
|
39
39
|
# Offense count: 2
|
40
40
|
# Configuration parameters: CountComments.
|
41
41
|
Metrics/ClassLength:
|
42
|
-
Max:
|
42
|
+
Max: 150
|
43
43
|
|
44
44
|
# Offense count: 5
|
45
45
|
Metrics/CyclomaticComplexity:
|
46
|
-
Max:
|
46
|
+
Max: 10
|
47
47
|
|
48
48
|
# Offense count: 23
|
49
49
|
# Configuration parameters: CountComments.
|
@@ -94,4 +94,4 @@ Style/SymbolArray:
|
|
94
94
|
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
95
95
|
# URISchemes: http, https
|
96
96
|
Metrics/LineLength:
|
97
|
-
Max:
|
97
|
+
Max: 168
|
data/CHANGELOG.md
CHANGED
@@ -1,17 +1,25 @@
|
|
1
|
-
###
|
1
|
+
### ChangeLog
|
2
2
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
4
|
-
project adheres to [Semantic Versioning][Semver].
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
This project adheres to [Semantic Versioning][Semver].
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
8
|
* Your contribution here!
|
9
9
|
|
10
|
+
## [0.14.0][] (14 May 2019)
|
11
|
+
* `main_image` now deprecated, use `lolcommit_path` instead (@matthutchinson)
|
12
|
+
* make actual videos to make gifs from (@ruxton [#386][])
|
13
|
+
* improved tabs/spacing on git commit hook text (@matthutchinson)
|
14
|
+
* add video captures `-v {seconds}` and runner overlays (@matthutchinson [#392][])
|
15
|
+
* `Capturer` classes refactored and renamed (@matthutchinson)
|
16
|
+
* `AnimatedGif` class takes care of gif generating (@matthutchinson)
|
17
|
+
|
10
18
|
## [0.13.1][] (29 April 2019)
|
11
19
|
* Update all links and badges (in gemspec, README etc.) to lolcommits
|
12
|
-
organisation
|
13
|
-
* remove gem `post_install` message
|
14
|
-
* use `lolcommits-loltext ~> 0.1.0'
|
20
|
+
organisation (@matthutchinson)
|
21
|
+
* remove gem `post_install` message (@matthutchinson)
|
22
|
+
* use `lolcommits-loltext ~> 0.1.0' (@matthutchinson)
|
15
23
|
|
16
24
|
## [0.13.0][] (23 April 2019)
|
17
25
|
* Require at least Ruby 2.3
|
@@ -342,7 +350,8 @@ project adheres to [Semantic Versioning][Semver].
|
|
342
350
|
reliable to not glitch.)
|
343
351
|
|
344
352
|
[Semver]: http://semver.org
|
345
|
-
[Unreleased]: https://github.com/lolcommits/lolcommits/compare/v0.
|
353
|
+
[Unreleased]: https://github.com/lolcommits/lolcommits/compare/v0.14.0...HEAD
|
354
|
+
[0.14.0]: https://github.com/lolcommits/lolcommits/compare/v0.13.1...v0.14.0
|
346
355
|
[0.13.1]: https://github.com/lolcommits/lolcommits/compare/v0.13.0...v0.13.1
|
347
356
|
[0.13.0]: https://github.com/lolcommits/lolcommits/compare/v0.12.1...v0.13.0
|
348
357
|
[0.12.1]: https://github.com/lolcommits/lolcommits/compare/v0.12.0...v0.12.1
|
@@ -537,3 +546,5 @@ project adheres to [Semantic Versioning][Semver].
|
|
537
546
|
[#377]: https://github.com/lolcommits/lolcommits/pull/377
|
538
547
|
[#384]: https://github.com/lolcommits/lolcommits/pull/384
|
539
548
|
[#385]: https://github.com/lolcommits/lolcommits/pull/385
|
549
|
+
[#386]: https://github.com/lolcommits/lolcommits/pull/386
|
550
|
+
[#392]: https://github.com/lolcommits/lolcommits/pull/392
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -8,15 +8,17 @@
|
|
8
8
|
|
9
9
|
> git-based selfies for software developers
|
10
10
|
|
11
|
-
lolcommits takes a snapshot with your webcam every time you git commit
|
12
|
-
archives a lolcat style image with it. Git blame has never
|
11
|
+
lolcommits takes a snapshot with your webcam every time you git commit
|
12
|
+
code, and archives a lolcat style image with it. Git blame has never
|
13
|
+
been so much fun.
|
13
14
|
|
14
15
|
By default, the lol images are stored by a Github style short SHA in a
|
15
16
|
`~/.lolcommits` directory created for you.
|
16
17
|
|
17
18
|
## History
|
18
19
|
|
19
|
-
Originally created by [@mroth] in 2011 as a joke project for [Hack &&
|
20
|
+
Originally created by [@mroth] in 2011 as a joke project for [Hack &&
|
21
|
+
Tell], lolcommits has grown considerably since then, and is now
|
20
22
|
primarily maintained by [@matthutchinson].
|
21
23
|
|
22
24
|
Thank you to all of the [contributors] throughout the years!
|
@@ -48,8 +50,8 @@ page on our wiki!
|
|
48
50
|
|
49
51
|
### macOS
|
50
52
|
|
51
|
-
You'll need ImageMagick installed.
|
52
|
-
makes this easy.
|
53
|
+
You'll need ImageMagick installed.
|
54
|
+
[Homebrew](http://mxcl.github.com/homebrew/) makes this easy.
|
53
55
|
|
54
56
|
brew install imagemagick
|
55
57
|
|
@@ -57,11 +59,11 @@ Then install with:
|
|
57
59
|
|
58
60
|
[sudo] gem install lolcommits
|
59
61
|
|
60
|
-
If you're using RVM (or rbenv), you can/should probably omit the sudo,
|
61
|
-
default macOS Ruby install usually requires it.
|
62
|
+
If you're using RVM (or rbenv), you can/should probably omit the sudo,
|
63
|
+
but the default macOS Ruby install usually requires it.
|
62
64
|
|
63
|
-
Lolcommits v0.8.1 was the last release to support Ruby < 2.0. If you'd
|
64
|
-
use older Rubies try:
|
65
|
+
Lolcommits v0.8.1 was the last release to support Ruby < 2.0. If you'd
|
66
|
+
like to use older Rubies try:
|
65
67
|
|
66
68
|
[sudo] gem install lolcommits --version 0.8.1 # for Ruby 1.9
|
67
69
|
[sudo] gem install lolcommits --version 0.7.0 # for Ruby 1.8
|
@@ -69,13 +71,13 @@ use older Rubies try:
|
|
69
71
|
|
70
72
|
### Linux
|
71
73
|
|
72
|
-
Install these dependencies using your package manager of choice, for
|
73
|
-
Ubuntu:
|
74
|
+
Install these dependencies using your package manager of choice, for
|
75
|
+
example in Ubuntu:
|
74
76
|
|
75
77
|
sudo apt-get install mplayer imagemagick libmagickwand-dev
|
76
78
|
|
77
|
-
For Ubuntu 14.04 or newer, you need to manually install ffmpeg since it
|
78
|
-
longer ships with the default Ubuntu sources ([downloads
|
79
|
+
For Ubuntu 14.04 or newer, you need to manually install ffmpeg since it
|
80
|
+
no longer ships with the default Ubuntu sources ([downloads
|
79
81
|
here](http://ffmpeg.org/download.html)).
|
80
82
|
|
81
83
|
Then install with:
|
@@ -98,108 +100,131 @@ Windows](https://github.com/lolcommits/lolcommits/wiki/Installing-on-Windows).
|
|
98
100
|
|
99
101
|
### Enabling and basic usage
|
100
102
|
|
101
|
-
Within any git repository, simply run `lolcommits --enable`. From that
|
102
|
-
any git commit will automatically trigger a lolcommit capture!
|
103
|
-
lolcommits are stored in `~/.lolcommits` and placed in a
|
104
|
-
name, with a filename matching the commit hash.
|
103
|
+
Within any git repository, simply run `lolcommits --enable`. From that
|
104
|
+
point on, any git commit will automatically trigger a lolcommit capture!
|
105
|
+
By default, all lolcommits are stored in `~/.lolcommits` and placed in a
|
106
|
+
subdirectory by project name, with a filename matching the commit hash.
|
105
107
|
|
106
108
|
Follow [these
|
107
109
|
steps](https://github.com/lolcommits/lolcommits/wiki/Enabling-Lolcommits-for-all-your-Git-Repositories)
|
108
110
|
to enable lolcommits across all your repos; using `git init` and the
|
109
111
|
`init.templatedir` setting.
|
110
112
|
|
111
|
-
Don't worry about it too much, half the fun of lolcommits is forgetting
|
112
|
-
installed!
|
113
|
+
Don't worry about it too much, half the fun of lolcommits is forgetting
|
114
|
+
it's installed!
|
113
115
|
|
114
116
|
|
115
117
|
### Other commands
|
116
118
|
|
117
|
-
OK, if you insist... Since you know about `--enable`, common sense
|
118
|
-
there is also a repository specific `--disable`, hopefully you
|
119
|
-
that does.
|
119
|
+
OK, if you insist... Since you know about `--enable`, common sense
|
120
|
+
suggests there is also a repository specific `--disable`, hopefully you
|
121
|
+
can guess what that does.
|
120
122
|
|
121
|
-
Other handy common commands include `--last`, which will open for
|
122
|
-
most recent lolcommit, or `--browse`, which pops open the
|
123
|
-
all the lolcommit images for your current
|
124
|
-
for a full list of available
|
123
|
+
Other handy common commands include `--last`, which will open for
|
124
|
+
display your most recent lolcommit, or `--browse`, which pops open the
|
125
|
+
directory containing all the lolcommit images for your current
|
126
|
+
repository. You can always do `--help` for a full list of available
|
127
|
+
commands.
|
125
128
|
|
126
|
-
**NOTE**: Any extra arguments you pass with `--enable` are appended to
|
127
|
-
git post-hook capture command. For example;
|
129
|
+
**NOTE**: Any extra arguments you pass with `--enable` are appended to
|
130
|
+
the git post-hook capture command. For example;
|
128
131
|
|
129
132
|
lolcommits --enable --delay 5 --animate 4 --fork
|
130
133
|
|
131
|
-
Will configure capturing of an animated gif (4 secs) after a 5 sec delay
|
132
|
-
forked process. See the section below for more capture
|
134
|
+
Will configure capturing of an animated gif (4 secs) after a 5 sec delay
|
135
|
+
in a forked process. See the section below for more capture
|
136
|
+
configuration options.
|
133
137
|
|
134
138
|
|
135
139
|
### Capture configuration options
|
136
140
|
|
137
|
-
lolcommits has some capture options for additional lulz. You can enable
|
138
|
-
via environment variables like so;
|
141
|
+
lolcommits has some capture options for additional lulz. You can enable
|
142
|
+
these via environment variables like so;
|
139
143
|
|
140
|
-
* `LOLCOMMITS_DEVICE` set a webcam device - **except windows
|
141
|
-
|
144
|
+
* `LOLCOMMITS_DEVICE` set a webcam device - **except windows
|
145
|
+
(non-animated) captures**
|
146
|
+
* `LOLCOMMITS_VIDEO` (in seconds) set time for capturing a video -
|
142
147
|
**requires ffmpeg**
|
143
|
-
* `
|
144
|
-
|
145
|
-
* `
|
146
|
-
|
148
|
+
* `LOLCOMMITS_ANIMATE` (in seconds) set time for capturing an animated
|
149
|
+
gif - **requires ffmpeg**
|
150
|
+
* `LOLCOMMITS_DELAY` (in seconds) set delay time before capturing (for
|
151
|
+
slow webcams to warmup)
|
152
|
+
* `LOLCOMMITS_FORK` fork lolcommit runner (capture command forks to a
|
153
|
+
new process, speedily returning you to your terminal)
|
147
154
|
* `LOLCOMMITS_STEALTH` disable all notification messages when capturing
|
148
|
-
* `LOLCOMMITS_DIR` set the output directory used for all repositories
|
149
|
-
to ~/.lolcommits)
|
150
|
-
* `LOLCOMMITS_CAPTURE_DISABLED` disables lolcommit capturing in the
|
151
|
-
(when set as 'true')
|
155
|
+
* `LOLCOMMITS_DIR` set the output directory used for all repositories
|
156
|
+
(defaults to ~/.lolcommits)
|
157
|
+
* `LOLCOMMITS_CAPTURE_DISABLED` disables lolcommit capturing in the
|
158
|
+
commit hook (when set as 'true')
|
152
159
|
|
153
|
-
|
154
|
-
|
155
|
-
repository's `.git/hooks/post-commit` file).
|
160
|
+
Or they can be set with arguments to the capture command (located in
|
161
|
+
your repository's `.git/hooks/post-commit` file).
|
156
162
|
|
157
163
|
* `--device {name}` or `-d {name}`
|
164
|
+
* `--video {seconds}` or `-v {seconds}`
|
158
165
|
* `--animate {seconds}` or `-a {seconds}`
|
159
166
|
* `--delay {seconds}` or `-w {seconds}`
|
160
167
|
* `--fork`
|
161
168
|
* `--stealth`
|
162
169
|
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
You can configure lolcommit text positions, font styles (type, size, color etc.)
|
167
|
-
or add a transparent overlay to your images. Simply configure the default
|
168
|
-
loltext plugin with this command:
|
170
|
+
You can configure lolcommit text positions, font styles (type, size,
|
171
|
+
color etc.) or add a transparent overlay to your images. Simply
|
172
|
+
configure the default loltext plugin with this command:
|
169
173
|
|
170
174
|
lolcommits --config -p loltext
|
171
175
|
|
172
176
|
To find out more about styling, read about the [loltext
|
173
177
|
options](https://github.com/lolcommits/lolcommits/wiki/Configure-Commit-Capturing#loltext-options).
|
174
178
|
|
179
|
+
Use `lolcommits --devices` to list all attached video devices available
|
180
|
+
for capturing.
|
181
|
+
|
182
|
+
Finally, run `lolcommits --help` for details on all the available
|
183
|
+
arguments.
|
175
184
|
|
176
|
-
### Animated Gif Capturing
|
177
185
|
|
178
|
-
|
179
|
-
you capture and the capabilities of your machine).
|
180
|
-
[ffmpeg](https://www.ffmpeg.org) is required and can be installed like so;
|
186
|
+
### Videos
|
181
187
|
|
182
|
-
|
188
|
+
You can tell lolcommits to capture an mp4 video (instead of an image).
|
189
|
+
[ffmpeg](https://www.ffmpeg.org) is required and can be installed like
|
190
|
+
so;
|
191
|
+
|
192
|
+
* Linux - [follow this
|
193
|
+
guide](https://www.ffmpeg.org/download.html#build-linux)
|
183
194
|
* macOS - `brew install ffmpeg`
|
184
|
-
* Windows - [follow this
|
195
|
+
* Windows - [follow this
|
196
|
+
guide](https://ffmpeg.org/download.html#build-windows)
|
197
|
+
|
198
|
+
To enable, use the `-v {seconds}` option or set the `LOLCOMMITS_VIDEO`
|
199
|
+
environment variable with the number of seconds to capture.
|
185
200
|
|
186
|
-
|
187
|
-
|
188
|
-
|
201
|
+
|
202
|
+
### Animated Gifs
|
203
|
+
|
204
|
+
Animated gifs can take a while to generate (depending on the number of
|
205
|
+
seconds you capture and the capabilities of your machine).
|
206
|
+
|
207
|
+
To enable, use the `-a {seconds}` option or set the `LOLCOMMITS_ANIMATE`
|
208
|
+
environment variable with the number of seconds to capture. If you find
|
209
|
+
animated capturing takes too long, try setting `LOLCOMMITS_FORK=true`.
|
189
210
|
|
190
211
|
![Example animated lolcommit
|
191
|
-
gif](http://cdn2.usa.bugleblogs.com/blogs/000/000/003/de0eb9aa695.gif
|
192
|
-
animated lolcommit gif")
|
212
|
+
gif](http://cdn2.usa.bugleblogs.com/blogs/000/000/003/de0eb9aa695.gif
|
213
|
+
"Example animated lolcommit gif")
|
214
|
+
|
215
|
+
**NOTE**: If both `LOLCOMMITS_ANIMATE` and `LOLCOMMITS_VIDEO` options are set, the
|
216
|
+
video duration takes precedence and is applied to both captures.
|
193
217
|
|
194
218
|
|
195
219
|
### Plugins
|
196
220
|
|
197
|
-
A growing number of plugins are available, allowing you to transform or
|
198
|
-
your lolcommits with others. The default plugin simply appends
|
199
|
-
message and sha to the captured image. Others can post to
|
200
|
-
other services), or even translate your commit
|
201
|
-
|
202
|
-
|
221
|
+
A growing number of plugins are available, allowing you to transform or
|
222
|
+
share your lolcommits with others. The default plugin simply appends
|
223
|
+
your commit message and sha to the captured image. Others can post to
|
224
|
+
Twitter, Tumblr (and other services), or even translate your commit
|
225
|
+
messages to
|
226
|
+
[lolspeak](http://www.urbandictionary.com/define.php?term=lolspeak).
|
227
|
+
Check them out on our [plugins
|
203
228
|
page](https://github.com/lolcommits/lolcommits/wiki/Configuring-Plugins).
|
204
229
|
|
205
230
|
To list all installed plugins use:
|
@@ -214,8 +239,8 @@ Installed plugins can be easily enabled, configured or disabled with the
|
|
214
239
|
lolcommits --config -p loltext
|
215
240
|
|
216
241
|
Interested in developing your own plugin? Follow [this simple
|
217
|
-
guide](https://github.com/lolcommits/lolcommits-sample_plugin#developing-your-own-plugin)
|
218
|
-
Lolcommits Sample Plugin README.
|
242
|
+
guide](https://github.com/lolcommits/lolcommits-sample_plugin#developing-your-own-plugin)
|
243
|
+
at the Lolcommits Sample Plugin README.
|
219
244
|
|
220
245
|
|
221
246
|
## Timelapse
|
@@ -228,11 +253,12 @@ Watch your face decay while you program, with an animated timelapse gif!
|
|
228
253
|
|
229
254
|
## Troubles?
|
230
255
|
|
231
|
-
Try our trouble-shooting
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
256
|
+
Try our trouble-shooting
|
257
|
+
[FAQ](https://github.com/lolcommits/lolcommits/wiki/FAQ), or take a read
|
258
|
+
through our [wiki](https://github.com/lolcommits/lolcommits/wiki). If
|
259
|
+
you think something is broken or missing, please raise a [Github
|
260
|
+
issue](https://github.com/lolcommits/lolcommits/issues) (and please
|
261
|
+
check if we haven't [already
|
236
262
|
addressed](https://github.com/lolcommits/lolcommits/issues?q=is%3Aissue+is%3Aclosed)
|
237
263
|
it).
|
238
264
|
|
@@ -241,4 +267,3 @@ it).
|
|
241
267
|
|
242
268
|
The program is available as open source under the terms of
|
243
269
|
[LGPL-3](https://opensource.org/licenses/LGPL-3.0).
|
244
|
-
|
data/Rakefile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'bundler'
|
2
4
|
require 'rake/clean'
|
3
5
|
|
@@ -32,7 +34,7 @@ Rake::TestTask.new do |t|
|
|
32
34
|
end
|
33
35
|
|
34
36
|
Rake::FileUtilsExt.verbose(false)
|
35
|
-
CUKE_RESULTS = 'results.html'
|
37
|
+
CUKE_RESULTS = 'results.html'
|
36
38
|
CLEAN << CUKE_RESULTS
|
37
39
|
Cucumber::Rake::Task.new(:features) do |t|
|
38
40
|
optstr = "features --format html -o #{CUKE_RESULTS} --format progress -x"
|
data/bin/console
CHANGED
data/bin/lolcommits
CHANGED
@@ -21,11 +21,11 @@ class App
|
|
21
21
|
include Lolcommits::CLI
|
22
22
|
|
23
23
|
description 'git-based selfies for software developers (https://lolcommits.github.io)'
|
24
|
-
version
|
24
|
+
version Lolcommits::VERSION
|
25
25
|
|
26
26
|
main do
|
27
27
|
# check for fatal conditions before execution
|
28
|
-
Fatals.die_if_no_valid_ffmpeg_installed! if
|
28
|
+
Fatals.die_if_no_valid_ffmpeg_installed! if capture_duration.positive?
|
29
29
|
Fatals.die_on_fatal_platform_conditions!
|
30
30
|
|
31
31
|
if options.empty?
|
@@ -39,7 +39,9 @@ class App
|
|
39
39
|
plugin_manager = PluginManager.init
|
40
40
|
config = Configuration.new(plugin_manager, test_mode: options[:test])
|
41
41
|
|
42
|
-
if options[:
|
42
|
+
if options[:version]
|
43
|
+
puts Lolcommits::VERSION
|
44
|
+
elsif options[:'show-config']
|
43
45
|
puts config
|
44
46
|
elsif options[:plugins]
|
45
47
|
config.list_plugins
|
@@ -59,14 +61,14 @@ class App
|
|
59
61
|
end
|
60
62
|
|
61
63
|
if options[:last]
|
62
|
-
|
64
|
+
show_last_lolcommit(config.loldir)
|
63
65
|
elsif options[:browse]
|
64
66
|
Launcher.open_folder(config.loldir)
|
65
67
|
elsif options[:timelapse]
|
66
|
-
TimelapseGif.new(config).run(options[:period])
|
68
|
+
TimelapseGif.new(config.loldir).run(options[:period])
|
67
69
|
elsif options[:config]
|
68
70
|
config.do_configure!(options[:plugin])
|
69
|
-
elsif options[:capture]
|
71
|
+
elsif options[:capture] || options[:video] || options[:animate]
|
70
72
|
capture_lolcommit(config)
|
71
73
|
end
|
72
74
|
end
|
@@ -87,17 +89,19 @@ class App
|
|
87
89
|
on('-l', '--last', 'view the most recent lolcommit')
|
88
90
|
on('-b', '--browse', 'browse this repo\'s lolcommits')
|
89
91
|
|
90
|
-
on('--timelapse', 'generate animated timelapse gif from captured images')
|
92
|
+
on('-t', '--timelapse', 'generate animated timelapse gif from captured images')
|
91
93
|
on('--period {today}', 'period to use for the timelapse gif (today or all)')
|
92
94
|
|
93
95
|
# optional capturing options
|
94
96
|
on('--device {name}', 'device name to capture from (mac/linux only)')
|
95
|
-
on('-a', '--animate {seconds}', '
|
97
|
+
on('-a', '--animate {seconds}', 'animated gif capture with duration')
|
98
|
+
on('-v', '--video {seconds}', 'video capture with duration')
|
96
99
|
on('-w', '--delay {seconds}', 'delay before taking a snapshot')
|
97
|
-
on('--stealth', 'capture image in stealth mode (no output)')
|
98
|
-
on('--fork', 'fork capturing process to the background')
|
99
100
|
on('-s', '--sha {string}', 'pass commit sha manually (--test mode only)')
|
100
101
|
on('-m', '--msg {string}', 'pass commit message manually (--test mode only)')
|
102
|
+
on('--stealth', 'capture image in stealth mode (no output)')
|
103
|
+
on('--fork', 'fork capturing process to the background')
|
104
|
+
on('--version', 'show current version info')
|
101
105
|
|
102
106
|
#
|
103
107
|
# No options specified, help the user out
|
@@ -117,37 +121,36 @@ class App
|
|
117
121
|
'Specify a device with --device "{device name}" or set the LOLCOMMITS_DEVICE env variable'
|
118
122
|
end
|
119
123
|
|
120
|
-
def self.
|
121
|
-
lolimage = Dir.glob(File.join(loldir, '*.{jpg,gif}')).max_by { |f| File.mtime(f) }
|
124
|
+
def self.show_last_lolcommit(loldir)
|
125
|
+
lolimage = Dir.glob(File.join(loldir, '*.{jpg,mp4,gif}')).max_by { |f| File.mtime(f) }
|
122
126
|
|
123
127
|
if lolimage.nil?
|
124
128
|
warn 'No lolcommits have been captured for this repository yet.'
|
125
129
|
exit 1
|
126
130
|
end
|
127
|
-
Launcher.
|
128
|
-
end
|
129
|
-
|
130
|
-
def self.capture_device
|
131
|
-
result = options[:device] || ENV['LOLCOMMITS_DEVICE'] || nil
|
132
|
-
result ||= Dir.glob('/dev/video*').first if Platform.platform_linux?
|
133
|
-
result
|
131
|
+
Launcher.open_file(lolimage)
|
134
132
|
end
|
135
133
|
|
136
134
|
def self.capture_lolcommit(config)
|
137
|
-
|
135
|
+
should_fork = options[:fork] || ENV['LOLCOMMITS_FORK'] || false
|
138
136
|
capture_stealth = options[:stealth] || ENV['LOLCOMMITS_STEALTH'] || false
|
137
|
+
capture_device = options[:device] || ENV['LOLCOMMITS_DEVICE'] || nil
|
139
138
|
capture_delay = (options[:delay] || ENV['LOLCOMMITS_DELAY']).to_i
|
139
|
+
capture_gif = !(options[:animate] || ENV['LOLCOMMITS_ANIMATE']).nil?
|
140
|
+
capture_video = !(options[:video] || ENV['LOLCOMMITS_VIDEO']).nil?
|
140
141
|
|
141
142
|
capture_options = {
|
142
143
|
capture_delay: capture_delay,
|
143
144
|
capture_stealth: capture_stealth,
|
144
145
|
capture_device: capture_device,
|
145
|
-
|
146
|
+
capture_duration: capture_duration,
|
147
|
+
capture_gif: capture_gif,
|
148
|
+
capture_video: capture_video,
|
146
149
|
config: config
|
147
150
|
}
|
148
151
|
|
149
152
|
process_runner = ProcessRunner.new(config)
|
150
|
-
process_runner.fork_me?(
|
153
|
+
process_runner.fork_me?(should_fork) do
|
151
154
|
if options[:test]
|
152
155
|
info '*** Capturing in test mode.'
|
153
156
|
capture_options.merge!(test_capture_options)
|
@@ -157,7 +160,7 @@ class App
|
|
157
160
|
runner.run
|
158
161
|
|
159
162
|
# automatically open the image in test mode
|
160
|
-
Launcher.
|
163
|
+
Launcher.open_file(runner.lolcommit_path) if options[:test]
|
161
164
|
end
|
162
165
|
end
|
163
166
|
|
@@ -170,17 +173,19 @@ class App
|
|
170
173
|
|
171
174
|
# Duration for animated capturing
|
172
175
|
#
|
173
|
-
# If animation is enabled, returns an integer > 0
|
174
|
-
# Seconds will be 0 if no option set, meaning
|
175
|
-
# place.
|
176
|
+
# If video/animation is enabled, this returns an integer > 0 (seconds)
|
177
|
+
# Seconds will be 0 if no option set, meaning a regular image capture
|
178
|
+
# will take place. Video duration takes precedence if both options are
|
179
|
+
# set.
|
176
180
|
#
|
177
181
|
# @return [Integer]
|
178
|
-
def self.
|
179
|
-
(
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
182
|
+
def self.capture_duration
|
183
|
+
(
|
184
|
+
options[:video] ||
|
185
|
+
ENV['LOLCOMMITS_VIDEO'] ||
|
186
|
+
options[:animate] ||
|
187
|
+
ENV['LOLCOMMITS_ANIMATE']
|
188
|
+
).to_i
|
184
189
|
end
|
185
190
|
|
186
191
|
#
|