Sha256: 5644646b943f190d263c3e359a011abb477f1509fba0cef7bfa4fef461beaad0
Contents?: true
Size: 1.65 KB
Versions: 2
Compression:
Stored size: 1.65 KB
Contents
require 'rubygems/user_interaction' module Bundler class UI def warn(message, newline = nil) end def debug(message, newline = nil) end def error(message, newline = nil) end def info(message, newline = nil) end def confirm(message, newline = nil) end def debug? false end class Shell < UI attr_reader :quiet attr_writer :shell def initialize(shell) @shell = shell @quiet = false @debug = ENV['DEBUG'] end def info(msg, newline = nil) tell_me(msg, nil, newline) if !@quiet end def confirm(msg, newline = nil) tell_me(msg, :green, newline) if !@quiet end def warn(msg, newline = nil) tell_me(msg, :yellow, newline) end def error(msg, newline = nil) tell_me(msg, :red, newline) end def quiet=(value) @quiet = value end def debug? # needs to be false instead of nil to be newline param to other methods !!@debug && !@quiet end def debug! @debug = true end def debug(msg, newline = nil) tell_me(msg, nil, newline) if debug? end private # valimism def tell_me(msg, color = nil, newline = nil) newline.nil? ? @shell.say(msg, color) : @shell.say(msg, color, newline) end end class RGProxy < ::Gem::SilentUI def initialize(ui) @ui = ui super() end def say(message) if message =~ /native extensions/ @ui.info "with native extensions " else @ui.debug(message) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bundler-1.2.5 | lib/bundler/ui.rb |
bundler-1.2.4 | lib/bundler/ui.rb |