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



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/lolcommits/runner.rb', line 25

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
    self.url  = git_info.url
  end
end

Instance Attribute Details

#capture_animateObject

Returns the value of attribute capture_animate.



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

def capture_animate
  @capture_animate
end

#capture_delayObject

Returns the value of attribute capture_delay.



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

def capture_delay
  @capture_delay
end

#capture_deviceObject

Returns the value of attribute capture_device.



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

def capture_device
  @capture_device
end

#capture_stealthObject

Returns the value of attribute capture_stealth.



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

def capture_stealth
  @capture_stealth
end

#configObject

Returns the value of attribute config.



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

def config
  @config
end

#fontObject

Returns the value of attribute font.



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

def font
  @font
end

#main_imageObject

Returns the value of attribute main_image.



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

def main_image
  @main_image
end

#messageObject

Returns the value of attribute message.



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

def message
  @message
end

#repoObject

Returns the value of attribute repo.



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

def repo
  @repo
end

#repo_internal_pathObject

Returns the value of attribute repo_internal_path.



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

def repo_internal_path
  @repo_internal_path
end

#shaObject

Returns the value of attribute sha.



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

def sha
  @sha
end

#snapshot_locObject

Returns the value of attribute snapshot_loc.



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

def snapshot_loc
  @snapshot_loc
end

#urlObject

Returns the value of attribute url.



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

def url
  @url
end

Instance Method Details

#animate?Boolean

Returns:

  • (Boolean)


61
62
63
# File 'lib/lolcommits/runner.rb', line 61

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

#runObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/lolcommits/runner.rb', line 40

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