lolcommits 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -1
- data/README.md +10 -3
- data/bin/lolcommits +3 -3
- data/ext/CommandCam.exe +0 -0
- data/lib/lolcommits.rb +28 -11
- data/lib/lolcommits/version.rb +1 -1
- data/lolcommits.gemspec +1 -1
- data/test/test_lolcommits.rb +5 -7
- metadata +42 -15
data/CHANGELOG
CHANGED
data/README.md
CHANGED
@@ -6,7 +6,7 @@ Takes a snapshot with your Mac's built-in iSight/FaceTime webcam (or any working
|
|
6
6
|
|
7
7
|
By default, the lolimages are stored by a Github style short SHA in a `~/.lolcommits` directory created for you.
|
8
8
|
|
9
|
-
## Installation (
|
9
|
+
## Installation (Mac OS X)
|
10
10
|
You'll need imagesnap and imagemagick installed. [Homebrew](http://mxcl.github.com/homebrew/) makes this easy. Simply do:
|
11
11
|
|
12
12
|
brew install imagemagick
|
@@ -24,7 +24,7 @@ You're all set! To enable lolcommits for a git repo, go to the base directory o
|
|
24
24
|
|
25
25
|
Likewise, you can disable it via `lolcommits --disable`. For a full list of options, you can do `lolcommits --help`.
|
26
26
|
|
27
|
-
## Installation (
|
27
|
+
## Installation (Linux)
|
28
28
|
Install dependencies using your package manager of choice, for example in Ubuntu:
|
29
29
|
|
30
30
|
sudo apt-get install mplayer imagemagick libmagick9-dev
|
@@ -35,8 +35,10 @@ Then install the lolcommits gem:
|
|
35
35
|
|
36
36
|
Then you can `lolcommits --enable` in any git repo as above.
|
37
37
|
|
38
|
+
## Installation (Windows)
|
39
|
+
See the wiki page for [Installing on Windows](https://github.com/mroth/lolcommits/wiki/Installing-on-Windows).
|
40
|
+
|
38
41
|
## Sample images
|
39
|
-
Please add your own lolcommit to these samples! Just fork this repo, add it to this section of the README, and send me a pull request.
|
40
42
|
<img width='320' height='240' src="https://github.com/mroth/lolcommits/raw/gh-pages/sample2.jpg" />
|
41
43
|
|
42
44
|
<img width='320' height='240' src="https://github.com/mroth/lolcommits/raw/gh-pages/sample5.jpg" />
|
@@ -54,6 +56,11 @@ Please add your own lolcommit to these samples! Just fork this repo, add it to
|
|
54
56
|
<a href="http://github.com/codegoblin/"><img width='320' height='240' src="http://cl.ly/2R0u040D2E2k0Y03240B/19bda811539.jpg" /></a>
|
55
57
|
<br/>
|
56
58
|
<img width='320' height='240' src="https://p.twimg.com/AqE73M1CMAAerqL.jpg" />
|
59
|
+
|
60
|
+
<img width='320' height='240' src="https://p.twimg.com/Aq9T0X9CAAAZ8gW.jpg" />
|
61
|
+
|
62
|
+
Please add your own lolcommit! Add to the [People Using Lolcommits](https://github.com/mroth/lolcommits/wiki/People-Using-Lolcommits) page on the Wiki.
|
63
|
+
|
57
64
|
|
58
65
|
<!--
|
59
66
|
## Upgrading from an old (non-gem) version?
|
data/bin/lolcommits
CHANGED
@@ -41,13 +41,13 @@ def do_noargs
|
|
41
41
|
puts "Try: lolcommits --enable (when in a git repository)"
|
42
42
|
end
|
43
43
|
|
44
|
-
HOOK_PATH = ".git
|
44
|
+
HOOK_PATH = File.join ".git", "hooks", "post-commit"
|
45
45
|
|
46
46
|
#
|
47
47
|
# IF --ENABLE, DO ENABLE
|
48
48
|
#
|
49
49
|
def do_enable
|
50
|
-
if not File.directory? ".git
|
50
|
+
if not File.directory?(File.join ".git", "hooks")
|
51
51
|
puts "You don't appear to be in the base directory of a git project."
|
52
52
|
exit 1
|
53
53
|
end
|
@@ -160,7 +160,7 @@ Choice.options do
|
|
160
160
|
long "--delay=SECONDS"
|
161
161
|
desc "delay taking of the snapshot by n seconds"
|
162
162
|
cast Integer
|
163
|
-
short '-
|
163
|
+
short '-w'
|
164
164
|
end
|
165
165
|
end
|
166
166
|
|
data/ext/CommandCam.exe
ADDED
Binary file
|
data/lib/lolcommits.rb
CHANGED
@@ -8,21 +8,27 @@ require "launchy"
|
|
8
8
|
include Magick
|
9
9
|
|
10
10
|
module Lolcommits
|
11
|
-
# Your code goes here...
|
12
11
|
$home = ENV['HOME']
|
13
|
-
LOLBASEDIR =
|
12
|
+
LOLBASEDIR = File.join $home, ".lolcommits"
|
13
|
+
LOLCOMMITS_ROOT = File.join(File.dirname(__FILE__), '..')
|
14
14
|
|
15
15
|
def is_mac?
|
16
16
|
RUBY_PLATFORM.downcase.include?("darwin")
|
17
17
|
end
|
18
18
|
|
19
19
|
def is_linux?
|
20
|
-
|
20
|
+
RUBY_PLATFORM.downcase.include?("linux")
|
21
|
+
end
|
22
|
+
|
23
|
+
def is_windows?
|
24
|
+
if RUBY_PLATFORM =~ /(win|w)32$/
|
25
|
+
true
|
26
|
+
end
|
21
27
|
end
|
22
28
|
|
23
29
|
def most_recent(dir='.')
|
24
30
|
loldir, commit_sha, commit_msg = parse_git
|
25
|
-
Dir.glob(
|
31
|
+
Dir.glob(File.join loldir, "*").max_by {|f| File.mtime(f)}
|
26
32
|
end
|
27
33
|
|
28
34
|
def loldir(dir='.')
|
@@ -37,7 +43,7 @@ module Lolcommits
|
|
37
43
|
commit_sha = commit.sha[0..10]
|
38
44
|
basename = File.basename(g.dir.to_s)
|
39
45
|
basename.sub!(/^\./, 'dot') #no invisible directories in output, thanks!
|
40
|
-
loldir =
|
46
|
+
loldir = File.join LOLBASEDIR, basename
|
41
47
|
return loldir, commit_sha, commit_msg
|
42
48
|
end
|
43
49
|
|
@@ -50,7 +56,7 @@ module Lolcommits
|
|
50
56
|
else
|
51
57
|
commit_msg = test_msg
|
52
58
|
commit_sha = test_sha
|
53
|
-
loldir = "
|
59
|
+
loldir = File.join LOLBASEDIR, "test"
|
54
60
|
end
|
55
61
|
|
56
62
|
#
|
@@ -67,7 +73,7 @@ module Lolcommits
|
|
67
73
|
# if this changes on future mac isights.
|
68
74
|
#
|
69
75
|
puts "*** Preserving this moment in history."
|
70
|
-
snapshot_loc = "
|
76
|
+
snapshot_loc = File.join loldir, "tmp_snapshot.jpg"
|
71
77
|
if is_mac?
|
72
78
|
system("imagesnap -q #{snapshot_loc} -w #{capture_delay}")
|
73
79
|
elsif is_linux?
|
@@ -83,6 +89,17 @@ module Lolcommits
|
|
83
89
|
r.read
|
84
90
|
FileUtils.mv(tmpdir + "/%08d.jpg" % frames, snapshot_loc)
|
85
91
|
FileUtils.rm_rf( tmpdir )
|
92
|
+
elsif is_windows?
|
93
|
+
commandcam_exe = File.join LOLCOMMITS_ROOT, "ext", "CommandCam.exe"
|
94
|
+
# DirectShow takes a while to show... at least for me anyway
|
95
|
+
delaycmd = " /delay 3000"
|
96
|
+
if capture_delay > 0
|
97
|
+
# CommandCam delay is in milliseconds
|
98
|
+
delaycmd = " /delay #{capture_delay * 1000}"
|
99
|
+
end
|
100
|
+
_, r, _ = Open3.popen3("#{commandcam_exe} /filename #{snapshot_loc}#{delaycmd}")
|
101
|
+
# looks like we still need to read the outpot for something to happen
|
102
|
+
r.read
|
86
103
|
end
|
87
104
|
|
88
105
|
|
@@ -103,7 +120,7 @@ module Lolcommits
|
|
103
120
|
#else
|
104
121
|
# draw.font = "/usr/share/fonts/TTF/impact.ttf"
|
105
122
|
#end
|
106
|
-
draw.font = File.join(
|
123
|
+
draw.font = File.join(LOLCOMMITS_ROOT, "fonts", "Impact.ttf")
|
107
124
|
|
108
125
|
draw.fill = 'white'
|
109
126
|
draw.stroke = 'black'
|
@@ -132,12 +149,12 @@ module Lolcommits
|
|
132
149
|
# Squash the images and write the files
|
133
150
|
#
|
134
151
|
#canvas.flatten_images.write("#{loldir}/#{commit_sha}.jpg")
|
135
|
-
canvas.write("#{
|
136
|
-
FileUtils.rm(
|
152
|
+
canvas.write(File.join loldir, "#{commit_sha}.jpg")
|
153
|
+
FileUtils.rm(snapshot_loc)
|
137
154
|
|
138
155
|
#if in test mode, open image for inspection
|
139
156
|
if is_test
|
140
|
-
Launchy.open("#{
|
157
|
+
Launchy.open(File.join loldir, "#{commit_sha}.jpg")
|
141
158
|
end
|
142
159
|
|
143
160
|
|
data/lib/lolcommits/version.rb
CHANGED
data/lolcommits.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.email = ["mrothenberg@gmail.com"]
|
10
10
|
s.homepage = "http://github.com/mroth/lolcommits"
|
11
11
|
s.summary = %q{Capture webcam image on git commit for lulz.}
|
12
|
-
s.description = %q{
|
12
|
+
s.description = %q{Takes a snapshot with your Mac's built-in iSight/FaceTime webcam (or any working webcam on Linux or Windows) every time you git commit code, and archives a lolcat style image with it.}
|
13
13
|
|
14
14
|
s.rubyforge_project = "lolcommits"
|
15
15
|
|
data/test/test_lolcommits.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
require 'test/unit'
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
require 'lolcommits'
|
8
|
-
end
|
2
|
+
# Loads lolcommits directly from the lib folder so don't have to create
|
3
|
+
# a gem before testing
|
4
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
5
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
6
|
+
require 'lolcommits'
|
9
7
|
|
10
8
|
include Lolcommits
|
11
9
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lolcommits
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: rmagick
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: git
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,10 +53,15 @@ dependencies:
|
|
43
53
|
version: '0'
|
44
54
|
type: :runtime
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: choice
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ! '>='
|
@@ -54,10 +69,15 @@ dependencies:
|
|
54
69
|
version: 0.1.6
|
55
70
|
type: :runtime
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 0.1.6
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: launchy
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
83
|
- - ! '>='
|
@@ -65,9 +85,15 @@ dependencies:
|
|
65
85
|
version: '0'
|
66
86
|
type: :runtime
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
69
|
-
|
70
|
-
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
description: Takes a snapshot with your Mac's built-in iSight/FaceTime webcam (or
|
95
|
+
any working webcam on Linux or Windows) every time you git commit code, and archives
|
96
|
+
a lolcat style image with it.
|
71
97
|
email:
|
72
98
|
- mrothenberg@gmail.com
|
73
99
|
executables:
|
@@ -82,6 +108,7 @@ files:
|
|
82
108
|
- README.md
|
83
109
|
- Rakefile
|
84
110
|
- bin/lolcommits
|
111
|
+
- ext/CommandCam.exe
|
85
112
|
- fonts/Impact.ttf
|
86
113
|
- lib/lolcommits.rb
|
87
114
|
- lib/lolcommits/version.rb
|
@@ -107,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
134
|
version: '0'
|
108
135
|
requirements: []
|
109
136
|
rubyforge_project: lolcommits
|
110
|
-
rubygems_version: 1.8.
|
137
|
+
rubygems_version: 1.8.23
|
111
138
|
signing_key:
|
112
139
|
specification_version: 3
|
113
140
|
summary: Capture webcam image on git commit for lulz.
|