lolcommits 0.0.1 → 0.0.2
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.
- data/CHANGELOG +14 -0
- data/README.md +13 -5
- data/bin/lolcommits +36 -14
- data/lib/lolcommits.rb +25 -9
- data/lib/lolcommits/version.rb +1 -1
- data/lolcommits.gemspec +1 -1
- metadata +4 -3
data/CHANGELOG
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
0.0. (2 April 2012)
|
2
|
+
* add --delay option to delay image capture (thx JohanB), can be
|
3
|
+
persistently set via LOLCOMMITS_DELAY environment variable.
|
4
|
+
* add --last command to view most recent lolcommit for a repo
|
5
|
+
* add --browse command to open the lolcommit images directory for a particular repo
|
6
|
+
|
7
|
+
0.0.1 (29 March 2012)
|
8
|
+
* initial release as a gem package, major refactoring for this
|
9
|
+
* refactored to remove git-hooks package dependency, now installs stub hook
|
10
|
+
directly into each git repo
|
11
|
+
* wordwrap commit_msg manually, to switch to use imagemagick annotate
|
12
|
+
instead of compositing multiply image Caption objects (this seems to be more
|
13
|
+
reliable to not glitch.)
|
14
|
+
|
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# git + webcam = lol
|
2
2
|
|
3
|
-
Takes a snapshot with your Mac's built-in iSight webcam every time you git commit code, and archives a lolcat style image with it.
|
3
|
+
Takes a snapshot with your Mac's built-in iSight/FaceTime webcam every time you git commit code, and archives a lolcat style image with it.
|
4
4
|
|
5
5
|
By default, the lolimages are stored by a Github style short SHA in a `~/.lolcommits` directory created for you.
|
6
6
|
|
7
7
|
## Installation (for new gem-y version)
|
8
|
-
We've gotten rid of most of the dependency chain, yay!
|
8
|
+
We've gotten rid of most of the dependency chain, yay!
|
9
9
|
|
10
10
|
You'll need imagesnap and imagemagick installed. Homebrew makes this easy. Simply do:
|
11
11
|
|
@@ -14,8 +14,10 @@ You'll need imagesnap and imagemagick installed. Homebrew makes this easy. Sim
|
|
14
14
|
|
15
15
|
This will take care of the non-Ruby dependencies. Then do:
|
16
16
|
|
17
|
-
gem install lolcommits
|
18
|
-
|
17
|
+
[sudo] gem install lolcommits
|
18
|
+
|
19
|
+
(If you're using rvm or something like that, you can/should probably omit the sudo, but the default MacOSX Ruby install is dumb and requires it.)
|
20
|
+
|
19
21
|
You're all set! To enable lolcommits for a git repo, go to the base directory of the repository, and run:
|
20
22
|
|
21
23
|
lolcommits --enable
|
@@ -30,6 +32,12 @@ Please add your own lolcommit to these samples! Just fork this repo, add it to
|
|
30
32
|
<br/>
|
31
33
|
<img width='320' height='240' src="https://github.com/mroth/lolcommits/raw/gh-pages/sample4.jpg" />
|
32
34
|
|
35
|
+
<img width='320' height='240' src="https://github.com/mroth/lolcommits/raw/gh-pages/sample6.jpg" />
|
36
|
+
<br/>
|
37
|
+
<img width='320' height='240' src="https://github.com/mroth/lolcommits/raw/gh-pages/sample7.jpg" />
|
38
|
+
|
39
|
+
<img width='320' height='240' src="https://github.com/mroth/lolcommits/raw/gh-pages/sample8.jpg" />
|
40
|
+
<br/>
|
33
41
|
|
34
42
|
## Upgrading from an old (non-gem) version?
|
35
43
|
If you used the autoinstaller, here's how to get rid of the old stuff (I think)
|
@@ -77,4 +85,4 @@ This installs [git-hooks](https://github.com/icefox/git-hooks) which gives you a
|
|
77
85
|
If you don't want to use `/usr/local/bin` you can provide a different
|
78
86
|
dir running `LOCAL_BINDIR=/your/path/of/choice rake install`
|
79
87
|
|
80
|
-
-->
|
88
|
+
-->
|
data/bin/lolcommits
CHANGED
@@ -49,18 +49,15 @@ def do_enable
|
|
49
49
|
#TODO: disambiguate between OUR post-commit hook and something else
|
50
50
|
exit 1
|
51
51
|
end
|
52
|
-
|
53
|
-
#TODO: figure out where gem puts this, copy from there
|
54
|
-
#FileUtils.touch HOOK_PATH
|
52
|
+
|
55
53
|
doc = "#!/bin/sh\nlolcommits --capture\n"
|
56
54
|
File.open(HOOK_PATH, 'w') {|f| f.write(doc) }
|
57
55
|
FileUtils.chmod 0755, HOOK_PATH
|
58
56
|
puts "installed lolcommmit hook as:"
|
59
57
|
puts " -> #{File.expand_path(HOOK_PATH)}"
|
60
58
|
puts "(to remove later, you can use: lolcommits --disable)"
|
61
|
-
#
|
59
|
+
# we dont symlink, but rather install a small stub that calls the one from path
|
62
60
|
# that way, as gem version changes, script updates even if new file thus breaking symlink
|
63
|
-
#File.symlink "/Users/mroth/.git_hooks/post-commit/lolcommit", ".git/hooks/post-commit"
|
64
61
|
end
|
65
62
|
|
66
63
|
#
|
@@ -80,11 +77,13 @@ end
|
|
80
77
|
# IF --CAPTURE, DO CAPTURE
|
81
78
|
#
|
82
79
|
def do_capture
|
80
|
+
capture_delay = Choice.choices[:delay] || ENV['LOLCOMMITS_DELAY'] || 0
|
81
|
+
|
83
82
|
if Choice.choices[:test]
|
84
83
|
puts "*** capturing in test mode"
|
85
|
-
Lolcommits.capture(true, Choice.choices[:msg], Choice.choices[:sha])
|
84
|
+
Lolcommits.capture(capture_delay, true, Choice.choices[:msg], Choice.choices[:sha])
|
86
85
|
else
|
87
|
-
Lolcommits.capture
|
86
|
+
Lolcommits.capture(capture_delay)
|
88
87
|
end
|
89
88
|
end
|
90
89
|
|
@@ -92,7 +91,7 @@ end
|
|
92
91
|
# Command line parsing fun
|
93
92
|
#
|
94
93
|
Choice.options do
|
95
|
-
|
94
|
+
|
96
95
|
option :enable do
|
97
96
|
long "--enable"
|
98
97
|
action { do_enable }
|
@@ -109,6 +108,24 @@ Choice.options do
|
|
109
108
|
long "--capture"
|
110
109
|
desc "capture lolcommit based on last git commit"
|
111
110
|
end
|
111
|
+
|
112
|
+
option :last do
|
113
|
+
long "--last"
|
114
|
+
short "-l"
|
115
|
+
desc "view the most recent lolcommit"
|
116
|
+
action do
|
117
|
+
system "open #{Lolcommits.most_recent}"
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
option :browse do
|
122
|
+
long "--browse"
|
123
|
+
short "-b"
|
124
|
+
desc "browse this repo's lolcommits"
|
125
|
+
action do
|
126
|
+
system "open #{Lolcommits.loldir}"
|
127
|
+
end
|
128
|
+
end
|
112
129
|
|
113
130
|
option :test do
|
114
131
|
long "--test"
|
@@ -116,28 +133,33 @@ Choice.options do
|
|
116
133
|
end
|
117
134
|
|
118
135
|
option :sha do
|
119
|
-
desc "
|
136
|
+
desc "pass SHA manually (for test only)"
|
120
137
|
short '-s'
|
121
138
|
default "test-#{rand(10 ** 10)}"
|
122
139
|
end
|
123
140
|
|
124
141
|
option :msg do
|
125
|
-
desc "
|
142
|
+
desc "pass commit msg manually (for test only)"
|
126
143
|
short '-m'
|
127
144
|
default "this is a test message i didnt really commit something"
|
128
145
|
end
|
146
|
+
|
147
|
+
option :delay do
|
148
|
+
long "--delay=SECONDS"
|
149
|
+
desc "delay taking of the snapshot by n seconds"
|
150
|
+
cast Integer
|
151
|
+
short '-d'
|
152
|
+
#default 0
|
153
|
+
end
|
129
154
|
end
|
130
155
|
|
131
156
|
#
|
132
157
|
# Handle actions manually since choice seems weird
|
133
158
|
#
|
134
|
-
if not (Choice.choices[:enable] || Choice.choices[:disable])
|
159
|
+
if not (Choice.choices[:enable] || Choice.choices[:disable] || Choice.choices[:last] || Choice.choices[:browse])
|
135
160
|
if Choice.choices[:capture]
|
136
161
|
do_capture()
|
137
162
|
else
|
138
163
|
do_noargs()
|
139
164
|
end
|
140
165
|
end
|
141
|
-
|
142
|
-
#if here, choice didnt do anything (NOT TRUE)
|
143
|
-
#noargs
|
data/lib/lolcommits.rb
CHANGED
@@ -10,18 +10,33 @@ module Lolcommits
|
|
10
10
|
$home = ENV['HOME']
|
11
11
|
LOLBASEDIR = "#{$home}/.lolcommits"
|
12
12
|
|
13
|
-
def
|
13
|
+
def most_recent(dir='.')
|
14
|
+
loldir, commit_sha, commit_msg = parse_git
|
15
|
+
Dir.glob("#{loldir}/*").max_by {|f| File.mtime(f)}
|
16
|
+
end
|
17
|
+
|
18
|
+
def loldir(dir='.')
|
19
|
+
loldir, commit_sha, commit_msg = parse_git
|
20
|
+
return loldir
|
21
|
+
end
|
22
|
+
|
23
|
+
def parse_git(dir='.')
|
24
|
+
g = Git.open('.')
|
25
|
+
commit = g.log.first
|
26
|
+
commit_msg = commit.message
|
27
|
+
commit_sha = commit.sha[0..10]
|
28
|
+
basename = File.basename(g.dir.to_s)
|
29
|
+
basename.sub!(/^\./, 'dot') #no invisible directories in output, thanks!
|
30
|
+
loldir = "#{LOLBASEDIR}/#{basename}"
|
31
|
+
return loldir, commit_sha, commit_msg
|
32
|
+
end
|
33
|
+
|
34
|
+
def capture(capture_delay=0, is_test=false, test_msg=nil, test_sha=nil)
|
14
35
|
#
|
15
36
|
# Read the git repo information from the current working directory
|
16
37
|
#
|
17
38
|
if not is_test
|
18
|
-
|
19
|
-
commit = g.log.first
|
20
|
-
commit_msg = commit.message
|
21
|
-
commit_sha = commit.sha[0..10]
|
22
|
-
basename = File.basename(g.dir.to_s)
|
23
|
-
basename.sub!(/^\./, 'dot') #no invisible directories in output, thanks!
|
24
|
-
loldir = "#{LOLBASEDIR}/#{basename}"
|
39
|
+
loldir, commit_sha, commit_msg = parse_git
|
25
40
|
else
|
26
41
|
commit_msg = test_msg #Choice.choices[:msg]
|
27
42
|
commit_sha = test_sha #Choice.choices[:sha]
|
@@ -45,7 +60,8 @@ module Lolcommits
|
|
45
60
|
#
|
46
61
|
puts "*** Preserving this moment in history."
|
47
62
|
snapshot_loc = "#{loldir}/tmp_snapshot.jpg"
|
48
|
-
system("imagesnap -q #{snapshot_loc}")
|
63
|
+
system("imagesnap -q #{snapshot_loc} -w #{capture_delay}")
|
64
|
+
|
49
65
|
|
50
66
|
#
|
51
67
|
# Process the image with ImageMagick to add loltext
|
data/lib/lolcommits/version.rb
CHANGED
data/lolcommits.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.version = Lolcommits::VERSION
|
8
8
|
s.authors = ["Matthew Rothenberg"]
|
9
9
|
s.email = ["mrothenberg@gmail.com"]
|
10
|
-
s.homepage = ""
|
10
|
+
s.homepage = "http://github.com/mroth/lolcommits"
|
11
11
|
s.summary = %q{Capture webcam image on git commit}
|
12
12
|
s.description = %q{Capture webcam image on git commit for lulz}
|
13
13
|
|
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.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-04-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rmagick
|
@@ -68,6 +68,7 @@ extensions: []
|
|
68
68
|
extra_rdoc_files: []
|
69
69
|
files:
|
70
70
|
- .gitignore
|
71
|
+
- CHANGELOG
|
71
72
|
- Gemfile
|
72
73
|
- README.md
|
73
74
|
- Rakefile
|
@@ -75,7 +76,7 @@ files:
|
|
75
76
|
- lib/lolcommits.rb
|
76
77
|
- lib/lolcommits/version.rb
|
77
78
|
- lolcommits.gemspec
|
78
|
-
homepage:
|
79
|
+
homepage: http://github.com/mroth/lolcommits
|
79
80
|
licenses: []
|
80
81
|
post_install_message:
|
81
82
|
rdoc_options: []
|