Class: Lolcommits::CLI::TimelapseGif
- Inherits:
-
Object
- Object
- Lolcommits::CLI::TimelapseGif
- Defined in:
- lib/lolcommits/cli/timelapse_gif.rb
Overview
Creates an animated timeline GIF of lolcommits history.
Instance Method Summary collapse
-
#initialize(loldir) ⇒ TimelapseGif
constructor
param loldir [String] path to loldir.
-
#run(args = nil) ⇒ Object
Runs the history timeline animator task thingy param args [String] the arg passed to the gif command on CLI (optional).
Constructor Details
#initialize(loldir) ⇒ TimelapseGif
param loldir [String] path to loldir
11 12 13 |
# File 'lib/lolcommits/cli/timelapse_gif.rb', line 11 def initialize(loldir) self.loldir = loldir end |
Instance Method Details
#run(args = nil) ⇒ Object
Runs the history timeline animator task thingy param args [String] the arg passed to the gif command on CLI (optional)
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/lolcommits/cli/timelapse_gif.rb', line 17 def run(args = nil) case args when 'today' lolimages = jpg_images_today filename = Date.today.to_s else lolimages = jpg_images filename = "all-until-#{Time.now.strftime('%d-%b-%Y--%Hh%Mm%Ss')}" end if lolimages.empty? warn 'No lolcommits have been captured for this time yet.' exit 1 end puts '*** Generating animated timelapse gif.' MiniMagick.convert do |convert| convert.delay 50 convert.loop 0 lolimages.each { |image| convert << image } convert << File.join(timelapses_dir_path, "#{filename}.gif") end puts "*** Done, generated at #{gif.path}" end |