Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
rbe / lib / rbe.rb
Size: Mime:
require 'rbe/version'

def load_ds(*names)
  @ds_loaded ||= []
  names.each { |name|
    unless @ds_loaded.include?(name)
      require "rbe/data/#{name}"
      @ds_loaded << name
    end
  }
  Rbe::Data::DataStore
end

tl = ENV['time_load']
@time_load = tl == '1' || tl == 1 || tl == 'true' || tl == 't'

t1 = Time.now if @time_load

module Rbe
end

require 'thor'
rt1 = Time.now if @time_load
require 'everyday_thor_util/builder'
rt2 = Time.now if @time_load
include EverydayThorUtil::Builder
rt3 = Time.now if @time_load
require 'rbe/data/data_store'
rt4 = Time.now if @time_load
require 'rbe/cli/helpers'
rt5 = Time.now if @time_load
require 'rbe/cli/commands'

t2 = Time.now if @time_load

@rc = build!

t3 = Time.now if @time_load

add_debugging(@rc, nil, 'debug')

t4 = Time.now if @time_load

def ct(a, b)
  (a-b)*1000
end

def format_time(d, pd = nil)
  "#{('%.3f' % d).rjust(10)} ms#{pd.nil? ? '' : " (#{'%.3f' % ((d / pd) * 100.0)}%)"}"
end

if @time_load
  rtd01 = ct(rt1, t1)
  rtd12 = ct(rt2, rt1)
  rtd23 = ct(rt3, rt2)
  rtd34 = ct(rt4, rt3)
  rtd45 = ct(rt5, rt4)
  rtd56 = ct(t2, rt5)
  rthd01 = ct(@rth1, rt4)
  rthd12 = ct(@rth2, @rth1)
  rthd23 = ct(@rth3, @rth2)
  rthd34 = ct(@rth4, @rth3)
  rthd45 = ct(@rth5, @rth4)
  rthd56 = ct(@rth6, @rth5)
  rthd67 = ct(rt5, @rth6)
  td12 = ct(t2, t1)
  td23 = ct(t3, t2)
  td34 = ct(t4, t3)
  td24 = ct(t4, t2)
  td14 = ct(t4, t1)
  strs = []
  strs << "total time:                       #{format_time(td14)}"
  strs << "require time:                     #{format_time(td12, td14)}"
  strs << " -- thor:                         #{format_time(rtd01, td12)}"
  strs << " -- etu/builder:                  #{format_time(rtd12, td12)}"
  strs << " -- include ETU::Builder:         #{format_time(rtd23, td12)}"
  strs << " -- rbe/data/data_store:          #{format_time(rtd34, td12)}"
  strs << " -- rbe/cli/helpers:              #{format_time(rtd45, td12)}"
  strs << "     -- rbe/cli/helpers/password: #{format_time(rthd01, rtd45)}"
  strs << "     -- rbe/cli/helpers/vars:     #{format_time(rthd12, rtd45)}"
  strs << "     -- rbe/cli/helpers/args:     #{format_time(rthd23, rtd45)}"
  strs << "     -- rbe/cli/helpers/display:  #{format_time(rthd34, rtd45)}"
  strs << "     -- rbe/cli/helpers/running:  #{format_time(rthd45, rtd45)}"
  strs << "     -- rbe/cli/helpers/alias:    #{format_time(rthd56, rtd45)}"
  strs << "     -- rbe/cli/helpers/about:    #{format_time(rthd67, rtd45)}"
  strs << " -- rbe/cli/commands:             #{format_time(rtd56, td12)}"
  strs << "build time:                       #{format_time(td23, td14)}"
  strs << "add_debugging time:               #{format_time(td34, td14)}"
  strs << "build + add_debugging time:       #{format_time(td24, td14)}"
  ml = strs.map { |s| s.length }.max
  strs = strs.map { |s| "| #{s.ljust(ml)} |" }
  strs.unshift("+#{'-' * (ml + 2)}+")
  strs << "+#{'-' * (ml + 2)}+"
  strs.each { |s| puts s }
  puts
  puts
end