Permalink
Browse files

Merge pull request #214 from mroth/fix-last-option-to-includes-gifs

--last includes animated gifs, fixes issue #213
  • Loading branch information...
2 parents 9b3c2f8 + edde8e5 commit 8de0eafcad2723a993c1263055793649fed9a8ec @matthutchinson matthutchinson committed Jun 19, 2014
Showing with 6 additions and 6 deletions.
  1. +2 −2 bin/lolcommits
  2. +4 −4 lib/lolcommits/configuration.rb
View
4 bin/lolcommits
@@ -170,10 +170,10 @@ def do_gif
case Choice.choices[:gif]
when 'today'
- lolimages = configuration.images_today
+ lolimages = configuration.jpg_images_today
filename = "#{Date.today.to_s}.gif"
else
- lolimages = configuration.images
+ lolimages = configuration.jpg_images
filename = 'archive.gif'
end
View
8 lib/lolcommits/configuration.rb
@@ -41,15 +41,15 @@ def archivedir
end
def most_recent
- Dir.glob(File.join self.loldir, '*.jpg').max_by { |f| File.mtime(f) }
+ Dir.glob(File.join self.loldir, '*.{jpg,gif}').max_by { |f| File.mtime(f) }
end
- def images
+ def jpg_images
Dir.glob(File.join self.loldir, '*.jpg').sort_by { |f| File.mtime(f) }
end
- def images_today
- images.select { |f| Date.parse(File.mtime(f).to_s) === Date.today }
+ def jpg_images_today
+ jpg_images.select { |f| Date.parse(File.mtime(f).to_s) === Date.today }
end
def raw_image(image_file_type = 'jpg')

0 comments on commit 8de0eaf

Please sign in to comment.