lib/lolcommits/runner.rb in lolcommits-0.9.2 vs lib/lolcommits/runner.rb in lolcommits-0.9.3.pre1
- old
+ new
@@ -1,6 +1,5 @@
-# -*- encoding : utf-8 -*-
require 'lolcommits/platform'
module Lolcommits
class Runner
attr_accessor :capture_delay, :capture_stealth, :capture_device, :message,
@@ -31,11 +30,10 @@
def run
# do things that need to happen before capture and plugins
# do native plugins that need to happen before capture
plugins_for(:precapture).each do |plugin|
- debug "Runner: precapture about to execute #{plugin}"
plugin.new(self).execute_precapture
end
# do gem plugins that need to happen before capture?
@@ -49,15 +47,14 @@
resize_snapshot!
# do native plugins that need to happen immediately after capture and
# resize this is effectively the "image processing" phase for now,
# reserve just for us and handle manually...?
- Lolcommits::Loltext.new(self).execute_postcapture
+ Lolcommits::Plugin::Loltext.new(self).execute_postcapture
# do native plugins that need to happen after capture
plugins_for(:postcapture).each do |plugin|
- debug "Runner: postcapture about to execute #{plugin}"
plugin.new(self).execute_postcapture
end
# do gem plugins that need to happen after capture?
@@ -67,15 +64,17 @@
debug 'Runner: failed to capture a snapshot'
exit 1
end
end
+ # TODO: - move these plugin methods to Lolcommits::PluginManager after all
+ # plugins get "gemified"
def plugins_for(position)
self.class.plugins.select { |p| p.runner_order == position }
end
def self.plugins
- Lolcommits::Plugin.subclasses
+ Lolcommits::Plugin.constants.map(&Lolcommits::Plugin.method(:const_get)) - [Lolcommits::Plugin::Base]
end
# the main capture
def run_capture
puts '*** Preserving this moment in history.' unless capture_stealth