class Lolcommits::Runner

Attributes

capture_animate[RW]
capture_delay[RW]
capture_device[RW]
capture_stealth[RW]
config[RW]
font[RW]
main_image[RW]
message[RW]
repo[RW]
repo_internal_path[RW]
sha[RW]
snapshot_loc[RW]

Public Class Methods

new(attributes={}) click to toggle source

Executed First

# File lib/lolcommits/runner.rb, line 23
def initialize(attributes={})
  attributes.each do |attr, val|
    self.send("#{attr}=", val)
  end

  if self.sha.nil? || self.message.nil?
    git_info = GitInfo.new
    self.sha = git_info.sha if self.sha.nil?
    self.message = git_info.message if self.message.nil?
    self.repo_internal_path = git_info.repo_internal_path
    self.repo = git_info.repo
  end
end

Public Instance Methods

animate?() click to toggle source
# File lib/lolcommits/runner.rb, line 58
def animate?
  capture_animate && (capture_animate.to_i > 0)
end
run() click to toggle source
# File lib/lolcommits/runner.rb, line 37
def run
  die_if_rebasing!

  run_callbacks :run do
    puts "*** Preserving this moment in history." unless capture_stealth
    self.snapshot_loc = self.config.raw_image(image_file_type)
    self.main_image   = self.config.main_image(self.sha, image_file_type)
    capturer = capturer_class.new(
      :capture_device    => self.capture_device,
      :capture_delay     => self.capture_delay,
      :snapshot_location => self.snapshot_loc,
      :font              => self.font,
      :video_location    => self.config.video_loc,
      :frames_location   => self.config.frames_loc,
      :animated_duration => self.capture_animate
    )
    capturer.capture
    resize_snapshot!
  end
end

Private Instance Methods

capturer_class() click to toggle source
# File lib/lolcommits/runner.rb, line 63
def capturer_class
  "Lolcommits::Capture#{Configuration.platform}#{animate? ? 'Animated' : nil}".constantize
end
image_file_type() click to toggle source
# File lib/lolcommits/runner.rb, line 67
def image_file_type
  animate? ? 'gif' : 'jpg'
end