Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
extract UI::Silent
Browse files Browse the repository at this point in the history
  • Loading branch information
indirect committed Jan 9, 2014
1 parent 7a64714 commit 5e38e2d
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 46 deletions.
2 changes: 1 addition & 1 deletion lib/bundler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def configure
end

def ui
@ui ||= UI.new
@ui ||= UI::Silent.new
end

# Returns absolute path of where gems are installed on the filesystem.
Expand Down
42 changes: 2 additions & 40 deletions lib/bundler/ui.rb
Original file line number Diff line number Diff line change
@@ -1,45 +1,7 @@
module Bundler
class UI
module UI
autoload :RGProxy, 'bundler/ui/rg_proxy'
autoload :Shell, 'bundler/ui/shell'

def info(message, newline = nil)
end

def confirm(message, newline = nil)
end

def warn(message, newline = nil)
end

def error(message, newline = nil)
end

def debug(message, newline = nil)
end

def debug?
false
end

def quiet?
false
end

def ask(message)
end

def level=(name)
end

def level(name = nil)
end

def trace(message, newline = nil)
end

def silence
yield
end
autoload :Silent, 'bundler/ui/silent'
end
end
2 changes: 1 addition & 1 deletion lib/bundler/ui/rg_proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'rubygems/user_interaction'

module Bundler
class UI
module UI
class RGProxy < ::Gem::SilentUI
def initialize(ui)
@ui = ui
Expand Down
6 changes: 2 additions & 4 deletions lib/bundler/ui/shell.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
require 'bundler/ui'

module Bundler
class UI
class Shell < UI
module UI
class Shell
LEVELS = %w(silent error warn confirm info debug)

attr_writer :shell
Expand Down
44 changes: 44 additions & 0 deletions lib/bundler/ui/silent.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
module Bundler
module UI
class Silent
def info(message, newline = nil)
end

def confirm(message, newline = nil)
end

def warn(message, newline = nil)
end

def error(message, newline = nil)
end

def debug(message, newline = nil)
end

def debug?
false
end

def quiet?
false
end

def ask(message)
end

def level=(name)
end

def level(name = nil)
end

def trace(message, newline = nil)
end

def silence
yield
end
end
end
end

0 comments on commit 5e38e2d

Please sign in to comment.