module Batsir

Constants

VERSION

Public Class Methods

config() click to toggle source
# File lib/batsir.rb, line 38
def self.config
  Batsir::Config
end
create(&block) click to toggle source
# File lib/batsir.rb, line 42
def self.create(&block)
  puts logo
  new_block = ::Proc.new do
    aggregator_chain(&block)
  end
  @chain = ::Blockenspiel.invoke(new_block, Batsir::DSL::ChainMapping.new)
end
create_and_start(&block) click to toggle source
# File lib/batsir.rb, line 76
def self.create_and_start(&block)
  create(&block)
  start
end
initialize_sidekiq() click to toggle source
# File lib/batsir.rb, line 66
def self.initialize_sidekiq
  Sidekiq.logger = Batsir::Logger.log
  Sidekiq.configure_server do |config|
    config.redis = {:url => redis_url, :namespace => redis_namespace}
  end
  Sidekiq.configure_client do |config|
    config.redis = {:url => redis_url, :namespace => redis_namespace}
  end
end
redis_namespace() click to toggle source
# File lib/batsir.rb, line 88
def self.redis_namespace
  Batsir::Config.redis_namespace
end
redis_url() click to toggle source
# File lib/batsir.rb, line 81
def self.redis_url
  host = Batsir::Config.redis_host
  port = Batsir::Config.redis_port
  dbase = Batsir::Config.redis_database
  "redis://#{host}:#{port}/#{dbase}"
end
start() click to toggle source
# File lib/batsir.rb, line 50
def self.start
  return unless @chain

  sidekiq_cli = Sidekiq::CLI.instance
  Sidekiq.options[:queues] << Batsir::Config.sidekiq_queue

  initialize_sidekiq

  generated_code = @chain.compile

  eval(generated_code)

  @chain.start
  sidekiq_cli.run
end