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



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/lolcommits/runner.rb', line 21

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_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

#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

#runObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/lolcommits/runner.rb', line 35

def run
  die_if_rebasing!

  run_callbacks :run do
    puts "*** Preserving this moment in history."
    self.snapshot_loc = self.config.raw_image
    self.main_image   = self.config.main_image(self.sha)
    capturer = "Lolcommits::Capture#{Configuration.platform}".constantize.new(
      :capture_device    => self.capture_device,
      :capture_delay     => self.capture_delay,
      :snapshot_location => self.snapshot_loc,
      :font              => self.font
    )
    capturer.capture
    resize_snapshot!
  end
end