Top Level Namespace

Defined Under Namespace

Modules: Kibo Classes: Array, FatalError, Hash

Constant Summary collapse

UI =
Bundler::UI::Shell.new(Thor::Shell::Color.new)

Instance Method Summary collapse

Instance Method Details

#B(*args, &block) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/kibo/log.rb', line 26

def B(*args, &block)
  msg = log_message(*args)
  W msg

  start = Time.now
  yield.tap do
    W "#{msg}: #{(1000 * (Time.now - start)).to_i} msecs."
  end
end

#confirm!(msg) ⇒ Object



41
42
43
44
45
46
# File 'lib/kibo/log.rb', line 41

def confirm!(msg)
  UI.warn msg
  puts "Press ^C to abort or return to continue."
  
  STDIN.readline
end

#D(*args) ⇒ Object



11
12
13
# File 'lib/kibo/log.rb', line 11

def D(*args)
  UI.info log_message(*args)
end

#E(*args) ⇒ Object

Raises:



22
23
24
# File 'lib/kibo/log.rb', line 22

def E(*args)
  raise FatalError, log_message(*args)
end

#log_message(msg, *args) ⇒ Object



6
7
8
9
# File 'lib/kibo/log.rb', line 6

def log_message(msg, *args)
  return msg if args.empty?
  "#{msg}: " + args.map(&:inspect).join(", ")
end

#next_versionObject



8
9
10
11
12
# File 'lib/kibo/version.rb', line 8

def next_version
  parts = Kibo::VERSION.split(".")
  parts[parts.length - 1] = parts[parts.length - 1].to_i + 1
  parts.join(".")
end

#S(*args) ⇒ Object

Success!



37
38
39
# File 'lib/kibo/log.rb', line 37

def S(*args)
  UI.confirm log_message(*args)
end

#W(*args) ⇒ Object



15
16
17
# File 'lib/kibo/log.rb', line 15

def W(*args)
  UI.warn log_message(*args).to_s
end