lolcommits 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,11 @@
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 `LOLCOMMITS_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
+
1
9
  0.1.2 (22 April 2012)
2
10
  * provide licensing info for CommandCam (Windows)
3
11
  * bundle imagesnap as well to remove a dependency on Mac OS X
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 CHANGED
@@ -9,7 +9,7 @@ By default, the lolimages are stored by a Github style short SHA in a `~/.lolcom
9
9
  ## Installation (Mac OS X)
10
10
  You'll need ImageMagick installed. [Homebrew](http://mxcl.github.com/homebrew/) makes this easy. Simply do:
11
11
 
12
- brew install imagemagick
12
+ brew install imagemagick --from-source
13
13
 
14
14
  Then simply do:
15
15
 
@@ -26,7 +26,11 @@ Likewise, you can disable it via `lolcommits --disable`. For a full list of opt
26
26
  ## Installation (Linux)
27
27
  Install dependencies using your package manager of choice, for example in Ubuntu:
28
28
 
29
- sudo apt-get install mplayer imagemagick libmagick9-dev
29
+ sudo apt-get install mplayer imagemagick libmagickwand-dev
30
+
31
+ On Fedora, enable the rpmfusion repository (for mplayer) and run:
32
+
33
+ sudo yum install ImageMagick ImageMagick-devel mplayer
30
34
 
31
35
  Then install the lolcommits gem:
32
36
 
@@ -60,6 +64,15 @@ See the wiki page for [Installing on Windows](https://github.com/mroth/lolcommit
60
64
 
61
65
  Please add your own lolcommit! Add to the [People Using Lolcommits](https://github.com/mroth/lolcommits/wiki/People-Using-Lolcommits) page on the Wiki.
62
66
 
67
+ ## Options
68
+ lolcommits has some options for additional lulz. You can enable via
69
+ environment variables.
70
+
71
+ * TRANZLATE YOAR COMMIT_MSG TO LOLSPEKK - set
72
+ `LOLCOMMITS_TRANZLATE=1`.
73
+
74
+ ## Troubles?
75
+ Started a [FAQ](https://github.com/mroth/lolcommits/wiki/FAQ).
63
76
 
64
77
  <!--
65
78
  ## Upgrading from an old (non-gem) version?
data/bin/lolcommits CHANGED
@@ -43,15 +43,22 @@ def do_noargs
43
43
  end
44
44
 
45
45
  HOOK_PATH = File.join ".git", "hooks", "post-commit"
46
+ HOOK_DIR = File.join ".git", "hooks"
46
47
 
47
48
  #
48
49
  # IF --ENABLE, DO ENABLE
49
50
  #
50
51
  def do_enable
51
- if not File.directory?(File.join ".git", "hooks")
52
+ if not File.directory?(".git")
52
53
  puts "You don't appear to be in the base directory of a git project."
53
54
  exit 1
54
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
+
55
62
  if File.exists? HOOK_PATH
56
63
  puts "A post-commit hook already exists for this project."
57
64
  #TODO: disambiguate between OUR post-commit hook and something else
@@ -116,7 +123,7 @@ Choice.options do
116
123
 
117
124
  option :capture do
118
125
  long "--capture"
119
- short 'c'
126
+ short '-c'
120
127
  desc "capture lolcommit based on last git commit"
121
128
  end
122
129
 
data/lib/lolcommits.rb CHANGED
@@ -1,4 +1,7 @@
1
+ $:.unshift File.expand_path('.')
2
+
1
3
  require "lolcommits/version"
4
+ require "tranzlate/lolspeak"
2
5
  require "choice"
3
6
  require "fileutils"
4
7
  require "git"
@@ -59,6 +62,13 @@ module Lolcommits
59
62
  loldir = File.join LOLBASEDIR, "test"
60
63
  end
61
64
 
65
+ #
66
+ # lolspeak translate the message
67
+ #
68
+ if (ENV['LOLCOMMITS_TRANZLATE'] == '1' || false)
69
+ commit_msg = commit_msg.tranzlate
70
+ end
71
+
62
72
  #
63
73
  # Create a directory to hold the lolimages
64
74
  #
@@ -86,7 +96,7 @@ module Lolcommits
86
96
 
87
97
  # mplayer's output is ugly and useless, let's throw it away
88
98
  _, r, _ = Open3.popen3("mplayer -vo jpeg:outdir=#{tmpdir} -frames #{frames} tv://")
89
- # looks like we still need to read the outpot for something to happen
99
+ # looks like we still need to read the output for something to happen
90
100
  r.read
91
101
  FileUtils.mv(tmpdir + "/%08d.jpg" % frames, snapshot_loc)
92
102
  FileUtils.rm_rf( tmpdir )
@@ -128,7 +138,7 @@ module Lolcommits
128
138
 
129
139
  # convenience method for word wrapping
130
140
  # based on https://github.com/cmdrkeene/memegen/blob/master/lib/meme_generator.rb
131
- def word_wrap(text, col = 28)
141
+ def word_wrap(text, col = 27)
132
142
  wrapped = text.gsub(/(.{1,#{col + 4}})(\s+|\Z)/, "\\1\n")
133
143
  wrapped.chomp!
134
144
  end
@@ -142,7 +152,7 @@ module Lolcommits
142
152
  draw.annotate(canvas, 0, 0, 0, 0, word_wrap(commit_msg)) do
143
153
  self.gravity = SouthWestGravity
144
154
  self.pointsize = 48
145
- self.interline_spacing = -(48 / 5)
155
+ self.interline_spacing = -(48 / 5) if self.respond_to?(:interline_spacing)
146
156
  self.stroke_width = 2
147
157
  end
148
158
 
@@ -157,8 +167,5 @@ module Lolcommits
157
167
  if is_test
158
168
  Launchy.open(File.join loldir, "#{commit_sha}.jpg")
159
169
  end
160
-
161
-
162
170
  end
163
-
164
171
  end
@@ -1,3 +1,3 @@
1
1
  module Lolcommits
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -0,0 +1,101 @@
1
+ # Adapted and expanded from moar-lolspeak (https://github.com/rwtnorton/moar-lolspeak), which was
2
+ # largely taken from an old Perl script and is sadly is not available via rubygems
3
+
4
+ module Lolspeak
5
+ LOL_DICTIONARY = {
6
+ /what/ => %w{wut whut},
7
+ /you\b/ => %w{yu yous yoo u yooz},
8
+ /cture/ => %w{kshur},
9
+ /ss\b/ => %w{s zz z},
10
+ /the\b/ => %w{teh},
11
+ /more/ => %w{moar},
12
+ /my/ => %w{mah mai},
13
+ /are/ => %w{is ar},
14
+ /eese/ => %w{eez},
15
+ /ph/ => %w{f},
16
+ /as\b/ => %w{az},
17
+ /seriously/ => %w{srsly},
18
+ /sion/ => %w{shun},
19
+ /just/ => %w{jus},
20
+ /ose\b/ => %w{oze},
21
+ /eady/ => %w{eddy},
22
+ /ome?\b/ => %w{um},
23
+ /of\b/ => %w{of ov of},
24
+ /uestion/ => %w{wesjun},
25
+ /want/ => %w{wants},
26
+ /ead\b/ => %w{edd},
27
+ /ck/ => %w{kk kkk},
28
+ /sion/ => %w{shun},
29
+ /cat|kitten|kitty/ => %w{kitteh kittehz cat fuzzeh fuzzyrumpus foozles fuzzbut fluffernutter beast mew},
30
+ /eak/ => %w{ekk},
31
+ /age/ => %w{uj},
32
+ /like/ => %w{likez liek licks},
33
+ /love/ => %w{lovez lub lubs luv lurve lurves},
34
+ /\bis\b/ => ['ar teh','ar'],
35
+ /nd\b/ => %w{n n'},
36
+ /who/ => %w{hoo},
37
+ /'/ => [''],
38
+ /ese\b/ => %w{eez},
39
+ /outh/ => %w{owf},
40
+ /scio/ => %w{shu},
41
+ /esque/ => %w{esk},
42
+ /ture/ => %w{chur},
43
+ /\btoo?\b/ => %w{to t 2 to t},
44
+ /tious/ => %w{shus},
45
+ /sure\b/ => %w{shur},
46
+ /tty\b/ => %w{tteh},
47
+ /were/ => %w{was},
48
+ /ok\b|okay/ => %w{kthxbye!},
49
+ /\ba\b/ => %w{uh},
50
+ /ym/ => %w{im},
51
+ /fish/ => %w{ghoti},
52
+ /thy\b/ => %w{fee},
53
+ /\wly\w/ => %w{li},
54
+ /que\w/ => %w{kwe},
55
+ /\both/ => %w{udd},
56
+ /though\b/ => %w{tho},
57
+ /(t|r|en)ough/ => %w{\1uff},
58
+ /ought/ => %w{awt},
59
+ /ease/ => %w{eez},
60
+ /ing\b/ => %w{in ins ng ing in'},
61
+ /have/ => ['haz', 'hav', 'haz a'],
62
+ /has/ => %w{haz gots},
63
+ /your/ => %w{yur ur yore yoar},
64
+ /ove\b/ => %w{oov ove uuv uv oove},
65
+ /for/ => %w{for 4 fr fur for foar},
66
+ /thank/ => %w{fank tank thx thnx},
67
+ /good/ => %w{gud goed guud gude gewd goot gut},
68
+ /really/ => %w{rly rily rilly rilleh},
69
+ /world/ => %w{wurrld whirld wurld wrld},
70
+ /i'?m\b/ => ['im', 'i yam', 'i iz'],
71
+ /(?!e)ight/ => %w{ite},
72
+ /(?!ues)tion/ => %w{shun},
73
+ /you'?re/ => %w{yore yr},
74
+ /can\si\s(?:ple(?:a|e)(?:s|z)e?)?\s?have\sa/ => ['i can haz'],
75
+ /(?:hello|\bhi\b|\bhey\b|howdy|\byo\b),?/ => ['oh hai,'],
76
+ /(?:god\b|allah|buddah?|diety|lord)/ => ['ceiling cat'],
77
+ /er\b|are|ere/ => %w{r},
78
+ /y\b|ey\b/ => %w{eh},
79
+ /ea/ => %w{ee},
80
+ }
81
+
82
+ def self.tranzlate(str)
83
+ lolstr = str.dup
84
+ LOL_DICTIONARY.each do |english, lolspeak|
85
+ lolstr.gsub!(english, lolspeak.sample)
86
+ end
87
+
88
+ lolstr << '! kthxbye!' if rand(10) == 2
89
+ lolstr.gsub!(/(\?|!|,|\.)+/, '!')
90
+
91
+ lolstr.upcase
92
+ end
93
+ end
94
+
95
+ class String
96
+ unless method_defined?(:tranzlate)
97
+ def tranzlate
98
+ Lolspeak.tranzlate(self)
99
+ end
100
+ end
101
+ end
data/lolcommits.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.homepage = "http://github.com/mroth/lolcommits"
11
11
  s.summary = %q{Capture webcam image on git commit for lulz.}
12
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
+ s.license = "LGPL-3"
14
14
  s.rubyforge_project = "lolcommits"
15
15
 
16
16
  s.files = `git ls-files`.split("\n")
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.2
4
+ version: 0.1.3
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-04-22 00:00:00.000000000 Z
12
+ date: 2012-05-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -105,6 +105,7 @@ files:
105
105
  - .travis.yml
106
106
  - CHANGELOG
107
107
  - Gemfile
108
+ - LICENSE
108
109
  - README.md
109
110
  - Rakefile
110
111
  - bin/lolcommits
@@ -116,10 +117,12 @@ files:
116
117
  - fonts/Impact.ttf
117
118
  - lib/lolcommits.rb
118
119
  - lib/lolcommits/version.rb
120
+ - lib/tranzlate/lolspeak.rb
119
121
  - lolcommits.gemspec
120
122
  - test/test_lolcommits.rb
121
123
  homepage: http://github.com/mroth/lolcommits
122
- licenses: []
124
+ licenses:
125
+ - LGPL-3
123
126
  post_install_message:
124
127
  rdoc_options: []
125
128
  require_paths: