vite-server.rb 544 B

1234567891011121314151617181920212223
  1. #!/usr/bin/env ruby
  2. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  3. require 'socket'
  4. HOST = ENV['ZAMMAD_BIND_IP'] || '127.0.0.1'
  5. PORT = ENV['ZAMMAD_RAILS_PORT'] || 3000
  6. # Waits for Puma server on configured port to become ready and then starts vite dev server
  7. loop do
  8. begin
  9. TCPSocket.new(HOST, PORT.to_i)
  10. break
  11. rescue Errno::ECONNREFUSED
  12. puts "Waiting for Puma server at #{HOST}:#{PORT}..."
  13. sleep 1
  14. end
  15. end
  16. require 'rubygems'
  17. require 'bundler/setup'
  18. load Gem.bin_path('vite_ruby', 'vite')