aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bundler/ui.rb
blob: 7742b9b3535cbd92d896f599db1cc9b3b5479bf8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
module Bundler
  class UI
    def warn(message)
    end

    def error(message)
    end

    def info(message)
    end

    def confirm(message)
    end

    class Shell < UI
      def initialize(shell)
        @shell = shell
      end

      def debug(msg)
        @shell.say(msg) if ENV['DEBUG']
      end

      def info(msg)
        @shell.say(msg)
      end

      def confirm(msg)
        @shell.say(msg, :green)
      end

      def warn(msg)
        @shell.say(msg, :yellow)
      end

      def error(msg)
        @shell.say(msg, :red)
      end
    end

    class RGProxy < Gem::SilentUI
      def initialize(ui)
        @ui = ui
      end

      def say(message)
        if message =~ /native extensions/
          @ui.info "with native extensions "
        else
          @ui.debug(message)
        end
      end
    end
  end
end