Class: Lolcommits::Runner

Inherits:
Object
  • Object
show all
Includes:
ActiveSupport::Callbacks, Methadone::CLILogging
Defined in:
lib/lolcommits/runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Runner

Executed First



23
24
25
26
27
28
29
30
31
32
33
34
35
# 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

Instance Attribute Details

#capture_animateObject

Returns the value of attribute capture_animate.



5
6
7
# File 'lib/lolcommits/runner.rb', line 5

def capture_animate
  @capture_animate
end

#capture_delayObject

Returns the value of attribute capture_delay.



5
6
7
# File 'lib/lolcommits/runner.rb', line 5

def capture_delay
  @capture_delay
end

#capture_deviceObject

Returns the value of attribute capture_device.



5
6
7
# File 'lib/lolcommits/runner.rb', line 5

def capture_device
  @capture_device
end

#capture_stealthObject

Returns the value of attribute capture_stealth.



5
6
7
# File 'lib/lolcommits/runner.rb', line 5

def capture_stealth
  @capture_stealth
end

#configObject

Returns the value of attribute config.



5
6
7
# File 'lib/lolcommits/runner.rb', line 5

def config
  @config
end

#fontObject

Returns the value of attribute font.



5
6
7
# File 'lib/lolcommits/runner.rb', line 5

def font
  @font
end

#main_imageObject

Returns the value of attribute main_image.



5
6
7
# File 'lib/lolcommits/runner.rb', line 5

def main_image
  @main_image
end

#messageObject

Returns the value of attribute message.



5
6
7
# File 'lib/lolcommits/runner.rb', line 5

def message
  @message
end

#repoObject

Returns the value of attribute repo.



5
6
7
# File 'lib/lolcommits/runner.rb', line 5

def repo
  @repo
end

#repo_internal_pathObject

Returns the value of attribute repo_internal_path.



5
6
7
# File 'lib/lolcommits/runner.rb', line 5

def repo_internal_path
  @repo_internal_path
end

#shaObject

Returns the value of attribute sha.



5
6
7
# File 'lib/lolcommits/runner.rb', line 5

def sha
  @sha
end

#snapshot_locObject

Returns the value of attribute snapshot_loc.



5
6
7
# File 'lib/lolcommits/runner.rb', line 5

def snapshot_loc
  @snapshot_loc
end

Instance Method Details

#animate?Boolean



58
59
60
# File 'lib/lolcommits/runner.rb', line 58

def animate?
  capture_animate && (capture_animate.to_i > 0)
end

#runObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# 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