lolcommits 0.1.5 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -1
- data/CHANGELOG +7 -0
- data/README.md +13 -19
- data/Rakefile +32 -5
- data/bin/lolcommits +8 -0
- data/features/lolcommits.feature +41 -0
- data/features/step_definitions/lolcommits_steps.rb +20 -0
- data/features/support/env.rb +25 -0
- data/lib/lolcommits.rb +9 -1
- data/lib/lolcommits/version.rb +1 -1
- data/lolcommits.gemspec +9 -8
- data/test/images/test_image.jpg +0 -0
- data/test/test_lolcommits.rb +13 -0
- metadata +75 -19
data/.gitignore
CHANGED
data/CHANGELOG
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
0.2.0 (6 July 2012)
|
2
|
+
* improved build system and testing with cucumber/methadone
|
3
|
+
- goal is to get into a better framework to start doing major feature work
|
4
|
+
- this should lead to increased reliability across systems as we refactor
|
5
|
+
* writing tests (please help!)
|
6
|
+
* fix issues with packaged files not being readable after a sudo gem install
|
7
|
+
|
1
8
|
0.1.5 (25 June 2012)
|
2
9
|
* fix tranzlate on ruby1.8
|
3
10
|
|
data/README.md
CHANGED
@@ -1,11 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
# git + webcam = lol
|
1
|
+
# lolcommits (git + webcam = lol)
|
4
2
|
|
5
3
|
Takes a snapshot with your Mac's built-in iSight/FaceTime webcam (or any working webcam on Linux) every time you git commit code, and archives a lolcat style image with it.
|
6
4
|
|
7
5
|
By default, the lolimages are stored by a Github style short SHA in a `~/.lolcommits` directory created for you.
|
8
6
|
|
7
|
+
[![Build Status](https://secure.travis-ci.org/mroth/lolcommits.png?branch=master)](http://travis-ci.org/mroth/lolcommits)
|
8
|
+
[![Dependency Status](https://gemnasium.com/mroth/lolcommits.png)](https://gemnasium.com/mroth/lolcommits)
|
9
|
+
|
9
10
|
## Installation (Mac OS X)
|
10
11
|
You'll need ImageMagick installed. [Homebrew](http://mxcl.github.com/homebrew/) makes this easy. Simply do:
|
11
12
|
|
@@ -74,22 +75,15 @@ environment variables.
|
|
74
75
|
* TRANZLATE YOAR COMMIT_MSG TO LOLSPEKK - set
|
75
76
|
`LOLCOMMITS_TRANZLATE=1`.
|
76
77
|
|
77
|
-
##
|
78
|
-
Started a [FAQ](https://github.com/mroth/lolcommits/wiki/FAQ).
|
78
|
+
## Contributing
|
79
79
|
|
80
|
-
|
81
|
-
|
82
|
-
|
80
|
+
1. Fork it
|
81
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
82
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
83
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
84
|
+
5. Create new Pull Request
|
83
85
|
|
84
|
-
|
86
|
+
Please, if at all possible, write a passing test for the functionality you added.
|
85
87
|
|
86
|
-
|
87
|
-
|
88
|
-
You might want to get rid of the copied binary for imagesnap and switch over to the homebrew-managed version, if so `rm /usr/local/bin/imagesnap`.
|
89
|
-
|
90
|
-
If you want to get rid of git-hooks entirly (it won't hurt anything, but we dont use it anymore), you can also do:
|
91
|
-
|
92
|
-
rm /usr/local/bin/git-hooks
|
93
|
-
rm -rf ~/.git_hooks
|
94
|
-
rm -rf ~/.githooks_src
|
95
|
-
-->
|
88
|
+
## Troubles?
|
89
|
+
Started a [FAQ](https://github.com/mroth/lolcommits/wiki/FAQ).
|
data/Rakefile
CHANGED
@@ -1,13 +1,40 @@
|
|
1
|
-
require
|
1
|
+
require 'bundler'
|
2
|
+
require 'rake/clean'
|
3
|
+
|
2
4
|
require 'rake/testtask'
|
3
5
|
|
6
|
+
require 'cucumber'
|
7
|
+
require 'cucumber/rake/task'
|
8
|
+
gem 'rdoc' # we need the installed RDoc gem, not the system one
|
9
|
+
require 'rdoc/task'
|
10
|
+
|
11
|
+
include Rake::DSL
|
12
|
+
|
13
|
+
Bundler::GemHelper.install_tasks
|
14
|
+
|
15
|
+
|
4
16
|
Rake::TestTask.new do |t|
|
5
|
-
|
6
|
-
|
17
|
+
t.pattern = 'test/test_*.rb'
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
CUKE_RESULTS = 'results.html'
|
22
|
+
CLEAN << CUKE_RESULTS
|
23
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
24
|
+
t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty --no-source -x"
|
25
|
+
t.fork = false
|
7
26
|
end
|
8
27
|
|
9
|
-
|
10
|
-
|
28
|
+
Rake::RDocTask.new do |rd|
|
29
|
+
|
30
|
+
rd.main = "README.rdoc"
|
31
|
+
|
32
|
+
rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
|
33
|
+
end
|
34
|
+
|
35
|
+
task :default => [:test,:features]
|
36
|
+
|
37
|
+
|
11
38
|
|
12
39
|
desc "Migrate an existing local .lolcommits directory to Dropbox"
|
13
40
|
task :dropboxify do
|
data/bin/lolcommits
CHANGED
@@ -26,12 +26,20 @@ if is_mac?
|
|
26
26
|
# puts "Easiest way to get it is to install homebrew and do `brew install imagesnap`"
|
27
27
|
# exit 1
|
28
28
|
#end
|
29
|
+
unless File.executable? File.join(LOLCOMMITS_ROOT, "ext", "imagesnap", "imagesnap")
|
30
|
+
puts "Couldn't properly execute imagesnap for some reason, please file a bug?!"
|
31
|
+
exit 1
|
32
|
+
end
|
29
33
|
elsif is_linux?
|
30
34
|
if not command?('mplayer')
|
31
35
|
puts "Couldn't find mplayer in your PATH!"
|
32
36
|
exit 1
|
33
37
|
end
|
34
38
|
end
|
39
|
+
unless File.readable? File.join(LOLCOMMITS_ROOT, "fonts", "Impact.ttf")
|
40
|
+
puts "Couldn't properly read Impact font from gem package, please file a bug?!"
|
41
|
+
exit 1
|
42
|
+
end
|
35
43
|
|
36
44
|
#
|
37
45
|
# NO ARGUMENTS SPECIFIED, HELP THE USER OUT
|
@@ -0,0 +1,41 @@
|
|
1
|
+
Feature: Basic functionality
|
2
|
+
|
3
|
+
Scenario: App just runs
|
4
|
+
When I get help for "lolcommits"
|
5
|
+
Then the exit status should be 0
|
6
|
+
And the banner should be present
|
7
|
+
|
8
|
+
Scenario: Enable in a naked git repository
|
9
|
+
Given a git repository named "loltest"
|
10
|
+
And the git repository named "loltest" has no "post-commit" hook
|
11
|
+
|
12
|
+
When I cd to "loltest"
|
13
|
+
And I successfully run `lolcommits --enable`
|
14
|
+
|
15
|
+
Then the output should contain "installed lolcommmit hook as:"
|
16
|
+
And the output should contain "(to remove later, you can use: lolcommits --disable)"
|
17
|
+
And a file named ".git/hooks/post-commit" should exist
|
18
|
+
And the exit status should be 0
|
19
|
+
|
20
|
+
Scenario: Disable in a enabled git repository
|
21
|
+
Given a git repository named "lolenabled"
|
22
|
+
And the git repository named "lolenabled" has a "post-commit" hook
|
23
|
+
|
24
|
+
When I cd to "lolenabled"
|
25
|
+
And I successfully run `lolcommits --disable`
|
26
|
+
|
27
|
+
Then the output should contain "removed"
|
28
|
+
And a file named ".git/hooks/post-commit" should not exist
|
29
|
+
And the exit status should be 0
|
30
|
+
|
31
|
+
@simulate-capture
|
32
|
+
Scenario: Commiting in an enabled repo triggers capture
|
33
|
+
Given a git repository named "testcapture"
|
34
|
+
And an empty file named "testcapture/FOOBAR"
|
35
|
+
|
36
|
+
When I cd to "testcapture"
|
37
|
+
And I successfully run `lolcommits --enable`
|
38
|
+
And I successfully run `git add .`
|
39
|
+
And I successfully run `git commit -m 'can haz commit'`
|
40
|
+
Then the output should contain "*** Preserving this moment in history."
|
41
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
include FileUtils
|
2
|
+
|
3
|
+
|
4
|
+
Given /^a git repository named "(.*?)"$/ do |repo_name|
|
5
|
+
repo_dir = File.join current_dir, repo_name
|
6
|
+
mkdir_p repo_dir
|
7
|
+
Dir.chdir repo_dir do
|
8
|
+
sh "git init ."
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
Given /^the git repository named "(.*?)" has no "(.*?)" hook$/ do |repo_name, hook_name|
|
13
|
+
hook_file = File.join current_dir, repo_name, ".git", "hooks", hook_name
|
14
|
+
delete(hook_file) if File.exists? hook_file
|
15
|
+
end
|
16
|
+
|
17
|
+
Given /^the git repository named "(.*?)" has a "(.*?)" hook$/ do |repo_name, hook_name|
|
18
|
+
hook_file = File.join current_dir, repo_name, ".git", "hooks", hook_name
|
19
|
+
touch(hook_file) if not File.exists? hook_file
|
20
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'aruba/cucumber'
|
2
|
+
require 'methadone/cucumber'
|
3
|
+
|
4
|
+
ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
|
5
|
+
LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')
|
6
|
+
|
7
|
+
Before do
|
8
|
+
# Using "announce" causes massive warnings on 1.9.2
|
9
|
+
@puts = true
|
10
|
+
@original_rubylib = ENV['RUBYLIB']
|
11
|
+
ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
|
12
|
+
end
|
13
|
+
|
14
|
+
After do
|
15
|
+
ENV['RUBYLIB'] = @original_rubylib
|
16
|
+
end
|
17
|
+
|
18
|
+
Before('@simulate-capture') do
|
19
|
+
@original_fakecapture = ENV['LOLCOMMITS_FAKECAPTURE']
|
20
|
+
ENV['LOLCOMMITS_FAKECAPTURE'] = "1"
|
21
|
+
end
|
22
|
+
|
23
|
+
After('@simulate-capture') do
|
24
|
+
ENV['LOLCOMMITS_FAKECAPTURE'] = @original_fakecapture
|
25
|
+
end
|
data/lib/lolcommits.rb
CHANGED
@@ -29,6 +29,10 @@ module Lolcommits
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
+
def is_fakecapture?
|
33
|
+
(ENV['LOLCOMMITS_FAKECAPTURE'] == '1' || false)
|
34
|
+
end
|
35
|
+
|
32
36
|
def most_recent(dir='.')
|
33
37
|
loldir, commit_sha, commit_msg = parse_git
|
34
38
|
Dir.glob(File.join loldir, "*").max_by {|f| File.mtime(f)}
|
@@ -84,7 +88,11 @@ module Lolcommits
|
|
84
88
|
#
|
85
89
|
puts "*** Preserving this moment in history."
|
86
90
|
snapshot_loc = File.join loldir, "tmp_snapshot.jpg"
|
87
|
-
if
|
91
|
+
# if (ENV['LOLCOMMITS_FAKECAPTURE'] == '1' || false)
|
92
|
+
if is_fakecapture?
|
93
|
+
test_image = File.join LOLCOMMITS_ROOT, "test", "images", "test_image.jpg"
|
94
|
+
FileUtils.cp test_image, snapshot_loc
|
95
|
+
elsif is_mac?
|
88
96
|
imagesnap_bin = File.join LOLCOMMITS_ROOT, "ext", "imagesnap", "imagesnap"
|
89
97
|
capture_device = "-d '#{capture_device}'" if capture_device
|
90
98
|
system("#{imagesnap_bin} -q #{snapshot_loc} -w #{capture_delay} #{capture_device}")
|
data/lib/lolcommits/version.rb
CHANGED
data/lolcommits.gemspec
CHANGED
@@ -18,12 +18,13 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
s.
|
25
|
-
|
26
|
-
s.
|
27
|
-
s.
|
28
|
-
s.
|
21
|
+
s.add_runtime_dependency('rmagick', '~> 2.13.1')
|
22
|
+
s.add_runtime_dependency('git', '~> 1.2.5')
|
23
|
+
s.add_runtime_dependency('choice', '~> 0.1.6')
|
24
|
+
s.add_runtime_dependency('launchy')
|
25
|
+
|
26
|
+
s.add_development_dependency('rdoc')
|
27
|
+
s.add_development_dependency('aruba')
|
28
|
+
s.add_development_dependency('rake','~> 0.9.2')
|
29
|
+
s.add_dependency('methadone', '~>1.2.1')
|
29
30
|
end
|
Binary file
|
data/test/test_lolcommits.rb
CHANGED
@@ -14,6 +14,9 @@ class LolTest < Test::Unit::TestCase
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
#
|
18
|
+
# issue #57, https://github.com/mroth/lolcommits/issues/57
|
19
|
+
#
|
17
20
|
def test_tranzlate
|
18
21
|
[["what the hell","(WH|W)UT TEH HELL"],["seriously wtf", "SRSLEH WTF"]].each do |normal, lol|
|
19
22
|
tranzlated = normal.tranzlate
|
@@ -21,10 +24,20 @@ class LolTest < Test::Unit::TestCase
|
|
21
24
|
end
|
22
25
|
end
|
23
26
|
|
27
|
+
#
|
28
|
+
# issue #53, https://github.com/mroth/lolcommits/issues/53
|
29
|
+
# this will test the permissions but only locally, important before building a gem package!
|
30
|
+
#
|
31
|
+
def test_permissions
|
32
|
+
assert File.readable? File.join(LOLCOMMITS_ROOT, "fonts", "Impact.ttf")
|
33
|
+
assert File.executable? File.join(LOLCOMMITS_ROOT, "ext", "imagesnap", "imagesnap")
|
34
|
+
end
|
35
|
+
|
24
36
|
# Hmm.. webcam capture breaks travis-ci tests
|
25
37
|
#def test_can_capture
|
26
38
|
# assert_nothing_raised do
|
27
39
|
# Lolcommits.capture(0,true,'test commit message','test-sha-001')
|
28
40
|
# end
|
29
41
|
#end
|
42
|
+
|
30
43
|
end
|
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.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,17 +9,65 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06
|
12
|
+
date: 2012-07-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
15
|
+
name: rmagick
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 2.13.1
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 2.13.1
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: git
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.2.5
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.2.5
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: choice
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.1.6
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.1.6
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: launchy
|
16
64
|
requirement: !ruby/object:Gem::Requirement
|
17
65
|
none: false
|
18
66
|
requirements:
|
19
67
|
- - ! '>='
|
20
68
|
- !ruby/object:Gem::Version
|
21
69
|
version: '0'
|
22
|
-
type: :
|
70
|
+
type: :runtime
|
23
71
|
prerelease: false
|
24
72
|
version_requirements: !ruby/object:Gem::Requirement
|
25
73
|
none: false
|
@@ -28,14 +76,14 @@ dependencies:
|
|
28
76
|
- !ruby/object:Gem::Version
|
29
77
|
version: '0'
|
30
78
|
- !ruby/object:Gem::Dependency
|
31
|
-
name:
|
79
|
+
name: rdoc
|
32
80
|
requirement: !ruby/object:Gem::Requirement
|
33
81
|
none: false
|
34
82
|
requirements:
|
35
83
|
- - ! '>='
|
36
84
|
- !ruby/object:Gem::Version
|
37
85
|
version: '0'
|
38
|
-
type: :
|
86
|
+
type: :development
|
39
87
|
prerelease: false
|
40
88
|
version_requirements: !ruby/object:Gem::Requirement
|
41
89
|
none: false
|
@@ -44,14 +92,14 @@ dependencies:
|
|
44
92
|
- !ruby/object:Gem::Version
|
45
93
|
version: '0'
|
46
94
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
95
|
+
name: aruba
|
48
96
|
requirement: !ruby/object:Gem::Requirement
|
49
97
|
none: false
|
50
98
|
requirements:
|
51
99
|
- - ! '>='
|
52
100
|
- !ruby/object:Gem::Version
|
53
101
|
version: '0'
|
54
|
-
type: :
|
102
|
+
type: :development
|
55
103
|
prerelease: false
|
56
104
|
version_requirements: !ruby/object:Gem::Requirement
|
57
105
|
none: false
|
@@ -60,37 +108,37 @@ dependencies:
|
|
60
108
|
- !ruby/object:Gem::Version
|
61
109
|
version: '0'
|
62
110
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
111
|
+
name: rake
|
64
112
|
requirement: !ruby/object:Gem::Requirement
|
65
113
|
none: false
|
66
114
|
requirements:
|
67
|
-
- -
|
115
|
+
- - ~>
|
68
116
|
- !ruby/object:Gem::Version
|
69
|
-
version: 0.
|
70
|
-
type: :
|
117
|
+
version: 0.9.2
|
118
|
+
type: :development
|
71
119
|
prerelease: false
|
72
120
|
version_requirements: !ruby/object:Gem::Requirement
|
73
121
|
none: false
|
74
122
|
requirements:
|
75
|
-
- -
|
123
|
+
- - ~>
|
76
124
|
- !ruby/object:Gem::Version
|
77
|
-
version: 0.
|
125
|
+
version: 0.9.2
|
78
126
|
- !ruby/object:Gem::Dependency
|
79
|
-
name:
|
127
|
+
name: methadone
|
80
128
|
requirement: !ruby/object:Gem::Requirement
|
81
129
|
none: false
|
82
130
|
requirements:
|
83
|
-
- -
|
131
|
+
- - ~>
|
84
132
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
133
|
+
version: 1.2.1
|
86
134
|
type: :runtime
|
87
135
|
prerelease: false
|
88
136
|
version_requirements: !ruby/object:Gem::Requirement
|
89
137
|
none: false
|
90
138
|
requirements:
|
91
|
-
- -
|
139
|
+
- - ~>
|
92
140
|
- !ruby/object:Gem::Version
|
93
|
-
version:
|
141
|
+
version: 1.2.1
|
94
142
|
description: Takes a snapshot with your Mac's built-in iSight/FaceTime webcam (or
|
95
143
|
any working webcam on Linux or Windows) every time you git commit code, and archives
|
96
144
|
a lolcat style image with it.
|
@@ -114,11 +162,15 @@ files:
|
|
114
162
|
- ext/CommandCam/LICENSE
|
115
163
|
- ext/imagesnap/ReadMeOrDont.rtf
|
116
164
|
- ext/imagesnap/imagesnap
|
165
|
+
- features/lolcommits.feature
|
166
|
+
- features/step_definitions/lolcommits_steps.rb
|
167
|
+
- features/support/env.rb
|
117
168
|
- fonts/Impact.ttf
|
118
169
|
- lib/lolcommits.rb
|
119
170
|
- lib/lolcommits/version.rb
|
120
171
|
- lib/tranzlate/lolspeak.rb
|
121
172
|
- lolcommits.gemspec
|
173
|
+
- test/images/test_image.jpg
|
122
174
|
- test/test_lolcommits.rb
|
123
175
|
homepage: http://github.com/mroth/lolcommits
|
124
176
|
licenses:
|
@@ -146,4 +198,8 @@ signing_key:
|
|
146
198
|
specification_version: 3
|
147
199
|
summary: Capture webcam image on git commit for lulz.
|
148
200
|
test_files:
|
201
|
+
- features/lolcommits.feature
|
202
|
+
- features/step_definitions/lolcommits_steps.rb
|
203
|
+
- features/support/env.rb
|
204
|
+
- test/images/test_image.jpg
|
149
205
|
- test/test_lolcommits.rb
|