Please review pull request #692: (#13559) Promote new console output prototype to official. opened by (daniel-pittman)
Description:
This makes the prototype new console the official, default, system-wide
console in Puppet. This has some small, visible effects on error reporting
across the board, but more importantly sets the stage for broader changes to
improve user experience on the command line in future.
Signed-off-by: Daniel Pittman [email protected]
- Opened: Thu Apr 19 23:14:43 UTC 2012
- Based on: puppetlabs:master (54e1c83afde1b721e5433adea17a4dd0caffbc63)
- Requested merge: daniel-pittman:bug/master/13559-two-console-output-styles-enter-one-style-leaves (81f856cb537ab0ed9ad386593c485301ede81cf8)
Diff follows:
diff --git a/lib/puppet/application/module.rb b/lib/puppet/application/module.rb
index e107660..8526974 100644
--- a/lib/puppet/application/module.rb
+++ b/lib/puppet/application/module.rb
@@ -1,11 +1,4 @@
require 'puppet/application/face_base'
class Puppet::Application::Module < Puppet::Application::FaceBase
- def setup
- super
- if self.render_as.name == :console
- Puppet::Util::Log.close(:console)
- Puppet::Util::Log.newdestination(:telly_prototype_console)
- end
- end
end
diff --git a/lib/puppet/util/log/destinations.rb b/lib/puppet/util/log/destinations.rb
index 777cbf5..5824747 100644
--- a/lib/puppet/util/log/destinations.rb
+++ b/lib/puppet/util/log/destinations.rb
@@ -95,24 +95,6 @@ def handle(msg)
def initialize
# Flush output immediately.
- $stdout.sync = true
- end
-
- def handle(msg)
- if msg.source == "Puppet"
- puts colorize(msg.level, "#{msg.level}: #{msg}")
- else
- puts colorize(msg.level, "#{msg.level}: #{msg.source}: #{msg}")
- end
- end
-end
-
-Puppet::Util::Log.newdesttype :telly_prototype_console do
- require 'puppet/util/colors'
- include Puppet::Util::Colors
-
- def initialize
- # Flush output immediately.
$stderr.sync = true
$stdout.sync = true
end
diff --git a/spec/unit/application/facts_spec.rb b/spec/unit/application/facts_spec.rb
index 00f79fb..1c4e832 100755
--- a/spec/unit/application/facts_spec.rb
+++ b/spec/unit/application/facts_spec.rb
@@ -11,7 +11,7 @@
subject.command_line.stubs(:args).returns %w{find}
expect {
expect { subject.run }.to exit_with 1
- }.to have_printed /err: puppet facts find takes 1 argument, but you gave 0/
+ }.to have_printed /Error: puppet facts find takes 1 argument, but you gave 0/
@logs.first.to_s.should =~ /puppet facts find takes 1 argument, but you gave 0/
end
diff --git a/spec/unit/util/log/destinations_spec.rb b/spec/unit/util/log/destinations_spec.rb
index 0601899..5dc65af 100755
--- a/spec/unit/util/log/destinations_spec.rb
+++ b/spec/unit/util/log/destinations_spec.rb
@@ -132,29 +132,3 @@
end
end
end
-
-describe Puppet::Util::Log.desttypes[:telly_prototype_console] do
- describe "when color is available" do
- it "should support color output" do
- Puppet.stubs(:[]).with(:color).returns(true)
- subject.colorize(:red, 'version').should == "\e[0;31mversion\e[0m"
- end
-
- it "should withhold color output when not appropriate" do
- Puppet.stubs(:[]).with(:color).returns(false)
- subject.colorize(:red, 'version').should == "version"
- end
-
- it "should handle multiple overlapping colors in a stack-like way" do
- Puppet.stubs(:[]).with(:color).returns(true)
- vstring = subject.colorize(:red, 'version')
- subject.colorize(:green, "(#{vstring})").should == "\e[0;32m(\e[0;31mversion\e[0;32m)\e[0m"
- end
-
- it "should handle resets in a stack-like way" do
- Puppet.stubs(:[]).with(:color).returns(true)
- vstring = subject.colorize(:reset, 'version')
- subject.colorize(:green, "(#{vstring})").should == "\e[0;32m(\e[mversion\e[0;32m)\e[0m"
- end
- end
-end
-- You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
