lolcommits 0.4.1pre2 → 0.4.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/CHANGELOG +9 -2
- data/README.md +1 -0
- data/Rakefile +2 -1
- data/bin/lolcommits +15 -2
- data/features/bugs.feature +10 -2
- data/features/plugins.feature +1 -0
- data/features/support/env.rb +42 -1
- data/lib/lolcommits/capturer.rb +1 -1
- data/lib/lolcommits/configuration.rb +23 -0
- data/lib/lolcommits/plugins/loltext.rb +5 -3
- data/lib/lolcommits/runner.rb +9 -7
- data/lib/lolcommits/version.rb +1 -1
- data/lolcommits.gemspec +2 -2
- metadata +15 -12
data/CHANGELOG
CHANGED
@@ -1,5 +1,12 @@
|
|
1
|
-
0.4.
|
2
|
-
*
|
1
|
+
0.4.2 (in development)
|
2
|
+
* TODO: figure out problems with GUI clients
|
3
|
+
* TODO: figure out ruby 2.0 compatibility and testing
|
4
|
+
|
5
|
+
0.4.1 (17 February 2013)
|
6
|
+
* add lolsrv plugin (thx @sebastianmarr!, #82)
|
7
|
+
* enable feature to change font (thx @fukayatsu!, #89)
|
8
|
+
* correct activesupport gem name in bundle (thx @djbender!, #90)
|
9
|
+
* graceful detection of imagemagick not being installed (#87)
|
3
10
|
* restructure logging slightly to use Methadone::CLILogging in most places
|
4
11
|
* add a bunch of debugging output, viewable via --debug flag
|
5
12
|
|
data/README.md
CHANGED
@@ -56,6 +56,7 @@ environment variables.
|
|
56
56
|
* Set webcam device on mac - set `LOLCOMMITS_DEVICE` environment variable.
|
57
57
|
* Set delay persistently (for slow to warmup webcams) - set
|
58
58
|
`LOLCOMMITS_DELAY` var to time in seconds.
|
59
|
+
* Set font file location - set `LOLCOMMITS_FONT` environment variable.
|
59
60
|
|
60
61
|
For the full list, see the [configuration variables](https://github.com/mroth/lolcommits/wiki/Configuration-Variables).
|
61
62
|
|
data/Rakefile
CHANGED
@@ -22,7 +22,8 @@ CUKE_RESULTS = 'results.html'
|
|
22
22
|
CLEAN << CUKE_RESULTS
|
23
23
|
Cucumber::Rake::Task.new(:features) do |t|
|
24
24
|
optstr = "features --format html -o #{CUKE_RESULTS} --format Fivemat -x"
|
25
|
-
optstr << "
|
25
|
+
optstr << " --tags @#{ENV["tag"]}" unless ENV["tag"].nil?
|
26
|
+
optstr << " --tags ~@unstable" if ENV["tag"].nil? #ignore unstable tests unless specifying something at CLI
|
26
27
|
t.cucumber_opts = optstr
|
27
28
|
t.fork = false
|
28
29
|
end
|
data/bin/lolcommits
CHANGED
@@ -39,6 +39,10 @@ unless File.readable? File.join(Configuration::LOLCOMMITS_ROOT, "vendor", "fonts
|
|
39
39
|
fatal "Couldn't properly read Impact font from gem package, please file a bug?!"
|
40
40
|
exit 1
|
41
41
|
end
|
42
|
+
unless Configuration.valid_imagemagick_installed?
|
43
|
+
fatal "FATAL: ImageMagick does not appear to be properly installed!"
|
44
|
+
exit 1
|
45
|
+
end
|
42
46
|
|
43
47
|
def die_if_not_git_repo!
|
44
48
|
begin
|
@@ -121,6 +125,7 @@ end
|
|
121
125
|
def do_capture
|
122
126
|
capture_delay = Choice.choices[:delay] || ENV['LOLCOMMITS_DELAY'] || 0
|
123
127
|
capture_device = Choice.choices[:device] || ENV['LOLCOMMITS_DEVICE'] || nil
|
128
|
+
capture_font = Choice.choices[:font] || ENV['LOLCOMMITS_FONT'] || nil
|
124
129
|
|
125
130
|
if Choice.choices[:test]
|
126
131
|
info "*** Capturing in test mode."
|
@@ -128,7 +133,8 @@ def do_capture
|
|
128
133
|
:capture_device => capture_device,
|
129
134
|
:message => Choice.choices[:msg],
|
130
135
|
:sha => Choice.choices[:sha],
|
131
|
-
:config => configuration
|
136
|
+
:config => configuration,
|
137
|
+
:font => capture_font
|
132
138
|
)
|
133
139
|
runner.run
|
134
140
|
|
@@ -136,7 +142,8 @@ def do_capture
|
|
136
142
|
else
|
137
143
|
runner = Lolcommits::Runner.new(:capture_delay => capture_delay,
|
138
144
|
:capture_device => capture_device,
|
139
|
-
:config => configuration
|
145
|
+
:config => configuration,
|
146
|
+
:font => capture_font
|
140
147
|
)
|
141
148
|
runner.run
|
142
149
|
end
|
@@ -252,6 +259,12 @@ Choice.options do
|
|
252
259
|
desc "Output debugging information"
|
253
260
|
end
|
254
261
|
|
262
|
+
option :font do
|
263
|
+
long "--font=FONT_PATH"
|
264
|
+
short "-f"
|
265
|
+
desc "pass font file location"
|
266
|
+
end
|
267
|
+
|
255
268
|
end
|
256
269
|
|
257
270
|
# Set debug level if needed
|
data/features/bugs.feature
CHANGED
@@ -15,7 +15,7 @@ Feature: Bug regression testing
|
|
15
15
|
#
|
16
16
|
# issue #68, https://github.com/mroth/lolcommits/issues/68
|
17
17
|
#
|
18
|
-
@fake-interactive-rebase @slow_process
|
18
|
+
@fake-interactive-rebase @slow_process @unstable
|
19
19
|
Scenario: Don't trigger capture during a git rebase
|
20
20
|
Given I am in a git repository named "yuh8history" with lolcommits enabled
|
21
21
|
And I do 6 git commits
|
@@ -36,4 +36,12 @@ Feature: Bug regression testing
|
|
36
36
|
Scenario: don't want to see initialized constant warning from Faraday on CLI (on MRI 1.8.7)
|
37
37
|
When I successfully run `lolcommits`
|
38
38
|
Then the output should not contain "warning: already initialized constant DEFAULT_BOUNDARY"
|
39
|
-
|
39
|
+
|
40
|
+
#
|
41
|
+
# issue #87, https://github.com/mroth/lolcommits/issues/87
|
42
|
+
#
|
43
|
+
@fake-no-imagemagick
|
44
|
+
Scenario: gracefully fail when imagemagick is not installed
|
45
|
+
When I run `lolcommits`
|
46
|
+
Then the output should contain "ImageMagick does not appear to be properly installed"
|
47
|
+
And the exit status should be 1
|
data/features/plugins.feature
CHANGED
data/features/support/env.rb
CHANGED
@@ -4,6 +4,8 @@ require 'open3'
|
|
4
4
|
require 'test/unit/assertions'
|
5
5
|
include Test::Unit::Assertions
|
6
6
|
require 'faker'
|
7
|
+
require 'lolcommits/configuration'
|
8
|
+
include Lolcommits
|
7
9
|
|
8
10
|
ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
|
9
11
|
LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')
|
@@ -49,5 +51,44 @@ After('@fake-interactive-rebase') do
|
|
49
51
|
end
|
50
52
|
|
51
53
|
Before('@slow_process') do
|
52
|
-
@aruba_io_wait_seconds =
|
54
|
+
@aruba_io_wait_seconds = 5
|
55
|
+
@aruba_timeout_seconds = 60
|
53
56
|
end
|
57
|
+
|
58
|
+
# adjust the path so tests dont see a global imagemagick install
|
59
|
+
Before('@fake-no-imagemagick') do
|
60
|
+
|
61
|
+
# make a new subdir that still contains git and mplayer
|
62
|
+
tmpbindir = File.expand_path(File.join @dirs, "bin")
|
63
|
+
FileUtils.mkdir_p tmpbindir
|
64
|
+
["git","mplayer"].each do |cmd|
|
65
|
+
whichcmd = Lolcommits::Configuration.command_which(cmd)
|
66
|
+
unless whichcmd.nil?
|
67
|
+
FileUtils.ln_s whichcmd, File.join(tmpbindir, File.basename(whichcmd))
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# use a modified version of Configuration::command_which to detect where IM is installed
|
72
|
+
# and remove that from the path
|
73
|
+
cmd = 'mogrify'
|
74
|
+
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
75
|
+
newpaths = ENV['PATH'].split(File::PATH_SEPARATOR).reject do |path|
|
76
|
+
found_cmd = false
|
77
|
+
exts.each { |ext|
|
78
|
+
exe = "#{path}/#{cmd}#{ext}"
|
79
|
+
found_cmd = true if File.executable? exe
|
80
|
+
}
|
81
|
+
found_cmd
|
82
|
+
end
|
83
|
+
|
84
|
+
# add the temporary directory with git in it back into the path
|
85
|
+
newpaths << tmpbindir
|
86
|
+
|
87
|
+
@original_path = ENV['PATH']
|
88
|
+
ENV['PATH'] = newpaths.join(File::PATH_SEPARATOR)
|
89
|
+
puts ENV['PATH']
|
90
|
+
end
|
91
|
+
|
92
|
+
After('@fake-no-imagemagick') do
|
93
|
+
ENV['PATH'] = @original_path
|
94
|
+
end
|
data/lib/lolcommits/capturer.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Lolcommits
|
2
2
|
class Capturer
|
3
3
|
include Methadone::CLILogging
|
4
|
-
attr_accessor :capture_device, :capture_delay, :snapshot_location
|
4
|
+
attr_accessor :capture_device, :capture_delay, :snapshot_location, :font
|
5
5
|
|
6
6
|
def initialize(attributes = Hash.new)
|
7
7
|
attributes.each do |attr, val|
|
@@ -129,5 +129,28 @@ module Lolcommits
|
|
129
129
|
(ENV['LOLCOMMITS_FAKECAPTURE'] == '1' || false)
|
130
130
|
end
|
131
131
|
|
132
|
+
def self.valid_imagemagick_installed?
|
133
|
+
return false unless self.command_which('identify')
|
134
|
+
return false unless self.command_which('mogrify')
|
135
|
+
# you'd expect the below to work on its own, but it only handles old versions
|
136
|
+
# and will throw an exception if IM is not installed in PATH
|
137
|
+
MiniMagick::valid_version_installed?
|
138
|
+
end
|
139
|
+
|
140
|
+
# Cross-platform way of finding an executable in the $PATH.
|
141
|
+
# idea taken from http://bit.ly/qDaTbY
|
142
|
+
#
|
143
|
+
# which('ruby') #=> /usr/bin/ruby
|
144
|
+
def self.command_which(cmd)
|
145
|
+
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
146
|
+
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
147
|
+
exts.each { |ext|
|
148
|
+
exe = "#{path}/#{cmd}#{ext}"
|
149
|
+
return exe if File.executable? exe
|
150
|
+
}
|
151
|
+
end
|
152
|
+
return nil
|
153
|
+
end
|
154
|
+
|
132
155
|
end
|
133
156
|
end
|
@@ -4,6 +4,8 @@ module Lolcommits
|
|
4
4
|
def initialize(runner)
|
5
5
|
super
|
6
6
|
|
7
|
+
@font_location = runner ? runner.font : nil
|
8
|
+
|
7
9
|
self.name = 'loltext'
|
8
10
|
self.default = true
|
9
11
|
end
|
@@ -14,7 +16,7 @@ module Lolcommits
|
|
14
16
|
|
15
17
|
# use minimagick wrapper
|
16
18
|
def mm_run
|
17
|
-
font_location = File.join(Configuration::LOLCOMMITS_ROOT, "vendor", "fonts", "Impact.ttf")
|
19
|
+
font_location = @font_location || File.join(Configuration::LOLCOMMITS_ROOT, "vendor", "fonts", "Impact.ttf")
|
18
20
|
|
19
21
|
plugdebug "Annotating image via MiniMagick"
|
20
22
|
image = MiniMagick::Image.open(self.runner.main_image)
|
@@ -76,12 +78,12 @@ module Lolcommits
|
|
76
78
|
escape_quotes wrapped_text
|
77
79
|
end
|
78
80
|
|
79
|
-
# conversion for quotation marks to avoid shell interpretation
|
81
|
+
# conversion for quotation marks to avoid shell interpretation
|
80
82
|
# does not seem to be a safe way to escape cross-platform?
|
81
83
|
def escape_quotes(text)
|
82
84
|
text.gsub(/"/, "''")
|
83
85
|
end
|
84
|
-
|
86
|
+
|
85
87
|
# convenience method for word wrapping
|
86
88
|
# based on https://github.com/cmdrkeene/memegen/blob/master/lib/meme_generator.rb
|
87
89
|
def word_wrap(text, col = 27)
|
data/lib/lolcommits/runner.rb
CHANGED
@@ -3,8 +3,9 @@ module Lolcommits
|
|
3
3
|
|
4
4
|
class Runner
|
5
5
|
attr_accessor :capture_delay, :capture_device, :message, :sha,
|
6
|
-
:snapshot_loc, :main_image, :repo, :config, :repo_internal_path
|
7
|
-
|
6
|
+
:snapshot_loc, :main_image, :repo, :config, :repo_internal_path,
|
7
|
+
:font
|
8
|
+
|
8
9
|
include Methadone::CLILogging
|
9
10
|
include ActiveSupport::Callbacks
|
10
11
|
define_callbacks :run
|
@@ -24,7 +25,7 @@ module Lolcommits
|
|
24
25
|
attributes.each do |attr, val|
|
25
26
|
self.send("#{attr}=", val)
|
26
27
|
end
|
27
|
-
|
28
|
+
|
28
29
|
if self.sha.nil? || self.message.nil?
|
29
30
|
git_info = GitInfo.new
|
30
31
|
self.sha = git_info.sha if self.sha.nil?
|
@@ -41,9 +42,10 @@ module Lolcommits
|
|
41
42
|
self.snapshot_loc = self.config.raw_image
|
42
43
|
self.main_image = self.config.main_image(self.sha)
|
43
44
|
capturer = "Lolcommits::Capture#{Configuration.platform}".constantize.new(
|
44
|
-
:capture_device => self.capture_device,
|
45
|
-
:capture_delay => self.capture_delay,
|
46
|
-
:snapshot_location => self.snapshot_loc
|
45
|
+
:capture_device => self.capture_device,
|
46
|
+
:capture_delay => self.capture_delay,
|
47
|
+
:snapshot_location => self.snapshot_loc,
|
48
|
+
:font => self.font
|
47
49
|
)
|
48
50
|
capturer.capture
|
49
51
|
resize_snapshot!
|
@@ -86,7 +88,7 @@ module Lolcommits
|
|
86
88
|
FileUtils.rm(self.snapshot_loc)
|
87
89
|
end
|
88
90
|
|
89
|
-
# register a method called "execute_lolcommits_#{plugin_name}"
|
91
|
+
# register a method called "execute_lolcommits_#{plugin_name}"
|
90
92
|
# for each subclass of plugin. these methods should be used as
|
91
93
|
# callbacks to the run method.
|
92
94
|
Lolcommits::PLUGINS.each do |plugin|
|
data/lib/lolcommits/version.rb
CHANGED
data/lolcommits.gemspec
CHANGED
@@ -22,10 +22,10 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_runtime_dependency('mini_magick', '~> 3.4')
|
23
23
|
s.add_runtime_dependency('git', '~> 1.2.5')
|
24
24
|
s.add_runtime_dependency('choice', '~> 0.1.6')
|
25
|
-
s.add_runtime_dependency('launchy', '~> 2.
|
25
|
+
s.add_runtime_dependency('launchy', '~> 2.2.0')
|
26
26
|
s.add_runtime_dependency('methadone', '~> 1.2.4')
|
27
27
|
s.add_runtime_dependency('open4', '~> 1.3.0')
|
28
|
-
s.add_runtime_dependency('
|
28
|
+
s.add_runtime_dependency('activesupport', '~> 3.2.12')
|
29
29
|
|
30
30
|
# development dependencies
|
31
31
|
s.add_development_dependency('rdoc')
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lolcommits
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
5
|
-
prerelease:
|
4
|
+
version: 0.4.1
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Matthew Rothenberg
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mini_magick
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
requirements:
|
67
67
|
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 2.
|
69
|
+
version: 2.2.0
|
70
70
|
type: :runtime
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -74,7 +74,7 @@ dependencies:
|
|
74
74
|
requirements:
|
75
75
|
- - ~>
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: 2.
|
77
|
+
version: 2.2.0
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
79
|
name: methadone
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,13 +108,13 @@ dependencies:
|
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: 1.3.0
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
|
-
name:
|
111
|
+
name: activesupport
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
113
113
|
none: false
|
114
114
|
requirements:
|
115
115
|
- - ~>
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 3.
|
117
|
+
version: 3.2.12
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -122,7 +122,7 @@ dependencies:
|
|
122
122
|
requirements:
|
123
123
|
- - ~>
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version: 3.
|
125
|
+
version: 3.2.12
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
127
|
name: rdoc
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|
@@ -367,16 +367,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
367
367
|
version: '0'
|
368
368
|
segments:
|
369
369
|
- 0
|
370
|
-
hash:
|
370
|
+
hash: 4513374714395710926
|
371
371
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
372
372
|
none: false
|
373
373
|
requirements:
|
374
|
-
- - ! '
|
374
|
+
- - ! '>='
|
375
375
|
- !ruby/object:Gem::Version
|
376
|
-
version:
|
376
|
+
version: '0'
|
377
|
+
segments:
|
378
|
+
- 0
|
379
|
+
hash: 4513374714395710926
|
377
380
|
requirements: []
|
378
381
|
rubyforge_project: lolcommits
|
379
|
-
rubygems_version: 1.8.
|
382
|
+
rubygems_version: 1.8.25
|
380
383
|
signing_key:
|
381
384
|
specification_version: 3
|
382
385
|
summary: Capture webcam image on git commit for lulz.
|