class Daedalus::FancyLogger

Constants

Public Class Methods

new(level=0) click to toggle source
Calls superclass method Daedalus::Logger::new
   # File lib/daedalus.rb
87 def initialize(level=0)
88   super 0
89 end

Public Instance Methods

command(cmd) click to toggle source
    # File lib/daedalus.rb
113 def command(cmd)
114   output = IO.popen "sh -c '#{cmd} 2>&1'", "r"
115 
116   begin
117     str = output.read
118   rescue Exception
119     Process.kill 'SIGINT', output.pid
120     STDOUT.puts "\nInterrupt compiling."
121     raise "Stopped compiling"
122   end
123 
124   Process.wait output.pid
125 
126   if $?.exitstatus != 0
127     STDOUT.puts "Error compiling: #{cmd}"
128     STDOUT.puts "Output:\n#{str}"
129     raise "Error compiling"
130   end
131 end
show(kind, cmd) click to toggle source
    # File lib/daedalus.rb
 97 def show(kind, cmd)
 98   @count += 1
 99   perc = (100 * (@count.to_f / @total)).to_i
100   bar_size = (30 * (@count.to_f / @total)).to_i
101 
102   bar = "#{'=' * bar_size}#{' ' * (30 - bar_size)}"
103 
104   if cmd.size > 38
105     cmd = "..#{cmd[-38,38]}"
106   else
107     cmd = cmd.ljust(40)
108   end
109 
110   STDOUT.print "\r[%3d%% #{bar}] #{kind} #{cmd}" % perc.to_i
111 end
start(count) click to toggle source
Calls superclass method Daedalus::Logger#start
   # File lib/daedalus.rb
91 def start(count)
92   super
93   STDOUT.sync = true
94   STDOUT.puts HEADER
95 end
stop() click to toggle source
Calls superclass method Daedalus::Logger#stop
    # File lib/daedalus.rb
133 def stop
134   super
135   STDOUT.puts
136 end