lolcommits 0.4.3 → 0.4.4pre1

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 CHANGED
@@ -1,5 +1,6 @@
1
1
  0.4.4 (in development)
2
2
  * TODO: figure out problems with GUI clients
3
+ * add -g option to produce animated gifs! (thx @hSATAC, #95)
3
4
 
4
5
  0.4.3 (29 March 2013)
5
6
  * bump mini_magick dependency to deal with security alert
data/bin/lolcommits CHANGED
@@ -170,6 +170,31 @@ def do_last
170
170
  Launchy.open lolimage
171
171
  end
172
172
 
173
+ def do_gif
174
+ die_if_not_git_repo!
175
+
176
+ case Choice.choices[:gif]
177
+ when "today"
178
+ lolimages = configuration.images_today
179
+ filename = "#{Date.today.to_s}.gif"
180
+ else
181
+ lolimages = configuration.images
182
+ filename = "archive.gif"
183
+ end
184
+
185
+ if lolimages.empty?
186
+ warn "No lolcommits have been captured for this time yet."
187
+ exit 1
188
+ end
189
+
190
+ puts "*** Generating animated gif."
191
+
192
+ gif = MiniMagick::Image.new File.join configuration.archivedir, filename
193
+ gif.run_command("convert", "-delay 50 -loop 0 #{lolimages.join(' ')} #{gif.path}")
194
+
195
+ puts "*** #{gif.path} generated."
196
+ end
197
+
173
198
  #
174
199
  # Command line parsing fun
175
200
  #
@@ -272,6 +297,12 @@ Choice.options do
272
297
  desc "pass font file location"
273
298
  end
274
299
 
300
+ option :gif do
301
+ long "--gif"
302
+ short "-g"
303
+ desc "generate animated gif"
304
+ end
305
+
275
306
  end
276
307
 
277
308
  # Set debug level if needed
@@ -303,6 +334,8 @@ if not (Choice.choices[:enable] || Choice.choices[:disable])
303
334
  elsif Choice.choices[:browse]
304
335
  die_if_not_git_repo!
305
336
  Launchy.open configuration.loldir
337
+ elsif Choice.choices[:gif]
338
+ do_gif()
306
339
  else
307
340
  do_noargs()
308
341
  end
@@ -145,3 +145,17 @@ Feature: Basic UI functionality
145
145
  When I successfully run `git commit --allow-empty -m 'i hate \"air quotes\" dont you'`
146
146
  Then the exit status should be 0
147
147
  And there should be exactly 1 jpg in "../.lolcommits/shellz"
148
+
149
+ Scenario: generate gif should store in its own archive directory
150
+ Given I am in a git repository named "randomgitrepo" with lolcommits enabled
151
+ And a loldir named "randomgitrepo" with 2 lolimages
152
+ When I successfully run `lolcommits -g`
153
+ Then the output should contain "Generating animated gif."
154
+ And a directory named "../.lolcommits/randomgitrepo/archive" should exist
155
+ And a file named "../.lolcommits/randomgitrepo/archive/archive.gif" should exist
156
+
157
+ Scenario: generate gif with argument 'today'
158
+ Given I am in a git repository named "randomgitrepo" with lolcommits enabled
159
+ And a loldir named "randomgitrepo" with 2 lolimages
160
+ When I successfully run `lolcommits -g today`
161
+ And there should be exactly 1 gif in "../.lolcommits/randomgitrepo/archive"
@@ -1,6 +1,6 @@
1
1
  Feature: Plugins Work
2
2
 
3
- @slow_process
3
+ @slow_process @unstable
4
4
  Scenario: Lolcommits.com integration works
5
5
  Given I am in a git repository named "dot_com" with lolcommits enabled
6
6
  When I run `lolcommits --config` and wait for output
@@ -11,9 +11,9 @@ Given /^a git repository named "(.*?)"$/ do |repo_name|
11
11
  repo_dir = File.join current_dir, repo_name
12
12
  mkdir_p repo_dir
13
13
  Dir.chdir repo_dir do
14
- sh "git init --quiet ."
15
- sh "git config user.name 'Testy McTesterson'"
16
- sh "git config user.email 'testy@tester.com'"
14
+ system "git init --quiet ."
15
+ system "git config user.name 'Testy McTesterson'"
16
+ system "git config user.email 'testy@tester.com'"
17
17
  end
18
18
  end
19
19
 
@@ -64,8 +64,8 @@ When /^I enter "(.*?)" for "(.*?)"$/ do |input, field|
64
64
  @stdin.puts input
65
65
  end
66
66
 
67
- Then /^there should be (?:exactly|only) (.*?) jpg(?:s?) in "(.*?)"$/ do |n, folder|
68
- assert_equal n.to_i, Dir["#{current_dir}/#{folder}/*.jpg"].count
67
+ Then /^there should be (?:exactly|only) (.*?) (jpg|gif)(?:s?) in "(.*?)"$/ do |n, type, folder|
68
+ assert_equal n.to_i, Dir["#{current_dir}/#{folder}/*.#{type}"].count
69
69
  end
70
70
 
71
71
  Then /^the output should contain a list of plugins$/ do
@@ -86,7 +86,7 @@ Before('@fake-no-imagemagick') do
86
86
 
87
87
  @original_path = ENV['PATH']
88
88
  ENV['PATH'] = newpaths.join(File::PATH_SEPARATOR)
89
- puts ENV['PATH']
89
+ # puts ENV['PATH'] dont need to announce this for debug anymore!
90
90
  end
91
91
 
92
92
  After('@fake-no-imagemagick') do
data/lib/lolcommits.rb CHANGED
@@ -9,6 +9,7 @@ require 'active_support/inflector'
9
9
  require 'active_support/concern'
10
10
  require 'active_support/callbacks'
11
11
  require 'methadone'
12
+ require 'date'
12
13
 
13
14
  require 'lolcommits/version'
14
15
  require 'lolcommits/configuration'
@@ -45,6 +45,14 @@ module Lolcommits
45
45
  @loldir = Configuration.loldir_for(basename)
46
46
  end
47
47
 
48
+ def archivedir
49
+ dir = File.join(loldir, 'archive')
50
+ if not File.directory? dir
51
+ FileUtils.mkdir_p dir
52
+ end
53
+ dir
54
+ end
55
+
48
56
  def self.loldir_for(basename)
49
57
  loldir = File.join(LOLBASEDIR, basename)
50
58
 
@@ -55,7 +63,15 @@ module Lolcommits
55
63
  end
56
64
 
57
65
  def most_recent
58
- Dir.glob(File.join self.loldir, "*").max_by {|f| File.mtime(f)}
66
+ Dir.glob(File.join self.loldir, "*.jpg").max_by {|f| File.mtime(f)}
67
+ end
68
+
69
+ def images
70
+ Dir.glob(File.join self.loldir, "*.jpg").sort_by {|f| File.mtime(f)}
71
+ end
72
+
73
+ def images_today
74
+ images.select { |f| Date.parse(File.mtime(f).to_s) === Date.today }
59
75
  end
60
76
 
61
77
  def raw_image
@@ -105,9 +121,9 @@ module Lolcommits
105
121
 
106
122
  config = self.user_configuration || Hash.new
107
123
  config[plugin] = options
108
- File.open(self.user_configuration_file, 'w') do |f|
124
+ File.open(self.user_configuration_file, 'w') do |f|
109
125
  f.write(config.to_yaml)
110
- end
126
+ end
111
127
 
112
128
  puts "#{config.to_yaml}\n"
113
129
  puts "Successfully Configured"
@@ -1,3 +1,3 @@
1
1
  module Lolcommits
2
- VERSION = "0.4.3"
2
+ VERSION = "0.4.4pre1"
3
3
  end
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.3
5
- prerelease:
4
+ version: 0.4.4pre1
5
+ prerelease: 5
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-03-29 00:00:00.000000000 Z
12
+ date: 2013-05-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mini_magick
@@ -367,19 +367,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
367
367
  version: '0'
368
368
  segments:
369
369
  - 0
370
- hash: -4097628544408723624
370
+ hash: 2684250378401808879
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: '0'
377
- segments:
378
- - 0
379
- hash: -4097628544408723624
376
+ version: 1.3.1
380
377
  requirements: []
381
378
  rubyforge_project: lolcommits
382
- rubygems_version: 1.8.25
379
+ rubygems_version: 1.8.23
383
380
  signing_key:
384
381
  specification_version: 3
385
382
  summary: Capture webcam image on git commit for lulz.