summaryrefslogtreecommitdiff
path: root/vendor/supply_drop/lib/supply_drop/writer
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/supply_drop/lib/supply_drop/writer')
-rw-r--r--vendor/supply_drop/lib/supply_drop/writer/batched.rb22
-rw-r--r--vendor/supply_drop/lib/supply_drop/writer/colorful_streaming.rb72
-rw-r--r--vendor/supply_drop/lib/supply_drop/writer/file.rb23
-rw-r--r--vendor/supply_drop/lib/supply_drop/writer/streaming.rb16
4 files changed, 0 insertions, 133 deletions
diff --git a/vendor/supply_drop/lib/supply_drop/writer/batched.rb b/vendor/supply_drop/lib/supply_drop/writer/batched.rb
deleted file mode 100644
index e5fc826..0000000
--- a/vendor/supply_drop/lib/supply_drop/writer/batched.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-module SupplyDrop
- module Writer
- class Batched
- def initialize(logger)
- @outputs = {}
- @logger = logger
- end
-
- def collect_output(host, data)
- @outputs[host] ||= ""
- @outputs[host] << data
- end
-
- def all_output_collected
- @outputs.keys.sort.each do |host|
- @logger.info "Puppet output for #{host}"
- @logger.debug @outputs[host], host
- end
- end
- end
- end
-end
diff --git a/vendor/supply_drop/lib/supply_drop/writer/colorful_streaming.rb b/vendor/supply_drop/lib/supply_drop/writer/colorful_streaming.rb
deleted file mode 100644
index e88e552..0000000
--- a/vendor/supply_drop/lib/supply_drop/writer/colorful_streaming.rb
+++ /dev/null
@@ -1,72 +0,0 @@
-begin
- require 'paint'
-rescue
-end
-
-module SupplyDrop
- module Writer
- class Streaming
- def initialize(logger)
- @mode = Capistrano::Logger::DEBUG
- @logger = logger
- end
-
- def collect_output(host, data)
- if data =~ /^(notice|err|warning):/
- @mode = $1
-
- # make deprecation warnings like notices
- if data =~ /^warning: .*is deprecated.*$/
- @mode = 'notice'
- end
-
- # make variable scope warnings like notices
- if data =~ /^warning: Scope*$/
- @mode = 'notice'
- end
-
- # force the printing of 'finished catalog run' if there have not been any errors
- if @mode == 'notice' && !@error_encountered && data =~ /Finished catalog run/
- @mode = 'forced_notice'
- elsif @mode == 'err'
- @error_encountered = true
- end
- end
-
- # log each line, colorizing the hostname
- data.lines.each do |line|
- if line =~ /\w/
- @logger.log log_level, line.sub(/\n$/,''), colorize(host)
- end
- end
- end
-
- def log_level
- case @mode
- when 'err' then Capistrano::Logger::IMPORTANT
- when 'warning' then Capistrano::Logger::INFO
- when 'notice' then Capistrano::Logger::DEBUG
- else Capistrano::Logger::IMPORTANT
- end
- end
-
- def colorize(str)
- if defined? Paint
- color = case @mode
- when 'err' then :red
- when 'warning' then :yellow
- when 'notice' then :cyan
- when 'forced_notice' then :cyan
- else :clear
- end
- Paint[str, color, :bold]
- else
- str
- end
- end
-
- def all_output_collected
- end
- end
- end
-end
diff --git a/vendor/supply_drop/lib/supply_drop/writer/file.rb b/vendor/supply_drop/lib/supply_drop/writer/file.rb
deleted file mode 100644
index 61454d8..0000000
--- a/vendor/supply_drop/lib/supply_drop/writer/file.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-module SupplyDrop
- module Writer
- class File
- def initialize(writer, file)
- @wrapped_writer = writer
- @logger = Capistrano::Logger.new(:output => file)
- @logger.level = Capistrano::Logger::TRACE
- @file_writer = Batched.new(@logger)
- end
-
- def collect_output(host, data)
- @wrapped_writer.collect_output(host, data)
- @file_writer.collect_output(host, data)
- end
-
- def all_output_collected
- @wrapped_writer.all_output_collected
- @file_writer.all_output_collected
- @logger.close
- end
- end
- end
-end
diff --git a/vendor/supply_drop/lib/supply_drop/writer/streaming.rb b/vendor/supply_drop/lib/supply_drop/writer/streaming.rb
deleted file mode 100644
index e180ec8..0000000
--- a/vendor/supply_drop/lib/supply_drop/writer/streaming.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-module SupplyDrop
- module Writer
- class Streaming
- def initialize(logger)
- @logger = logger
- end
-
- def collect_output(host, data)
- @logger.debug data, host
- end
-
- def all_output_collected
- end
- end
- end
-end