lib/notifaction/notify.rb in notifaction-0.2.0 vs lib/notifaction/notify.rb in notifaction-0.3.0
- old
+ new
@@ -24,11 +24,11 @@
# Prints a pre-formatted error message to the console
def self.error(message, config = {})
handler = Notifaction::Type::Terminal.new
handler.error(message, config)
- handler.quit unless config[:auto_quit] == false
+ handler.quit unless self.auto_quit_enabled(config)
end
# Prints a pre-formatted warning message to the console
def self.warning(message, config = {})
handler = Notifaction::Type::Terminal.new
@@ -64,29 +64,22 @@
handler.spit(message, config)
end
# Send status updates to WorkingOn
def self.workingon(message, print_info_message = false)
- begin
- plugin = Plugin::WorkingOn.new
- plugin.fire(message)
-
- if print_info_message
- info(message)
- end
- rescue Exception => e
- error("Error notifying WO - #{e.message}")
- end
+ self.deprecation_notice("0.3.0")
end
# pretty-print a spacer
def self.spacer(config = {})
handler = Notifaction::Type::Terminal.new
handler.spacer(config)
end
def self.configure
+ self.deprecation_notice("0.3.0")
+
yield self if block_given?
end
def self.print_output
true
@@ -96,16 +89,22 @@
true
end
# register new plugins
def self.plugins=(plugin_config_arr)
- plugin_config_arr.each do |hash|
- hash.each_pair do |plugin, key|
- # include the requested plugin
- require_relative "plugins/#{plugin.downcase}.rb"
+ self.deprecation_notice("0.3.0")
+ end
- instance_variable_set("@#{plugin}_key".to_sym, key)
- end
- end
+ private_class_method
+
+ #
+ # @since 0.2.8
+ def deprecation_notice(version)
+ puts "Deprecated as of #{version}, current #{Notifaction::VERSION}"
end
+ #
+ # @since 0.3.0
+ def self.auto_quit_enabled(config)
+ config[:auto_quit] == false || $config.conf["auto_quit"] == false
+ end
end