Sha256: dd1e2d4591485b1c122e4bd389b71a4a6d3bfd64c0d587b4f1bcaecf669e69b9

Contents?: true

Size: 1.06 KB

Versions: 6

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

module RubyRabbitmqJanus
  module Generators
    # Create an class for generate a initializer
    class InitializerGenerator < Rails::Generators::Base
      desc 'Generate a initializer to this gem for rails application.'
      INITIALIZER = <<-INIT
  # frozen_string_literal: true

  require 'actions'

  # Initialize a gem and create an session with a keepalive
  ::RRJ = RubyRabbitmqJanus::RRJ.new

  # For admin management
  # ::RRJ = RubyRabbitmqJanus::RRJAdmin.new

  # This test disable this gems execution when you running an task with rake
  unless File.basename($PROGRAM_NAME) == 'rake'
    Rails.configuration.after_initialize do
      # If you don't want listen a standard queue, comment this lines and
      # "require 'actions'"
      actions = RubyRabbitmqJanus::ActionEvents.new.actions
      RubyRabbitmqJanus::Janus::Concurrencies::Event.instance.run(&actions)
    end
  end
        INIT

      # Create an initializer
      def copy_initializer
        initializer 'ruby_rabbitmq_janus.rb', INITIALIZER
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ruby_rabbitmq_janus-2.1.0.pre.130 lib/generators/ruby_rabbitmq_janus/initializer_generator.rb
ruby_rabbitmq_janus-2.1.0.pre.129 lib/generators/ruby_rabbitmq_janus/initializer_generator.rb
ruby_rabbitmq_janus-2.1.0.pre.128 lib/generators/ruby_rabbitmq_janus/initializer_generator.rb
ruby_rabbitmq_janus-2.0.0.pre.108 lib/generators/ruby_rabbitmq_janus/initializer_generator.rb
ruby_rabbitmq_janus-2.0.0 lib/generators/ruby_rabbitmq_janus/initializer_generator.rb
ruby_rabbitmq_janus-2.0.0.pre.106 lib/generators/ruby_rabbitmq_janus/initializer_generator.rb