lib/lolcommits/runner.rb in lolcommits-0.4.1pre2 vs lib/lolcommits/runner.rb in lolcommits-0.4.1
- old
+ new
@@ -1,12 +1,13 @@
module Lolcommits
PLUGINS = Lolcommits::Plugin.subclasses
class Runner
attr_accessor :capture_delay, :capture_device, :message, :sha,
- :snapshot_loc, :main_image, :repo, :config, :repo_internal_path
-
+ :snapshot_loc, :main_image, :repo, :config, :repo_internal_path,
+ :font
+
include Methadone::CLILogging
include ActiveSupport::Callbacks
define_callbacks :run
set_callback :run, :before, :execute_lolcommits_tranzlate
@@ -22,11 +23,11 @@
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
@@ -39,13 +40,14 @@
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
+ :capture_device => self.capture_device,
+ :capture_delay => self.capture_delay,
+ :snapshot_location => self.snapshot_loc,
+ :font => self.font
)
capturer.capture
resize_snapshot!
end
end
@@ -84,10 +86,10 @@
debug "Runner: running cleanup"
#clean up the captured image
FileUtils.rm(self.snapshot_loc)
end
- # register a method called "execute_lolcommits_#{plugin_name}"
+ # register a method called "execute_lolcommits_#{plugin_name}"
# for each subclass of plugin. these methods should be used as
# callbacks to the run method.
Lolcommits::PLUGINS.each do |plugin|
define_method "execute_#{plugin.to_s.underscore.gsub('/', '_')}" do
plugin.new(self).execute