naturecommits 0.0.1
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/.gitignore +6 -0
- data/.travis.yml +10 -0
- data/CHANGELOG +36 -0
- data/Gemfile +4 -0
- data/LICENSE +165 -0
- data/README.md +57 -0
- data/Rakefile +38 -0
- data/bin/naturecommits +184 -0
- data/ext/CommandCam/COPYING +674 -0
- data/ext/CommandCam/CommandCam.exe +0 -0
- data/ext/CommandCam/LICENSE +16 -0
- data/ext/imagesnap/ReadMeOrDont.rtf +117 -0
- data/ext/imagesnap/imagesnap +0 -0
- data/fonts/Impact.ttf +0 -0
- data/lib/naturecommits.rb +210 -0
- data/lib/naturecommits/version.rb +3 -0
- data/lib/tranzlate/lolspeak.rb +101 -0
- data/naturecommits.gemspec +29 -0
- data/test/test_ naturecommits.rb +23 -0
- metadata +155 -0
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CHANGELOG
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
0.1.3 (18 May 2012)
|
2
|
+
* add LGPLv3 license
|
3
|
+
* add option to translate your commit message to lolspeak! (thx
|
4
|
+
to @DanielleSucher!). To enable, set `naturecommits_TRANZLATE=1`.
|
5
|
+
* fix issue with older versions of IM crashing on interline spacing (pull #31 via @german)
|
6
|
+
* fix issue with git repos with no hooks directory (pull #43 via @mkmaster)
|
7
|
+
* fix missing dash in capture -c
|
8
|
+
|
9
|
+
0.1.2 (22 April 2012)
|
10
|
+
* provide licensing info for CommandCam (Windows)
|
11
|
+
* bundle imagesnap as well to remove a dependency on Mac OS X
|
12
|
+
|
13
|
+
0.1.1 (21 April 2012)
|
14
|
+
* Windows compatibility! Thanks to @Prydonious.
|
15
|
+
|
16
|
+
0.1.0 (19 April 2012)
|
17
|
+
* Linux compatibility! Thanks to @madjar, @cscorely, and @Prydonius.
|
18
|
+
|
19
|
+
0.0.3 (16 April 2012)
|
20
|
+
* use only first line for multi-line commit msgs (pull req #21)
|
21
|
+
* clean up some command line options
|
22
|
+
|
23
|
+
0.0.2 (2 April 2012)
|
24
|
+
* add --delay option to delay image capture (thx JohanB), can be
|
25
|
+
persistently set via naturecommits_DELAY environment variable.
|
26
|
+
* add --last command to view most recent lolcommit for a repo
|
27
|
+
* add --browse command to open the lolcommit images directory for a particular repo
|
28
|
+
|
29
|
+
0.0.1 (29 March 2012)
|
30
|
+
* initial release as a gem package, major refactoring for this
|
31
|
+
* refactored to remove git-hooks package dependency, now installs stub hook
|
32
|
+
directly into each git repo
|
33
|
+
* wordwrap commit_msg manually, to switch to use imagemagick annotate
|
34
|
+
instead of compositing multiply image Caption objects (this seems to be more
|
35
|
+
reliable to not glitch.)
|
36
|
+
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
2
|
+
Version 3, 29 June 2007
|
3
|
+
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
6
|
+
of this license document, but changing it is not allowed.
|
7
|
+
|
8
|
+
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
11
|
+
License, supplemented by the additional permissions listed below.
|
12
|
+
|
13
|
+
0. Additional Definitions.
|
14
|
+
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
17
|
+
General Public License.
|
18
|
+
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
20
|
+
other than an Application or a Combined Work as defined below.
|
21
|
+
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
25
|
+
of using an interface provided by the Library.
|
26
|
+
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
28
|
+
Application with the Library. The particular version of the Library
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
30
|
+
Version".
|
31
|
+
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
35
|
+
based on the Application, and not on the Linked Version.
|
36
|
+
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
38
|
+
object code and/or source code for the Application, including any data
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
41
|
+
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
43
|
+
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
46
|
+
|
47
|
+
2. Conveying Modified Versions.
|
48
|
+
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
51
|
+
that uses the facility (other than as an argument passed when the
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
53
|
+
version:
|
54
|
+
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
56
|
+
ensure that, in the event an Application does not supply the
|
57
|
+
function or data, the facility still operates, and performs
|
58
|
+
whatever part of its purpose remains meaningful, or
|
59
|
+
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
61
|
+
this License applicable to that copy.
|
62
|
+
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
64
|
+
|
65
|
+
The object code form of an Application may incorporate material from
|
66
|
+
a header file that is part of the Library. You may convey such object
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
68
|
+
material is not limited to numerical parameters, data structure
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
71
|
+
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
73
|
+
Library is used in it and that the Library and its use are
|
74
|
+
covered by this License.
|
75
|
+
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
77
|
+
document.
|
78
|
+
|
79
|
+
4. Combined Works.
|
80
|
+
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
82
|
+
taken together, effectively do not restrict modification of the
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
85
|
+
the following:
|
86
|
+
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
88
|
+
the Library is used in it and that the Library and its use are
|
89
|
+
covered by this License.
|
90
|
+
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
92
|
+
document.
|
93
|
+
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
95
|
+
execution, include the copyright notice for the Library among
|
96
|
+
these notices, as well as a reference directing the user to the
|
97
|
+
copies of the GNU GPL and this license document.
|
98
|
+
|
99
|
+
d) Do one of the following:
|
100
|
+
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
102
|
+
License, and the Corresponding Application Code in a form
|
103
|
+
suitable for, and under terms that permit, the user to
|
104
|
+
recombine or relink the Application with a modified version of
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
107
|
+
Corresponding Source.
|
108
|
+
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
111
|
+
a copy of the Library already present on the user's computer
|
112
|
+
system, and (b) will operate properly with a modified version
|
113
|
+
of the Library that is interface-compatible with the Linked
|
114
|
+
Version.
|
115
|
+
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
117
|
+
be required to provide such information under section 6 of the
|
118
|
+
GNU GPL, and only to the extent that such information is
|
119
|
+
necessary to install and execute a modified version of the
|
120
|
+
Combined Work produced by recombining or relinking the
|
121
|
+
Application with a modified version of the Linked Version. (If
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
126
|
+
for conveying Corresponding Source.)
|
127
|
+
|
128
|
+
5. Combined Libraries.
|
129
|
+
|
130
|
+
You may place library facilities that are a work based on the
|
131
|
+
Library side by side in a single library together with other library
|
132
|
+
facilities that are not Applications and are not covered by this
|
133
|
+
License, and convey such a combined library under terms of your
|
134
|
+
choice, if you do both of the following:
|
135
|
+
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
137
|
+
on the Library, uncombined with any other library facilities,
|
138
|
+
conveyed under the terms of this License.
|
139
|
+
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
141
|
+
is a work based on the Library, and explaining where to find the
|
142
|
+
accompanying uncombined form of the same work.
|
143
|
+
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
145
|
+
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
148
|
+
versions will be similar in spirit to the present version, but may
|
149
|
+
differ in detail to address new problems or concerns.
|
150
|
+
|
151
|
+
Each version is given a distinguishing version number. If the
|
152
|
+
Library as you received it specifies that a certain numbered version
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
154
|
+
applies to it, you have the option of following the terms and
|
155
|
+
conditions either of that published version or of any later version
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
160
|
+
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
164
|
+
permanent authorization for you to choose that version for the
|
165
|
+
Library.
|
data/README.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
[](http://travis-ci.org/mroth/naturecommits)
|
2
|
+
|
3
|
+
# git + webcam = lol
|
4
|
+
|
5
|
+
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
|
+
|
7
|
+
By default, the lolimages are stored by a Github style short SHA in a `~/.naturecommits` directory created for you.
|
8
|
+
|
9
|
+
## Installation (Mac OS X)
|
10
|
+
You'll need ImageMagick installed. [Homebrew](http://mxcl.github.com/homebrew/) makes this easy. Simply do:
|
11
|
+
|
12
|
+
brew install imagemagick --from-source
|
13
|
+
|
14
|
+
You will also need the aws/s3 and yaml ruby gems installed:
|
15
|
+
|
16
|
+
[sudo] gem install aws-s3
|
17
|
+
[sudo] gem install yaml
|
18
|
+
|
19
|
+
Then simply do:
|
20
|
+
|
21
|
+
[sudo] gem install naturecommits
|
22
|
+
|
23
|
+
(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.)
|
24
|
+
|
25
|
+
You're all set! To enable naturecommits for a git repo, go to the base directory of the repository, and run:
|
26
|
+
|
27
|
+
naturecommits --enable
|
28
|
+
|
29
|
+
Likewise, you can disable it via `naturecommits --disable`. For a full list of options, you can do `naturecommits --help`.
|
30
|
+
|
31
|
+
## Amazon S3
|
32
|
+
You will also need the yaml config file in your root, which you can get from me. This sets up your connection to Amazon S3 account.
|
33
|
+
|
34
|
+
## Options
|
35
|
+
naturecommits has some options for additional lulz. You can enable via
|
36
|
+
environment variables.
|
37
|
+
|
38
|
+
* TRANZLATE YOAR COMMIT_MSG TO LOLSPEKK - set
|
39
|
+
`naturecommits_TRANZLATE=1`.
|
40
|
+
|
41
|
+
|
42
|
+
<!--
|
43
|
+
## Upgrading from an old (non-gem) version?
|
44
|
+
If you used the autoinstaller, here's how to get rid of the old stuff (I think)
|
45
|
+
|
46
|
+
For all active lolrepos, go into them and do:
|
47
|
+
|
48
|
+
git hooks --uninstall
|
49
|
+
|
50
|
+
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`.
|
51
|
+
|
52
|
+
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:
|
53
|
+
|
54
|
+
rm /usr/local/bin/git-hooks
|
55
|
+
rm -rf ~/.git_hooks
|
56
|
+
rm -rf ~/.githooks_src
|
57
|
+
-->
|
data/Rakefile
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require 'rake/testtask'
|
3
|
+
|
4
|
+
Rake::TestTask.new do |t|
|
5
|
+
#t.libs << 'test'
|
6
|
+
t.test_files = Dir.glob('test/test_*.rb')
|
7
|
+
end
|
8
|
+
|
9
|
+
desc "Run tests"
|
10
|
+
task :default => :test
|
11
|
+
|
12
|
+
desc "Migrate an existing local .naturecommits directory to Dropbox"
|
13
|
+
task :dropboxify do
|
14
|
+
dropbox_loldir = "#{$home}/Dropbox/naturecommits"
|
15
|
+
loldir = "#{$home}/.naturecommits"
|
16
|
+
backup_loldir = "#{$home}/.naturecommits.old"
|
17
|
+
|
18
|
+
#check whether we've done this already
|
19
|
+
if File.symlink? loldir
|
20
|
+
abort "already dropboxified!"
|
21
|
+
end
|
22
|
+
|
23
|
+
#create dropbox folder
|
24
|
+
if not File.directory? dropbox_loldir
|
25
|
+
FileUtils.mkdir_p dropbox_loldir
|
26
|
+
end
|
27
|
+
|
28
|
+
#backup existing loldir
|
29
|
+
if File.directory? loldir
|
30
|
+
FileUtils.mv( loldir, backup_loldir )
|
31
|
+
end
|
32
|
+
|
33
|
+
#symlink dropbox to local
|
34
|
+
FileUtils.ln_s( dropbox_loldir, loldir )
|
35
|
+
|
36
|
+
#copy over existing files
|
37
|
+
FileUtils.cp_r( "#{backup_loldir}/.", loldir)
|
38
|
+
end
|
data/bin/naturecommits
ADDED
@@ -0,0 +1,184 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'naturecommits'
|
5
|
+
rescue LoadError
|
6
|
+
require 'rubygems'
|
7
|
+
require 'naturecommits'
|
8
|
+
end
|
9
|
+
|
10
|
+
include NATURECOMMITS
|
11
|
+
|
12
|
+
#
|
13
|
+
# CHECK FOR FURTHER DEPENDENCIES
|
14
|
+
#
|
15
|
+
|
16
|
+
# which replacement http://stackoverflow.com/q/2108727
|
17
|
+
def command?(name)
|
18
|
+
`which #{name}`
|
19
|
+
$?.success?
|
20
|
+
end
|
21
|
+
|
22
|
+
if is_mac?
|
23
|
+
# this dependency now satisfied with bundled copy of imagesnap
|
24
|
+
#if not command?('imagesnap')
|
25
|
+
# puts "Couldn't find imagesnap in your PATH!"
|
26
|
+
# puts "Easiest way to get it is to install homebrew and do `brew install imagesnap`"
|
27
|
+
# exit 1
|
28
|
+
#end
|
29
|
+
elsif is_linux?
|
30
|
+
if not command?('mplayer')
|
31
|
+
puts "Couldn't find mplayer in your PATH!"
|
32
|
+
exit 1
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
#
|
37
|
+
# NO ARGUMENTS SPECIFIED, HELP THE USER OUT
|
38
|
+
#
|
39
|
+
def do_noargs
|
40
|
+
#TODO: make this a contextual helper to know status of whether naturecommits is enabled
|
41
|
+
puts "Do what exactly?"
|
42
|
+
puts "Try: naturecommits --enable (when in a git repository)"
|
43
|
+
end
|
44
|
+
|
45
|
+
HOOK_PATH = File.join ".git", "hooks", "post-commit"
|
46
|
+
HOOK_DIR = File.join ".git", "hooks"
|
47
|
+
|
48
|
+
#
|
49
|
+
# IF --ENABLE, DO ENABLE
|
50
|
+
#
|
51
|
+
def do_enable
|
52
|
+
if not File.directory?(".git")
|
53
|
+
puts "You don't appear to be in the base directory of a git project."
|
54
|
+
exit 1
|
55
|
+
end
|
56
|
+
|
57
|
+
#its possible a hooks dir doesnt exist, so create it if so
|
58
|
+
if not File.directory?(HOOK_DIR)
|
59
|
+
Dir.mkdir(HOOK_DIR)
|
60
|
+
end
|
61
|
+
|
62
|
+
if File.exists? HOOK_PATH
|
63
|
+
puts "A post-commit hook already exists for this project."
|
64
|
+
#TODO: disambiguate between OUR post-commit hook and something else
|
65
|
+
exit 1
|
66
|
+
end
|
67
|
+
|
68
|
+
doc = "#!/bin/sh\nnaturecommits --capture\n"
|
69
|
+
File.open(HOOK_PATH, 'w') {|f| f.write(doc) }
|
70
|
+
FileUtils.chmod 0755, HOOK_PATH
|
71
|
+
puts "installed lolcommmit hook as:"
|
72
|
+
puts " -> #{File.expand_path(HOOK_PATH)}"
|
73
|
+
puts "(to remove later, you can use: naturecommits --disable)"
|
74
|
+
# we dont symlink, but rather install a small stub that calls the one from path
|
75
|
+
# that way, as gem version changes, script updates even if new file thus breaking symlink
|
76
|
+
end
|
77
|
+
|
78
|
+
#
|
79
|
+
# IF --DISABLE, DO DISABLE
|
80
|
+
#
|
81
|
+
def do_disable
|
82
|
+
if File.exists? HOOK_PATH
|
83
|
+
#TODO: check if hook file has been modified before removing
|
84
|
+
FileUtils.rm HOOK_PATH
|
85
|
+
puts "removed #{HOOK_PATH}"
|
86
|
+
else
|
87
|
+
puts "naturecommits is not enabled for this directory, so there is nothing to uninstall."
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
#
|
92
|
+
# IF --CAPTURE, DO CAPTURE
|
93
|
+
#
|
94
|
+
def do_capture
|
95
|
+
capture_delay = Choice.choices[:delay] || ENV['naturecommits_DELAY'] || 0
|
96
|
+
|
97
|
+
if Choice.choices[:test]
|
98
|
+
puts "*** capturing in test mode ***"
|
99
|
+
NATURECOMMITS.capture(capture_delay, true, Choice.choices[:msg], Choice.choices[:sha])
|
100
|
+
else
|
101
|
+
NATURECOMMITS.capture(capture_delay)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
#
|
106
|
+
# Command line parsing fun
|
107
|
+
#
|
108
|
+
Choice.options do
|
109
|
+
|
110
|
+
option :enable do
|
111
|
+
long "--enable"
|
112
|
+
short '-e'
|
113
|
+
action { do_enable }
|
114
|
+
desc "install naturecommits for this repo"
|
115
|
+
end
|
116
|
+
|
117
|
+
option :disable do
|
118
|
+
long "--disable"
|
119
|
+
short '-d'
|
120
|
+
action { do_disable }
|
121
|
+
desc "uninstall naturecommits for this repo"
|
122
|
+
end
|
123
|
+
|
124
|
+
option :capture do
|
125
|
+
long "--capture"
|
126
|
+
short '-c'
|
127
|
+
desc "capture lolcommit based on last git commit"
|
128
|
+
end
|
129
|
+
|
130
|
+
option :last do
|
131
|
+
long "--last"
|
132
|
+
short "-l"
|
133
|
+
desc "view the most recent lolcommit"
|
134
|
+
action do
|
135
|
+
Launchy.open NATURECOMMITS.most_recent
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
option :browse do
|
140
|
+
long "--browse"
|
141
|
+
short "-b"
|
142
|
+
desc "browse this repo's naturecommits"
|
143
|
+
action do
|
144
|
+
Launchy.open NATURECOMMITS.loldir
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
option :test do
|
149
|
+
long "--test"
|
150
|
+
desc "Run in test mode"
|
151
|
+
end
|
152
|
+
|
153
|
+
option :sha do
|
154
|
+
desc "pass SHA manually (for test only)"
|
155
|
+
long "--sha"
|
156
|
+
short '-s'
|
157
|
+
default "test-#{rand(10 ** 10)}"
|
158
|
+
end
|
159
|
+
|
160
|
+
option :msg do
|
161
|
+
desc "pass commit msg manually (for test only)"
|
162
|
+
long "--msg"
|
163
|
+
short '-m'
|
164
|
+
default "this is a test message i didnt really commit something"
|
165
|
+
end
|
166
|
+
|
167
|
+
option :delay do
|
168
|
+
long "--delay=SECONDS"
|
169
|
+
desc "delay taking of the snapshot by n seconds"
|
170
|
+
cast Integer
|
171
|
+
short '-w'
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
#
|
176
|
+
# Handle actions manually since choice seems weird
|
177
|
+
#
|
178
|
+
if not (Choice.choices[:enable] || Choice.choices[:disable] || Choice.choices[:last] || Choice.choices[:browse])
|
179
|
+
if Choice.choices[:capture]
|
180
|
+
do_capture()
|
181
|
+
else
|
182
|
+
do_noargs()
|
183
|
+
end
|
184
|
+
end
|