lolcommits 0.5.4 → 0.5.5
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 +8 -8
- data/.gitignore +1 -0
- data/.travis.yml +2 -0
- data/CHANGELOG +13 -2
- data/README.md +106 -36
- data/bin/lolcommits +2 -2
- data/features/lolcommits.feature +3 -3
- data/lib/lolcommits.rb +10 -9
- data/lib/lolcommits/{capture_cygwin.rb → capturer/capture_cygwin.rb} +0 -0
- data/lib/lolcommits/{capture_fake.rb → capturer/capture_fake.rb} +0 -0
- data/lib/lolcommits/{capture_linux.rb → capturer/capture_linux.rb} +18 -12
- data/lib/lolcommits/capturer/capture_linux_animated.rb +71 -0
- data/lib/lolcommits/{capture_mac.rb → capturer/capture_mac.rb} +5 -0
- data/lib/lolcommits/{capture_mac_animated.rb → capturer/capture_mac_animated.rb} +0 -0
- data/lib/lolcommits/{capture_windows.rb → capturer/capture_windows.rb} +0 -0
- data/lib/lolcommits/configuration.rb +25 -14
- data/lib/lolcommits/installation.rb +23 -13
- data/lib/lolcommits/plugin.rb +47 -11
- data/lib/lolcommits/plugins/dot_com.rb +10 -2
- data/lib/lolcommits/plugins/lol_twitter.rb +6 -2
- data/lib/lolcommits/plugins/lol_yammer.rb +6 -2
- data/lib/lolcommits/plugins/lolsrv.rb +19 -26
- data/lib/lolcommits/plugins/loltext.rb +6 -1
- data/lib/lolcommits/plugins/tranzlate.rb +5 -1
- data/lib/lolcommits/plugins/uploldz.rb +7 -1
- data/lib/lolcommits/runner.rb +55 -39
- data/lib/lolcommits/version.rb +1 -1
- data/lolcommits.gemspec +0 -1
- data/rubocop-todo.yml +2 -2
- metadata +10 -24
- data/NOTES +0 -17
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MWEyZjJjMzUxNGE1N2M3ZTI0ZTc5N2ExZmI1OWQwYTRjZGNiZjliZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NDlkNDQyNDk3NmQzOTRmNTRkMjQ4ZmQ1YmNmMDQ2MDRhMmUzNjkzZg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZmQ1ZTQ3ZDZlNDE1NDNjMzc0YjU4NTQzMDdhNzJjZGUzMDExMTBmNDVlNmM2
|
10
|
+
MTUwNzIzOTgzNjUyMDhmOTQ4Nzk4MGU1NzA4NWM5ZjdmMzc0ZTdmYTA1YjZh
|
11
|
+
ODExYTUxNDJjOTZjMDQ0MWZiNmU5OTNjZTA1ZDA5YmEwMTA1NzU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTk0NGNlY2Y4MTZiNDhiNTNhODRhOTRhODNmNjRmMDAyNjI4NmNjYTY1N2Ez
|
14
|
+
NTdjZTE3ZjJhZDQ1NTAwMThiYTY4MDJiMTQ2N2EyYjA2NWY3ZjVjNWFhZDgw
|
15
|
+
OWVlZjQ5ZjdjNDdlOGJkZTE0N2M4ODgyNjk3Nzc0YmM4NzkzOWY=
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG
CHANGED
@@ -1,5 +1,16 @@
|
|
1
|
-
0.
|
2
|
-
*
|
1
|
+
0.5.6 (in development)
|
2
|
+
* update gems!
|
3
|
+
* prepare plugins for extraction
|
4
|
+
|
5
|
+
0.5.5 (29 September 2014)
|
6
|
+
* Animated gif capture support (@theY4Kman #226)
|
7
|
+
* Fix plugin config issues with user input (@matthutchinson #225 #223)
|
8
|
+
* Fix Linux FPS timing issues (@matthutchinson #215)
|
9
|
+
* Fix hook enable/disable issue (@matthutchinson #206)
|
10
|
+
* Fix Git GUI issues (@matthutchinson #196 #168 #193 #188 #159 #133 #123 #119 #104 #83)
|
11
|
+
* Mention Boxen script in README (@matthutchinson #208)
|
12
|
+
* Explain global Git hooks how-to in README (@matthutchinson #212 #112)
|
13
|
+
* Minor improvments to Linux Capturer (@matthutchinson)
|
3
14
|
|
4
15
|
0.5.4 (13 April 2014)
|
5
16
|
* Excluded vendor/bundle from rubocop cops (@matthutchinson)
|
data/README.md
CHANGED
@@ -1,72 +1,114 @@
|
|
1
1
|
# lolcommits (git + webcam = lol)
|
2
2
|
|
3
|
-
lolcommits takes a snapshot with your webcam every time you git commit code, and
|
4
|
-
Git blame has never been so much fun.
|
3
|
+
lolcommits takes a snapshot with your webcam every time you git commit code, and
|
4
|
+
archives a lolcat style image with it. Git blame has never been so much fun.
|
5
5
|
|
6
|
-
By default, the
|
6
|
+
By default, the lol images are stored by a Github style short SHA in a
|
7
|
+
`~/.lolcommits` directory created for you.
|
7
8
|
|
8
|
-
[](https://rubygems.org/gems/lolcommits)
|
10
|
+
[](https://travis-ci.org/mroth/lolcommits)
|
11
|
+
[](https://gemnasium.com/mroth/lolcommits)
|
12
|
+
[](https://codeclimate.com/github/mroth/lolcommits)
|
13
|
+
[](https://coveralls.io/r/mroth/lolcommits)
|
12
14
|
|
13
15
|
## Sample images
|
16
|
+
|
14
17
|
<img src="http://blog.mroth.info/images/postcontent/yearinsideprojects/lolcommits_users2.jpg" />
|
15
18
|
|
16
|
-
Please add your own lolcommit! Add to the [People Using
|
19
|
+
Please add your own lolcommit! Add to the [People Using
|
20
|
+
Lolcommits](https://github.com/mroth/lolcommits/wiki/Lolcommits-from-around-the-world%21)
|
21
|
+
page on our wiki.
|
17
22
|
|
18
23
|
## Installation
|
24
|
+
|
19
25
|
### Mac OS X
|
20
|
-
|
26
|
+
|
27
|
+
You'll need ImageMagick installed. [Homebrew](http://mxcl.github.com/homebrew/)
|
28
|
+
makes this easy. Simply do:
|
21
29
|
|
22
30
|
brew install imagemagick
|
23
31
|
|
24
|
-
Then
|
32
|
+
Then install the gem with:
|
25
33
|
|
26
34
|
[sudo] gem install lolcommits
|
27
35
|
|
28
|
-
|
36
|
+
If you're using RVM (or rbenv), you can/should probably omit the sudo, but the
|
37
|
+
default MacOSX Ruby install is dumb and requires it.
|
38
|
+
|
39
|
+
If [Boxen](https://boxen.github.com) is your thing, [try
|
40
|
+
this](https://github.com/AssuredLabor/puppet-lolcommits).
|
29
41
|
|
30
42
|
### Linux
|
31
|
-
|
43
|
+
|
44
|
+
Install dependencies using your package manager of choice, for example in
|
45
|
+
Ubuntu:
|
32
46
|
|
33
47
|
sudo apt-get install mplayer imagemagick libmagickwand-dev
|
34
48
|
|
35
|
-
Then install the
|
49
|
+
Then install the gem with:
|
36
50
|
|
37
51
|
gem install lolcommits
|
38
52
|
|
39
|
-
For more details, see [Installing on
|
53
|
+
For more details, see [Installing on
|
54
|
+
Linux](https://github.com/mroth/lolcommits/wiki/Installing-on-Linux).
|
55
|
+
|
56
|
+
### Windows - here be dragons!
|
40
57
|
|
41
|
-
|
42
|
-
|
58
|
+
It all works but you'll need some more detailed instructions to get the
|
59
|
+
dependencies installed. See the wiki page for [Installing on
|
60
|
+
Windows](https://github.com/mroth/lolcommits/wiki/Installing-on-Windows).
|
43
61
|
|
44
62
|
## Usage
|
63
|
+
|
45
64
|
### Enabling and basic usage
|
46
|
-
From within any git repository, simply do a `lolcommits --enable`. From that point on, any git commit will automatically trigger a lolcommit capture! All lolcommits are stored in `~/.lolcommits` by default, placed in a subdirectory by project name, and with a filename matching the commit hash.
|
47
65
|
|
48
|
-
|
66
|
+
From within any git repository, simply do a `lolcommits --enable`. From that
|
67
|
+
point on, any git commit will automatically trigger a lolcommit capture! All
|
68
|
+
lolcommits are stored in `~/.lolcommits` by default, placed in a subdirectory by
|
69
|
+
project name, and with a filename matching the commit hash.
|
70
|
+
|
71
|
+
You can also enable lolcommits across all your local git repos. Follow [these
|
72
|
+
steps](https://github.com/mroth/lolcommits/wiki/Enabling-Lolcommits-for-all-your-Git-Repositories)
|
73
|
+
to achieve this using `git init` and the `init.templatedir` setting.
|
74
|
+
|
75
|
+
Don't worry about it too much, half the fun of lolcommits is forgetting it's
|
76
|
+
installed!
|
49
77
|
|
50
78
|
### Other commands
|
51
|
-
Ok, if you insist... Since you know about `--enable`, common sense suggests there is also a repository specific `--disable`, hopefully you can guess what that does. Other handy common commands include `--last`, which will open for display your most recent lolcommit image, or `--browse`, which pops open the directory containing all the lolcommit images for your current repository. You can always do `--help` for a full list of available commands.
|
52
79
|
|
53
|
-
|
80
|
+
Ok, if you insist... Since you know about `--enable`, common sense suggests
|
81
|
+
there is also a repository specific `--disable`, hopefully you can guess what
|
82
|
+
that does. Other handy common commands include `--last`, which will open for
|
83
|
+
display your most recent lolcommit image, or `--browse`, which pops open the
|
84
|
+
directory containing all the lolcommit images for your current repository. You
|
85
|
+
can always do `--help` for a full list of available commands.
|
86
|
+
|
87
|
+
**NOTE**: Any extra arguments you pass with the --enable command are
|
88
|
+
auto-appended to the git-commit capture command. For example;
|
54
89
|
|
55
90
|
lolcommits --enable --delay=5 --animate=4 --fork
|
56
91
|
|
57
|
-
Will configure capturing of an animated gif (4 secs) after a 5 sec delay in a
|
92
|
+
Will configure capturing of an animated gif (4 secs) after a 5 sec delay in a
|
93
|
+
forked process. See the section below for more capture configuration variables.
|
58
94
|
|
59
95
|
### Capture configuration variables
|
60
|
-
|
96
|
+
|
97
|
+
lolcommits has some capture options for additional lulz. You can enable these
|
98
|
+
via environment variables like so;
|
61
99
|
|
62
100
|
* `LOLCOMMITS_DEVICE` set a webcam device - **mac and linux only**
|
63
|
-
* `LOLCOMMITS_ANIMATE` (in seconds) set time for capturing an animated gif -
|
64
|
-
|
101
|
+
* `LOLCOMMITS_ANIMATE` (in seconds) set time for capturing an animated gif -
|
102
|
+
**requires ffmpeg**
|
103
|
+
* `LOLCOMMITS_DELAY` (in seconds) set delay persistently (for slow webcams to
|
104
|
+
warmup)
|
65
105
|
* `LOLCOMMITS_FONT` set font file location for lolcommit text
|
66
|
-
* `LOLCOMMITS_FORK` fork lolcommit runner (capture command forks to a new
|
106
|
+
* `LOLCOMMITS_FORK` fork lolcommit runner (capture command forks to a new
|
107
|
+
process, speedily returning you to your terminal)
|
67
108
|
* `LOLCOMMITS_STEALTH` disable notification messages at commit time
|
68
109
|
|
69
|
-
Or they can be set via the following arguments in the capture command (located
|
110
|
+
Or they can be set via the following arguments in the capture command (located
|
111
|
+
in your repository's `.git/hooks/post-commit` file).
|
70
112
|
|
71
113
|
* `--device=DEVICE` or `-d DEVICE`
|
72
114
|
* `--animate=SECONDS` or `-a SECONDS`
|
@@ -75,26 +117,54 @@ Or they can be set via the following arguments in the capture command (located i
|
|
75
117
|
* `--fork`
|
76
118
|
* `--stealth`
|
77
119
|
|
78
|
-
Use `lolcommits --devices` to list all attached video devices available for
|
120
|
+
Use `lolcommits --devices` to list all attached video devices available for
|
121
|
+
capturing. Read how to [configure commit
|
122
|
+
capturing](https://github.com/mroth/lolcommits/wiki/Configure-Commit-Capturing)
|
123
|
+
for more details.
|
79
124
|
|
80
125
|
### Animated Gif Capturing
|
81
|
-
Animated gifs (Mac/OSX only) can take a while to generate (depending on the number of seconds you capture and the capabilities of your machine). `ffmpeg` is required and can be installed with brew like so;
|
82
126
|
|
83
|
-
|
127
|
+
Animated gifs can take a while to generate (depending on the number of seconds
|
128
|
+
you capture and the capabilities of your machine).
|
129
|
+
[ffmpeg](https://www.ffmpeg.org) is required and can be installed like so;
|
130
|
+
|
131
|
+
* Linux - [follow this guide](https://www.ffmpeg.org/download.html#build-linux)
|
132
|
+
* OSX - `brew install ffmpeg`
|
84
133
|
|
85
|
-
To enable, just set the `LOLCOMMITS_ANIMATE` environment variable with the
|
86
|
-
|
87
|
-
|
134
|
+
To enable, just set the `LOLCOMMITS_ANIMATE` environment variable with the
|
135
|
+
number of seconds to capture. Like regular image captures you can use the env
|
136
|
+
variables `LOLCOMMITS_DEVICE` and `LOLCOMMITS_DELAY` to change the capture
|
137
|
+
device or delay time (seconds) before capturing.
|
88
138
|
|
89
|
-
|
139
|
+
If you find capturing an animated gif takes too long, try setting the
|
140
|
+
`LOLCOMMITS_FORK=true` env variable. Animated gif captures are currently NOT
|
141
|
+
supported on Windows.
|
142
|
+
|
143
|
+

|
90
146
|
|
91
147
|
### Plugins
|
92
|
-
|
148
|
+
|
149
|
+
There are a growing amount of plugins for lolcommits to enable things like
|
150
|
+
Twitter upload, translating your commit messages to lolspeak, etc. Check them
|
151
|
+
out on the [plugins
|
152
|
+
page](https://github.com/mroth/lolcommits/wiki/Configuring-Plugins).
|
93
153
|
|
94
154
|
## Troubles?
|
95
|
-
|
155
|
+
|
156
|
+
Try our trouble-shooting [FAQ](https://github.com/mroth/lolcommits/wiki/FAQ), or
|
157
|
+
take a read through our [wiki](https://github.com/mroth/lolcommits/wiki) for
|
158
|
+
more information. If you think something is broken or missing, raise a [GitHub
|
159
|
+
issue](https://github.com/mroth/lolcommits/issues) (and please take a little
|
160
|
+
time to check if we haven't [already
|
161
|
+
addressed](https://github.com/mroth/lolcommits/issues?q=is%3Aissue+is%3Aclosed)
|
162
|
+
it).
|
96
163
|
|
97
164
|
## Timelapse?
|
98
|
-
|
165
|
+
|
166
|
+
To watch your face as it decays while you program, you can create a quick mpeg
|
167
|
+
of all your lolcommits snapshots (if you have `imagemagick` and `ffmpeg`
|
168
|
+
installed):
|
99
169
|
|
100
170
|
convert `find . -type f -name "*.jpg" -print0 | xargs -0 ls -tlr | awk '{print $9}'` timelapse.mpeg
|
data/bin/lolcommits
CHANGED
@@ -170,10 +170,10 @@ def do_gif
|
|
170
170
|
|
171
171
|
case Choice.choices[:gif]
|
172
172
|
when 'today'
|
173
|
-
lolimages = configuration.
|
173
|
+
lolimages = configuration.jpg_images_today
|
174
174
|
filename = "#{Date.today.to_s}.gif"
|
175
175
|
else
|
176
|
-
lolimages = configuration.
|
176
|
+
lolimages = configuration.jpg_images
|
177
177
|
filename = 'archive.gif'
|
178
178
|
end
|
179
179
|
|
data/features/lolcommits.feature
CHANGED
@@ -12,8 +12,8 @@ Feature: Basic UI functionality
|
|
12
12
|
|--animate|which is optional|
|
13
13
|
|-a |which is optional|
|
14
14
|
|
15
|
-
Scenario: Help should not show the animate option on a
|
16
|
-
Given I am using a "
|
15
|
+
Scenario: Help should not show the animate option on a Windows plaftorm
|
16
|
+
Given I am using a "Windows" platform
|
17
17
|
When I get help for "lolcommits"
|
18
18
|
Then the output should not match /\-a\, \-\-animate\=SECONDS/
|
19
19
|
|
@@ -45,7 +45,7 @@ Feature: Basic UI functionality
|
|
45
45
|
And the "loltest" repository "post-commit" hook has content "#!/bin/ruby"
|
46
46
|
When I cd to "loltest"
|
47
47
|
And I run `lolcommits --enable`
|
48
|
-
Then the output should contain "doesn't start with
|
48
|
+
Then the output should contain "doesn't start with a good shebang"
|
49
49
|
And the file ".git/hooks/post-commit" should not contain "lolcommits --capture"
|
50
50
|
And the exit status should be 1
|
51
51
|
|
data/lib/lolcommits.rb
CHANGED
@@ -6,23 +6,24 @@ require 'mini_magick'
|
|
6
6
|
require 'fileutils'
|
7
7
|
require 'git'
|
8
8
|
require 'open3'
|
9
|
-
require 'active_support/inflector'
|
10
|
-
require 'active_support/concern'
|
11
|
-
require 'active_support/callbacks'
|
12
9
|
require 'methadone'
|
13
10
|
require 'date'
|
14
11
|
|
15
12
|
require 'lolcommits/version'
|
16
13
|
require 'lolcommits/configuration'
|
14
|
+
|
17
15
|
require 'lolcommits/capturer'
|
18
|
-
require 'lolcommits/capture_mac'
|
19
|
-
require 'lolcommits/capture_mac_animated'
|
20
|
-
require 'lolcommits/capture_linux'
|
21
|
-
require 'lolcommits/
|
22
|
-
require 'lolcommits/
|
23
|
-
require 'lolcommits/
|
16
|
+
require 'lolcommits/capturer/capture_mac'
|
17
|
+
require 'lolcommits/capturer/capture_mac_animated'
|
18
|
+
require 'lolcommits/capturer/capture_linux'
|
19
|
+
require 'lolcommits/capturer/capture_linux_animated'
|
20
|
+
require 'lolcommits/capturer/capture_windows'
|
21
|
+
require 'lolcommits/capturer/capture_cygwin'
|
22
|
+
require 'lolcommits/capturer/capture_fake'
|
23
|
+
|
24
24
|
require 'lolcommits/git_info'
|
25
25
|
require 'lolcommits/installation'
|
26
|
+
|
26
27
|
require 'lolcommits/plugin'
|
27
28
|
require 'lolcommits/plugins/loltext'
|
28
29
|
require 'lolcommits/plugins/dot_com'
|
File without changes
|
File without changes
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
module Lolcommits
|
3
3
|
class CaptureLinux < Capturer
|
4
|
+
MPLAYER_FPS = 25
|
5
|
+
|
4
6
|
def capture_device_string
|
5
7
|
@capture_device.nil? ? nil : "-tv device=\"#{@capture_device}\""
|
6
8
|
end
|
@@ -13,27 +15,31 @@ module Lolcommits
|
|
13
15
|
delay = if capture_delay != 0 then capture_delay else 1 end
|
14
16
|
|
15
17
|
# There's no way to give a capture delay in mplayer, but a number of frame
|
16
|
-
# mplayer's "delay" is actually a number of frames at
|
18
|
+
# mplayer's "delay" is actually a number of frames at 25 fps
|
17
19
|
# multiply the set value (in seconds) by 25
|
18
|
-
frames = delay.to_i *
|
20
|
+
frames = delay.to_i * MPLAYER_FPS
|
19
21
|
|
20
22
|
debug 'LinuxCapturer: calling out to mplayer to capture image'
|
21
23
|
# mplayer's output is ugly and useless, let's throw it away
|
22
|
-
_, r, _ = Open3.popen3("
|
24
|
+
_, r, _ = Open3.popen3("mplayer -vo jpeg:outdir=#{tmpdir} #{capture_device_string} -frames #{frames} -fps #{MPLAYER_FPS} tv://")
|
23
25
|
# looks like we still need to read the output for something to happen
|
24
26
|
r.read
|
25
27
|
|
26
|
-
# the below SHOULD tell FileUtils actions to post their output if we are in debug mode
|
27
|
-
include FileUtils::Verbose if logger.level == 0
|
28
|
-
|
29
28
|
debug 'LinuxCapturer: calling out to mplayer to capture image'
|
30
|
-
FileUtils.mv(tmpdir + '/%08d.jpg' % frames, snapshot_location)
|
31
|
-
debug 'LinuxCapturer: cleaning up'
|
32
|
-
FileUtils.rm_rf(tmpdir)
|
33
|
-
end
|
34
29
|
|
35
|
-
|
36
|
-
|
30
|
+
# get last frame from tmpdir (regardless of fps)
|
31
|
+
all_frames = Dir.glob("#{tmpdir}/*.jpg").sort_by do |f|
|
32
|
+
File.mtime(f)
|
33
|
+
end
|
34
|
+
|
35
|
+
if all_frames.empty?
|
36
|
+
debug 'LinuxCapturer: failed to capture any image'
|
37
|
+
else
|
38
|
+
FileUtils.mv(all_frames.last, snapshot_location)
|
39
|
+
debug 'LinuxCapturer: cleaning up'
|
40
|
+
end
|
41
|
+
|
42
|
+
FileUtils.rm_rf(tmpdir)
|
37
43
|
end
|
38
44
|
end
|
39
45
|
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
module Lolcommits
|
3
|
+
class CaptureLinuxAnimated < Capturer
|
4
|
+
def capture
|
5
|
+
# make a fresh frames directory
|
6
|
+
FileUtils.rm_rf(frames_location)
|
7
|
+
FileUtils.mkdir_p(frames_location)
|
8
|
+
|
9
|
+
# capture the raw video with ffmpeg video4linux2
|
10
|
+
system_call "ffmpeg -v quiet -y -f video4linux2 -video_size 320x240 -i #{capture_device_string} -t #{capture_duration} #{video_location} > /dev/null"
|
11
|
+
if File.exists?(video_location)
|
12
|
+
# convert raw video to png frames with ffmpeg
|
13
|
+
system_call "ffmpeg #{capture_delay_string} -v quiet -i #{video_location} -t #{animated_duration} #{frames_location}/%09d.png > /dev/null"
|
14
|
+
|
15
|
+
# use fps to set delay and number of frames to skip (for lower filesized gifs)
|
16
|
+
fps = video_fps(video_location)
|
17
|
+
skip = frame_skip(fps)
|
18
|
+
delay = frame_delay(fps, skip)
|
19
|
+
debug "Capturer: anaimated gif choosing every #{skip} frames with a frame delay of #{delay}"
|
20
|
+
|
21
|
+
# create the looping animated gif from frames (picks nth frame with seq)
|
22
|
+
seq_command = "seq -f #{frames_location}/%09g.png 1 #{skip} #{Dir["#{frames_location}/*"].length}"
|
23
|
+
# convert to animated gif with delay and gif optimisation
|
24
|
+
system_call "convert -layers OptimizeTransparency -delay #{delay} -loop 0 `#{seq_command}` -coalesce #{snapshot_location} > /dev/null"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def system_call(call_str, capture_output = false)
|
31
|
+
debug "Capturer: making system call for \n #{call_str}"
|
32
|
+
capture_output ? `#{call_str}` : system(call_str)
|
33
|
+
end
|
34
|
+
|
35
|
+
def frame_delay(fps, skip)
|
36
|
+
# calculate frame delay
|
37
|
+
delay = ((100.0 * skip) / fps.to_f).to_i
|
38
|
+
delay < 6 ? 6 : delay # hard limit for IE browsers
|
39
|
+
end
|
40
|
+
|
41
|
+
def video_fps(file)
|
42
|
+
# inspect fps of the captured video file (default to 29.97)
|
43
|
+
fps = system_call("ffmpeg -i #{file} 2>&1 | sed -n \"s/.*, \\(.*\\) fp.*/\\1/p\"", true)
|
44
|
+
fps.to_i < 1 ? 29.97 : fps.to_f
|
45
|
+
end
|
46
|
+
|
47
|
+
def frame_skip(fps)
|
48
|
+
# of frames to skip depends on movie fps
|
49
|
+
case (fps)
|
50
|
+
when 0..15
|
51
|
+
2
|
52
|
+
when 16..28
|
53
|
+
3
|
54
|
+
else
|
55
|
+
4
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def capture_device_string
|
60
|
+
capture_device || '/dev/video0'
|
61
|
+
end
|
62
|
+
|
63
|
+
def capture_delay_string
|
64
|
+
" -ss #{capture_delay}" if capture_delay.to_i > 0
|
65
|
+
end
|
66
|
+
|
67
|
+
def capture_duration
|
68
|
+
animated_duration.to_i + capture_delay.to_i
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -6,6 +6,11 @@ module Lolcommits
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def capture
|
9
|
+
# TODO: check we have a webcam we can capture from first. See issue #219
|
10
|
+
# operating laptop in clamshell (lid closed) from 2nd desktop screen,
|
11
|
+
# needs to better handle the capturer (imagesnap, videosnap
|
12
|
+
# CommandCam, mplayer) return code or check with an option before
|
13
|
+
# attempting capture. Alt solution is puttin in prompt mode option :(
|
9
14
|
call_str = "#{executable_path} -q \"#{snapshot_location}\" -w #{capture_delay} #{capture_device_string}"
|
10
15
|
debug "Capturer: making system call for #{call_str}"
|
11
16
|
system(call_str)
|
File without changes
|
File without changes
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
module Lolcommits
|
3
3
|
class Configuration
|
4
|
-
|
4
|
+
LOLCOMMITS_BASE = ENV['LOLCOMMITS_DIR'] || File.join(ENV['HOME'], '.lolcommits')
|
5
5
|
LOLCOMMITS_ROOT = File.join(File.dirname(__FILE__), '../..')
|
6
6
|
attr_writer :loldir
|
7
7
|
|
@@ -25,10 +25,8 @@ module Lolcommits
|
|
25
25
|
|
26
26
|
def loldir
|
27
27
|
return @loldir if @loldir
|
28
|
-
|
29
28
|
basename ||= File.basename(Git.open('.').dir.to_s).sub(/^\./, 'dot')
|
30
29
|
basename.sub!(/ /, '-')
|
31
|
-
|
32
30
|
@loldir = Configuration.loldir_for(basename)
|
33
31
|
end
|
34
32
|
|
@@ -41,15 +39,15 @@ module Lolcommits
|
|
41
39
|
end
|
42
40
|
|
43
41
|
def most_recent
|
44
|
-
Dir.glob(File.join self.loldir, '*.jpg').max_by { |f| File.mtime(f) }
|
42
|
+
Dir.glob(File.join self.loldir, '*.{jpg,gif}').max_by { |f| File.mtime(f) }
|
45
43
|
end
|
46
44
|
|
47
|
-
def
|
45
|
+
def jpg_images
|
48
46
|
Dir.glob(File.join self.loldir, '*.jpg').sort_by { |f| File.mtime(f) }
|
49
47
|
end
|
50
48
|
|
51
|
-
def
|
52
|
-
|
49
|
+
def jpg_images_today
|
50
|
+
jpg_images.select { |f| Date.parse(File.mtime(f).to_s) === Date.today }
|
53
51
|
end
|
54
52
|
|
55
53
|
def raw_image(image_file_type = 'jpg')
|
@@ -152,9 +150,19 @@ module Lolcommits
|
|
152
150
|
end
|
153
151
|
|
154
152
|
def self.loldir_for(basename)
|
155
|
-
loldir = File.join(
|
156
|
-
|
157
|
-
if
|
153
|
+
loldir = File.join(LOLCOMMITS_BASE, basename)
|
154
|
+
|
155
|
+
if File.directory? loldir
|
156
|
+
begin
|
157
|
+
# ensure 755 permissions for loldir
|
158
|
+
File.chmod(0755, loldir)
|
159
|
+
rescue Errno::EPERM
|
160
|
+
# abort if permissions cannot be met
|
161
|
+
puts "FATAL: directory '#{loldir}' should be present and writeable by user '#{ENV['USER']}'"
|
162
|
+
puts 'Try changing the directory permissions to 755'
|
163
|
+
exit 1
|
164
|
+
end
|
165
|
+
else
|
158
166
|
FileUtils.mkdir_p loldir
|
159
167
|
end
|
160
168
|
loldir
|
@@ -201,19 +209,22 @@ module Lolcommits
|
|
201
209
|
end
|
202
210
|
|
203
211
|
def self.can_animate?
|
204
|
-
|
212
|
+
['Mac', 'Linux'].include? platform
|
205
213
|
end
|
206
214
|
|
207
215
|
# Cross-platform way of finding an executable in the $PATH.
|
208
|
-
# idea taken from http://bit.ly/qDaTbY
|
216
|
+
# idea taken from http://bit.ly/qDaTbY, if only_path is true, only the path
|
217
|
+
# is returned (not the path and command)
|
209
218
|
#
|
210
219
|
# which('ruby') #=> /usr/bin/ruby
|
211
|
-
def self.command_which(cmd)
|
220
|
+
def self.command_which(cmd, only_path = false)
|
212
221
|
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
213
222
|
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
214
223
|
exts.each do |ext|
|
215
224
|
exe = "#{path}/#{cmd}#{ext}"
|
216
|
-
|
225
|
+
if File.executable? exe
|
226
|
+
return only_path ? path : exe
|
227
|
+
end
|
217
228
|
end
|
218
229
|
end
|
219
230
|
nil
|
@@ -21,19 +21,29 @@ module Lolcommits
|
|
21
21
|
Dir.mkdir(HOOK_DIR)
|
22
22
|
end
|
23
23
|
|
24
|
-
#
|
24
|
+
# should add a shebang (or not) adding will rewrite hook file
|
25
|
+
add_shebang = false
|
25
26
|
if hook_file_exists?
|
27
|
+
# clear away any existing lolcommits hook
|
26
28
|
remove_existing_hook! if lolcommits_hook_exists?
|
27
29
|
|
28
|
-
#
|
29
|
-
|
30
|
-
|
30
|
+
# if file is empty we should add a shebang (and rewrite hook)
|
31
|
+
if File.read(HOOK_PATH).strip.empty?
|
32
|
+
add_shebang = true
|
33
|
+
elsif !good_shebang?
|
34
|
+
# look for good shebang in existing hook, abort if none found
|
35
|
+
warn "the existing hook (at #{HOOK_PATH}) doesn't start with a good shebang; like #!/bin/sh"
|
31
36
|
exit 1
|
32
37
|
end
|
38
|
+
else
|
39
|
+
add_shebang = true
|
33
40
|
end
|
34
41
|
|
35
|
-
File.open(HOOK_PATH,
|
36
|
-
|
42
|
+
File.open(HOOK_PATH, add_shebang ? 'w' : 'a') do |f|
|
43
|
+
if add_shebang
|
44
|
+
f.write("#!/bin/sh\n")
|
45
|
+
end
|
46
|
+
f.write(hook_script)
|
37
47
|
end
|
38
48
|
|
39
49
|
FileUtils.chmod 0755, HOOK_PATH
|
@@ -65,17 +75,17 @@ module Lolcommits
|
|
65
75
|
protected
|
66
76
|
|
67
77
|
def self.hook_script(add_shebang = true)
|
68
|
-
|
69
|
-
|
70
|
-
hook_export = "export PATH=\"#{ruby_path}:$PATH\"\n"
|
78
|
+
ruby_path = Lolcommits::Configuration.command_which('ruby', true)
|
79
|
+
imagick_path = Lolcommits::Configuration.command_which('identify', true)
|
80
|
+
hook_export = "export PATH=\"#{ruby_path}:#{imagick_path}:$PATH\"\n"
|
71
81
|
capture_cmd = 'lolcommits --capture'
|
72
82
|
capture_args = " #{ARGV[1..-1].join(' ')}" if ARGV.length > 1
|
73
83
|
|
74
84
|
<<-EOS
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
85
|
+
### lolcommits hook (begin) ###
|
86
|
+
#{hook_export}#{capture_cmd}#{capture_args}
|
87
|
+
### lolcommits hook (end) ###
|
88
|
+
EOS
|
79
89
|
end
|
80
90
|
|
81
91
|
# does a git hook exist at all?
|
data/lib/lolcommits/plugin.rb
CHANGED
@@ -11,16 +11,29 @@ module Lolcommits
|
|
11
11
|
self.options = ['enabled']
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
14
|
+
def execute_precapture
|
15
15
|
if enabled?
|
16
|
-
debug 'I am enabled, about to run'
|
17
|
-
|
16
|
+
debug 'I am enabled, about to run precapture'
|
17
|
+
run_precapture
|
18
18
|
else
|
19
|
-
debug 'Disabled, doing nothing for execution'
|
19
|
+
debug 'Disabled, doing nothing for precapture execution'
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
23
|
+
def execute_postcapture
|
24
|
+
if enabled?
|
25
|
+
debug 'I am enabled, about to run postcapture'
|
26
|
+
run_postcapture
|
27
|
+
else
|
28
|
+
debug 'Disabled, doing nothing for postcapture execution'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def run_precapture
|
33
|
+
debug 'base plugin, does nothing to anything'
|
34
|
+
end
|
35
|
+
|
36
|
+
def run_postcapture
|
24
37
|
debug 'base plugin, does nothing to anything'
|
25
38
|
end
|
26
39
|
|
@@ -35,13 +48,24 @@ module Lolcommits
|
|
35
48
|
puts "Configuring plugin: #{self.class.name}\n"
|
36
49
|
options.reduce(Hash.new) do |acc, option|
|
37
50
|
print "#{option}: "
|
38
|
-
val = STDIN.gets.strip
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
51
|
+
val = parse_user_input(STDIN.gets.strip)
|
52
|
+
# check enabled option isn't a String
|
53
|
+
if (option == 'enabled') && val.is_a?(String)
|
54
|
+
puts "Aborting - please enable with 'true' or 'false'"
|
55
|
+
exit 1
|
56
|
+
else
|
57
|
+
acc.merge(option => val)
|
43
58
|
end
|
44
|
-
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def parse_user_input(str)
|
63
|
+
if 'true'.casecmp(str) == 0
|
64
|
+
true
|
65
|
+
elsif 'false'.casecmp(str) == 0
|
66
|
+
false
|
67
|
+
else
|
68
|
+
str
|
45
69
|
end
|
46
70
|
end
|
47
71
|
|
@@ -71,6 +95,12 @@ module Lolcommits
|
|
71
95
|
super(args)
|
72
96
|
end
|
73
97
|
|
98
|
+
# helper to log errors with a message via debug
|
99
|
+
def log_error(e, message)
|
100
|
+
debug message
|
101
|
+
debug e.backtrace.join("\n")
|
102
|
+
end
|
103
|
+
|
74
104
|
# uniform debug logging for plugins
|
75
105
|
def debug(msg)
|
76
106
|
super("Plugin: #{self.class.to_s}: " + msg)
|
@@ -80,5 +110,11 @@ module Lolcommits
|
|
80
110
|
def self.name
|
81
111
|
'plugin'
|
82
112
|
end
|
113
|
+
|
114
|
+
# a plugin requests to be run by the runner in one of the possible positions.
|
115
|
+
# valid options are [:precapture, :postcapture]
|
116
|
+
def self.runner_order
|
117
|
+
nil
|
118
|
+
end
|
83
119
|
end
|
84
120
|
end
|
@@ -3,16 +3,18 @@ require 'httmultiparty'
|
|
3
3
|
|
4
4
|
module Lolcommits
|
5
5
|
class DotCom < Plugin
|
6
|
+
BASE_URL = 'http://lolcommits-dot-com.herokuapp.com'
|
7
|
+
|
6
8
|
def initialize(runner)
|
7
9
|
super
|
8
10
|
self.options.concat(['api_key', 'api_secret', 'repo_id'])
|
9
11
|
end
|
10
12
|
|
11
|
-
def
|
13
|
+
def run_postcapture
|
12
14
|
return unless valid_configuration?
|
13
15
|
|
14
16
|
t = Time.now.to_i.to_s
|
15
|
-
resp = HTTMultiParty.post(
|
17
|
+
resp = HTTMultiParty.post("#{BASE_URL}/git_commits.json",
|
16
18
|
:body => {
|
17
19
|
:git_commit => {
|
18
20
|
:sha => self.runner.sha,
|
@@ -26,6 +28,8 @@ module Lolcommits
|
|
26
28
|
:token => Digest::SHA1.hexdigest(configuration['api_secret'] + t)
|
27
29
|
}
|
28
30
|
)
|
31
|
+
rescue => e
|
32
|
+
log_error(e, "ERROR: HTTMultiParty POST FAILED #{e.class} - #{e.message}")
|
29
33
|
end
|
30
34
|
|
31
35
|
def configured?
|
@@ -38,5 +42,9 @@ module Lolcommits
|
|
38
42
|
def self.name
|
39
43
|
'dot_com'
|
40
44
|
end
|
45
|
+
|
46
|
+
def self.runner_order
|
47
|
+
:postcapture
|
48
|
+
end
|
41
49
|
end
|
42
50
|
end
|
@@ -14,7 +14,7 @@ module Lolcommits
|
|
14
14
|
TWITTER_RETRIES = 2
|
15
15
|
TWITTER_PIN_REGEX = /^\d{4,}$/ # 4 or more digits
|
16
16
|
|
17
|
-
def
|
17
|
+
def run_postcapture
|
18
18
|
return unless valid_configuration?
|
19
19
|
|
20
20
|
attempts = 0
|
@@ -47,7 +47,7 @@ module Lolcommits
|
|
47
47
|
def configure_options!
|
48
48
|
options = super
|
49
49
|
# ask user to configure tokens if enabling
|
50
|
-
if
|
50
|
+
if enabled?
|
51
51
|
auth_config = configure_auth!
|
52
52
|
if auth_config
|
53
53
|
options.merge!(auth_config)
|
@@ -121,5 +121,9 @@ module Lolcommits
|
|
121
121
|
def self.name
|
122
122
|
'twitter'
|
123
123
|
end
|
124
|
+
|
125
|
+
def self.runner_order
|
126
|
+
:postcapture
|
127
|
+
end
|
124
128
|
end
|
125
129
|
end
|
@@ -14,6 +14,10 @@ module Lolcommits
|
|
14
14
|
'yammer'
|
15
15
|
end
|
16
16
|
|
17
|
+
def self.runner_order
|
18
|
+
:postcapture
|
19
|
+
end
|
20
|
+
|
17
21
|
def configured?
|
18
22
|
!configuration['access_token'].nil?
|
19
23
|
end
|
@@ -40,7 +44,7 @@ module Lolcommits
|
|
40
44
|
|
41
45
|
def configure_options!
|
42
46
|
options = super
|
43
|
-
if
|
47
|
+
if enabled?
|
44
48
|
auth_config = configure_access_token
|
45
49
|
if auth_config
|
46
50
|
options.merge!(auth_config)
|
@@ -51,7 +55,7 @@ module Lolcommits
|
|
51
55
|
options
|
52
56
|
end
|
53
57
|
|
54
|
-
def
|
58
|
+
def run_postcapture
|
55
59
|
return unless valid_configuration?
|
56
60
|
|
57
61
|
commit_msg = self.runner.message
|
@@ -10,7 +10,7 @@ module Lolcommits
|
|
10
10
|
self.options << 'server'
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
13
|
+
def run_postcapture
|
14
14
|
return unless valid_configuration?
|
15
15
|
fork { sync }
|
16
16
|
end
|
@@ -32,38 +32,31 @@ module Lolcommits
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def existing_lols
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
return nil
|
42
|
-
end
|
35
|
+
lols = JSON.parse(
|
36
|
+
RestClient.get(configuration['server'] + '/lols'))
|
37
|
+
lols.map { |lol| lol['sha'] }
|
38
|
+
rescue => e
|
39
|
+
log_error(e, "ERROR: existing lols could not be retrieved #{e.class} - #{e.message}")
|
40
|
+
return nil
|
43
41
|
end
|
44
42
|
|
45
43
|
def upload(file, sha)
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
rescue => e
|
55
|
-
log_error(e, "ERROR: Upload of lol #{sha} FAILED #{e.class} - #{e.message}")
|
56
|
-
return
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def log_error(e, message)
|
61
|
-
debug message
|
62
|
-
debug e.backtrace
|
44
|
+
RestClient.post(configuration['server'] + '/uplol',
|
45
|
+
:lol => File.new(file),
|
46
|
+
:url => self.runner.url + sha,
|
47
|
+
:repo => self.runner.repo,
|
48
|
+
:date => File.ctime(file),
|
49
|
+
:sha => sha)
|
50
|
+
rescue => e
|
51
|
+
log_error(e, "ERROR: Upload of lol #{sha} FAILED #{e.class} - #{e.message}")
|
63
52
|
end
|
64
53
|
|
65
54
|
def self.name
|
66
55
|
'lolsrv'
|
67
56
|
end
|
57
|
+
|
58
|
+
def self.runner_order
|
59
|
+
:postcapture
|
60
|
+
end
|
68
61
|
end
|
69
62
|
end
|
@@ -11,7 +11,7 @@ module Lolcommits
|
|
11
11
|
!configured? || super
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
14
|
+
def run_postcapture
|
15
15
|
font_location = @font_location || File.join(Configuration::LOLCOMMITS_ROOT,
|
16
16
|
'vendor',
|
17
17
|
'fonts',
|
@@ -54,6 +54,7 @@ module Lolcommits
|
|
54
54
|
def clean_msg(text)
|
55
55
|
wrapped_text = word_wrap text
|
56
56
|
escape_quotes wrapped_text
|
57
|
+
escape_ats wrapped_text
|
57
58
|
end
|
58
59
|
|
59
60
|
# conversion for quotation marks to avoid shell interpretation
|
@@ -62,6 +63,10 @@ module Lolcommits
|
|
62
63
|
text.gsub(/"/, "''")
|
63
64
|
end
|
64
65
|
|
66
|
+
def escape_ats(text)
|
67
|
+
text.gsub(/@/, '\@')
|
68
|
+
end
|
69
|
+
|
65
70
|
# convenience method for word wrapping
|
66
71
|
# based on https://github.com/cmdrkeene/memegen/blob/master/lib/meme_generator.rb
|
67
72
|
def word_wrap(text, col = 27)
|
@@ -99,7 +99,7 @@ module Lolcommits
|
|
99
99
|
class Tranzlate < Plugin
|
100
100
|
extend Lolspeak
|
101
101
|
|
102
|
-
def
|
102
|
+
def run_precapture
|
103
103
|
debug "Commit message before: #{self.runner.message}"
|
104
104
|
self.runner.message = self.class.tranzlate(self.runner.message)
|
105
105
|
debug "Commit message after: #{self.runner.message}"
|
@@ -108,5 +108,9 @@ module Lolcommits
|
|
108
108
|
def self.name
|
109
109
|
'tranzlate'
|
110
110
|
end
|
111
|
+
|
112
|
+
def self.runner_order
|
113
|
+
:precapture
|
114
|
+
end
|
111
115
|
end
|
112
116
|
end
|
@@ -10,7 +10,7 @@ module Lolcommits
|
|
10
10
|
self.options.concat(['endpoint', 'optional_key'])
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
13
|
+
def run_postcapture
|
14
14
|
return unless valid_configuration?
|
15
15
|
|
16
16
|
repo = self.runner.repo.to_s
|
@@ -23,6 +23,8 @@ module Lolcommits
|
|
23
23
|
:repo => repo,
|
24
24
|
:key => configuration['optional_key'])
|
25
25
|
end
|
26
|
+
rescue => e
|
27
|
+
log_error(e, "ERROR: RestClient POST FAILED #{e.class} - #{e.message}")
|
26
28
|
end
|
27
29
|
|
28
30
|
def configured?
|
@@ -32,5 +34,9 @@ module Lolcommits
|
|
32
34
|
def self.name
|
33
35
|
'uploldz'
|
34
36
|
end
|
37
|
+
|
38
|
+
def self.runner_order
|
39
|
+
:postcapture
|
40
|
+
end
|
35
41
|
end
|
36
42
|
end
|
data/lib/lolcommits/runner.rb
CHANGED
@@ -8,19 +8,6 @@ module Lolcommits
|
|
8
8
|
:font, :capture_animate, :url
|
9
9
|
|
10
10
|
include Methadone::CLILogging
|
11
|
-
include ActiveSupport::Callbacks
|
12
|
-
define_callbacks :run
|
13
|
-
set_callback :run, :before, :execute_lolcommits_tranzlate
|
14
|
-
|
15
|
-
# Executed Last
|
16
|
-
set_callback :run, :after, :cleanup!
|
17
|
-
set_callback :run, :after, :execute_lolcommits_uploldz
|
18
|
-
set_callback :run, :after, :execute_lolcommits_lolsrv
|
19
|
-
set_callback :run, :after, :execute_lolcommits_lol_twitter
|
20
|
-
set_callback :run, :after, :execute_lolcommits_dot_com
|
21
|
-
set_callback :run, :after, :execute_lolcommits_lol_yammer
|
22
|
-
set_callback :run, :after, :execute_lolcommits_loltext
|
23
|
-
# Executed First
|
24
11
|
|
25
12
|
def initialize(attributes = {})
|
26
13
|
attributes.each do |attr, val|
|
@@ -37,25 +24,61 @@ module Lolcommits
|
|
37
24
|
end
|
38
25
|
end
|
39
26
|
|
27
|
+
# wrap run to handle things that should happen before and after
|
28
|
+
# this used to be handled with ActiveSupport::Callbacks, but
|
29
|
+
# now we're just using a simple procedural list
|
40
30
|
def run
|
41
|
-
|
31
|
+
# do things that need to happen before capture and plugins
|
42
32
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
capturer = capturer_class.new(
|
48
|
-
:capture_device => self.capture_device,
|
49
|
-
:capture_delay => self.capture_delay,
|
50
|
-
:snapshot_location => self.snapshot_loc,
|
51
|
-
:font => self.font,
|
52
|
-
:video_location => self.config.video_loc,
|
53
|
-
:frames_location => self.config.frames_loc,
|
54
|
-
:animated_duration => self.capture_animate
|
55
|
-
)
|
56
|
-
capturer.capture
|
57
|
-
resize_snapshot!
|
33
|
+
# do native plugins that need to happen before capture
|
34
|
+
plugins_for(:precapture).each do |plugin|
|
35
|
+
debug "precapture: about to execute #{plugin}"
|
36
|
+
plugin.new(self).execute_precapture
|
58
37
|
end
|
38
|
+
|
39
|
+
# do gem plugins that need to happen before capture?
|
40
|
+
|
41
|
+
# **** do the main capture ****
|
42
|
+
run_capture_and_resize
|
43
|
+
|
44
|
+
# do native plugins that need to happen immediately after capture
|
45
|
+
# this is effectively the "image processing" phase
|
46
|
+
# for now, reserve just for us and handle manually...?
|
47
|
+
Lolcommits::Loltext.new(self).execute_postcapture
|
48
|
+
|
49
|
+
# do native plugins that need to happen after capture
|
50
|
+
plugins_for(:postcapture).each do |plugin|
|
51
|
+
plugin.new(self).execute_postcapture
|
52
|
+
end
|
53
|
+
|
54
|
+
# do gem plugins that need to happen after capture?
|
55
|
+
|
56
|
+
# do things that should happen last
|
57
|
+
cleanup!
|
58
|
+
end
|
59
|
+
|
60
|
+
def plugins_for(position)
|
61
|
+
Lolcommits::PLUGINS.select { |p| p.runner_order == position }
|
62
|
+
end
|
63
|
+
|
64
|
+
# the main capture and resize operation, critical
|
65
|
+
def run_capture_and_resize
|
66
|
+
die_if_rebasing!
|
67
|
+
|
68
|
+
puts '*** Preserving this moment in history.' unless capture_stealth
|
69
|
+
self.snapshot_loc = self.config.raw_image(image_file_type)
|
70
|
+
self.main_image = self.config.main_image(self.sha, image_file_type)
|
71
|
+
capturer = capturer_class.new(
|
72
|
+
:capture_device => self.capture_device,
|
73
|
+
:capture_delay => self.capture_delay,
|
74
|
+
:snapshot_location => self.snapshot_loc,
|
75
|
+
:font => self.font,
|
76
|
+
:video_location => self.config.video_loc,
|
77
|
+
:frames_location => self.config.frames_loc,
|
78
|
+
:animated_duration => self.capture_animate
|
79
|
+
)
|
80
|
+
capturer.capture
|
81
|
+
resize_snapshot!
|
59
82
|
end
|
60
83
|
|
61
84
|
def animate?
|
@@ -65,7 +88,9 @@ module Lolcommits
|
|
65
88
|
private
|
66
89
|
|
67
90
|
def capturer_class
|
68
|
-
|
91
|
+
capturer_module = 'Lolcommits'
|
92
|
+
capturer_class = "Capture#{Configuration.platform}#{animate? ? 'Animated' : nil}"
|
93
|
+
Object.const_get(capturer_module).const_get(capturer_class)
|
69
94
|
end
|
70
95
|
|
71
96
|
def image_file_type
|
@@ -110,13 +135,4 @@ module Lolcommits
|
|
110
135
|
FileUtils.rm_f(self.config.video_loc)
|
111
136
|
FileUtils.rm_rf(self.config.frames_loc)
|
112
137
|
end
|
113
|
-
|
114
|
-
# register a method called "execute_lolcommits_#{plugin_name}"
|
115
|
-
# for each subclass of plugin. these methods should be used as
|
116
|
-
# callbacks to the run method.
|
117
|
-
Lolcommits::PLUGINS.each do |plugin|
|
118
|
-
define_method "execute_#{plugin.to_s.underscore.gsub('/', '_')}" do
|
119
|
-
plugin.new(self).execute
|
120
|
-
end
|
121
|
-
end
|
122
138
|
end
|
data/lib/lolcommits/version.rb
CHANGED
data/lolcommits.gemspec
CHANGED
@@ -25,7 +25,6 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.add_runtime_dependency('launchy', '~> 2.2.0')
|
26
26
|
s.add_runtime_dependency('methadone', '~> 1.2.4')
|
27
27
|
s.add_runtime_dependency('open4', '~> 1.3.0')
|
28
|
-
s.add_runtime_dependency('activesupport', '~> 3.2.12')
|
29
28
|
|
30
29
|
# development dependencies
|
31
30
|
s.add_development_dependency('rdoc')
|
data/rubocop-todo.yml
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lolcommits
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Rothenberg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mini_magick
|
@@ -94,20 +94,6 @@ dependencies:
|
|
94
94
|
- - ~>
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 1.3.0
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: activesupport
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ~>
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: 3.2.12
|
104
|
-
type: :runtime
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ~>
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: 3.2.12
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
98
|
name: rdoc
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -365,7 +351,6 @@ files:
|
|
365
351
|
- CONTRIBUTING
|
366
352
|
- Gemfile
|
367
353
|
- LICENSE
|
368
|
-
- NOTES
|
369
354
|
- README.md
|
370
355
|
- Rakefile
|
371
356
|
- bin/lolcommits
|
@@ -378,13 +363,14 @@ files:
|
|
378
363
|
- features/support/path_helpers.rb
|
379
364
|
- lib/core_ext/class.rb
|
380
365
|
- lib/lolcommits.rb
|
381
|
-
- lib/lolcommits/capture_cygwin.rb
|
382
|
-
- lib/lolcommits/capture_fake.rb
|
383
|
-
- lib/lolcommits/capture_linux.rb
|
384
|
-
- lib/lolcommits/capture_mac.rb
|
385
|
-
- lib/lolcommits/capture_mac_animated.rb
|
386
|
-
- lib/lolcommits/capture_windows.rb
|
387
366
|
- lib/lolcommits/capturer.rb
|
367
|
+
- lib/lolcommits/capturer/capture_cygwin.rb
|
368
|
+
- lib/lolcommits/capturer/capture_fake.rb
|
369
|
+
- lib/lolcommits/capturer/capture_linux.rb
|
370
|
+
- lib/lolcommits/capturer/capture_linux_animated.rb
|
371
|
+
- lib/lolcommits/capturer/capture_mac.rb
|
372
|
+
- lib/lolcommits/capturer/capture_mac_animated.rb
|
373
|
+
- lib/lolcommits/capturer/capture_windows.rb
|
388
374
|
- lib/lolcommits/configuration.rb
|
389
375
|
- lib/lolcommits/git_info.rb
|
390
376
|
- lib/lolcommits/installation.rb
|
@@ -429,7 +415,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
429
415
|
version: '0'
|
430
416
|
requirements: []
|
431
417
|
rubyforge_project: lolcommits
|
432
|
-
rubygems_version: 2.
|
418
|
+
rubygems_version: 2.4.1
|
433
419
|
signing_key:
|
434
420
|
specification_version: 4
|
435
421
|
summary: Capture webcam image on git commit for lulz.
|
data/NOTES
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
|
2
|
-
AFTER:
|
3
|
-
* update version (.pre)
|
4
|
-
* update README
|
5
|
-
* open3 and unit assertions in cuke tests, can remove with aruba ?
|
6
|
-
* better plugin list output, showing enabled status etc
|
7
|
-
* GET RID OF LOLCOMMITS_DIR in TEST ENV and FAKE $HOME instead
|
8
|
-
* clean up bin/lolcommits or refactor or whatever it's a mess
|
9
|
-
|
10
|
-
MUCH LATER:
|
11
|
-
* auto version detection? (to encourage people to update)
|
12
|
-
* push stats to statsd or something so i know how many people are using it!
|
13
|
-
* pimp twitter
|
14
|
-
- in readme
|
15
|
-
- in post_install_message from gemspec
|
16
|
-
* a real website
|
17
|
-
|