Sha256: 520d99871499b53947c4392309548a595fa4922164fbcba8642cd3fef33eae2c

Contents?: true

Size: 1.33 KB

Versions: 7

Compression:

Stored size: 1.33 KB

Contents

#!/usr/bin/env ruby

require 'rubygems'
require 'dotenv'
require 'eventboss'
require 'optparse'

Dotenv.load

STDOUT.sync = true
options = {}

OptionParser.new do |parser|
  parser.on('-r', '--require LIBRARY', 'Require custom app entrypoint') do |lib|
    options[:require] = lib
  end
end.parse!

begin
  logger = Eventboss::Logger

  require 'rails'
  logger.debug('Loading rails...')
  if ::Rails::VERSION::MAJOR < 4
    require File.expand_path('config/environment.rb')
  else
    require File.expand_path('config/application.rb')
    require File.expand_path('config/environment.rb')
  end

  # Due to a changes introduced in Rails 6 regarding autoloading
  # we need to determine how to perform eager_load
  # @see https://weblog.rubyonrails.org/2019/2/22/zeitwerk-integration-in-rails-6-beta-2/
  if ::Rails.try(:autoloaders).try(:zeitwerk_enabled?)
    ::Zeitwerk::Loader.eager_load_all
  else
    ::Rails.application.eager_load!
  end
rescue LoadError
  logger.debug('Seems like not a Rails app')

  if options[:require].nil?
    logger.warn('Please use -r to load a custom app entrypoint')
    exit(0)
  else
    logger.debug("Loading #{options[:require]}")
    require File.expand_path(options[:require])
  end
end

logger.info('Starting eventboss...')
logger.info('Active Listeners:')
logger.info(Eventboss::QueueListener.list.to_s)

Eventboss.launch

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
eventboss-1.1.2 bin/eventboss
eventboss-1.1.1 bin/eventboss
eventboss-1.1.0 bin/eventboss
eventboss-1.0.6 bin/eventboss
eventboss-1.0.5 bin/eventboss
eventboss-1.0.4 bin/eventboss
eventboss-1.0.3 bin/eventboss