class FastlaneCore::Swag

Constants

FRAMES

Public Class Methods

should_be_shown?() click to toggle source
# File fastlane_core/lib/fastlane_core/swag.rb, line 39
def self.should_be_shown?
  return false unless FastlaneCore::Env.truthy?("FL_ENABLE_LOGO_ANIMATION")
  return false if Helper.ci?
  return false unless UI.interactive?
  return true
end
show_loader() click to toggle source
# File fastlane_core/lib/fastlane_core/swag.rb, line 46
def self.show_loader
  return unless should_be_shown?
  # sound is disabled as I didn't find a royality free nice midi :(
  @output = StringIO.new
  # if FastlaneCore::Env.truthy?("FL_DO_SOUND")
  #  @sound_thr = Thread.new do
  #    audio = File.join(FastlaneCore::ROOT, "lib/assets/sound.xm")
  #    pipe = IO.popen("timidity #{audio.shellescape}")
  #    # Get the pid of the spawned process
  #    @sound_pid = pipe.pid
  #  end
  # end

  @thr = Thread.new do
    spinit until @break
  end
end
spinit() click to toggle source
# File fastlane_core/lib/fastlane_core/swag.rb, line 64
def self.spinit
  do_break = true
  interrupted = false
  begin
    loop do
      STDOUT.print("\e[H\e[2J")
      STDOUT.print("\e[?25l")
      FRAMES.each.with_index(1) do |frame, nxt|
        STDOUT.print(Zlib::Inflate.inflate(frame))
        sleep(0.1)
        break if interrupted
        STDOUT.print("\e[H\e[2J") if FRAMES[nxt]
      end
      break if do_break
    end
    STDOUT.puts
  ensure
    print("\e[?25h")
  end
end
stop_loader() click to toggle source
# File fastlane_core/lib/fastlane_core/swag.rb, line 30
def self.stop_loader
  return unless should_be_shown?
  @break = true
  @thr.join
  # Process.kill("KILL", @sound_pid) if @sound_thr
  STDOUT.print("\e[H\e[2J")
  STDOUT.print("\e[?25l")
end