module DbSucker::Patches::BetaWarning::WindowExtensions

Public Instance Methods

_view_beta_warning() click to toggle source
# File lib/db_sucker/patches/beta-warning.rb, line 11
def _view_beta_warning
  # render monkey
  current_frame = monkey_frames[@tick % 16 / 2]

  cyan "  " << "    ||      ||".ljust(33, " ")
  current_frame.each do |line|
    y = true
    yellow "  "
    line.split(/(�[^�]+�)/).each do |m|
      send(y ? :cyan : :green, m.tr("�", ""))
      y = !y
    end

    next_line
    break if @line > lines - 1
  end
  (lines - @line).times do |i|
    inset = i % 3 == 0 ? "======" : "      "
    cyan "  " << "    ||#{inset}||".ljust(33, " ")
    next_line
  end

  # render text
  @line = -1
  self.x_offset = 24

  font_frame.each do |line|
    red line.ljust(30, " ")
    next_line
  end

  self.x_offset = 37
  next_line

  dialog! do |d|
    d.border_color = :gray
    d.line "DbSucker v3 is a complete rewrite and has few testers.", :blue
    d.line "If you encounter issues, have suggestions or want to", :blue
    d.line "add support for other DBMS please let me know on Github!", :blue
    d.br
    d.line "https://github.com/2called-chaos/db_sucker", :cyan
    d.hr
    d.line "I swear that I have backups before testing this tool and", :red
    d.line "that I won't beat the cute monkey if something goes south", :red
    d.br
    d.button_group(5) do |g|
      g << d.build_button("ABORT (n/f/0/q/ESC)", :yellow)
      g << d.build_button("ACCEPT & CONTINUE (y/t/1)", :green)
    end
  end

  if lines < 27 || cols < 98
    setpos(0, 0)
    red "INCREASE WINDOW SIZE!"
  end
end
font_frame() click to toggle source
# File lib/db_sucker/patches/beta-warning.rb, line 72
def font_frame
  frames[0]
end
frames() click to toggle source
# File lib/db_sucker/patches/beta-warning.rb, line 68
def frames
  @frames ||= File.read(__FILE__).split("__END__").last.split("-----").map{|frame| frame.split("\n") }
end
monkey_frames() click to toggle source
# File lib/db_sucker/patches/beta-warning.rb, line 76
def monkey_frames
  frames[1..-1]
end