Sha256: b2d480eaa34c7bff7008ec31094b4529347a78e8c5e4e2e980a6851dc8354dd0

Contents?: true

Size: 1.39 KB

Versions: 16

Compression:

Stored size: 1.39 KB

Contents

# frozen_string_literal: true

require 'phobos'
require 'phobos/cli'
require 'generators/deimos/schema_class_generator'
require 'optparse'

namespace :deimos do
  desc 'Starts Deimos in the rails environment'
  task start: :environment do
    Deimos.configure do |config|
      config.producers.backend = :kafka if config.producers.backend == :kafka_async
    end
    ENV['DEIMOS_RAKE_TASK'] = 'true'
    ENV['DEIMOS_TASK_NAME'] = 'consumer'
    STDOUT.sync = true
    Rails.logger.info('Running deimos:start rake task.')
    Phobos::CLI::Commands.start(%w(start --skip_config))
  end

  desc 'Starts the Deimos database producer'
  task db_producer: :environment do
    ENV['DEIMOS_RAKE_TASK'] = 'true'
    ENV['DEIMOS_TASK_NAME'] = 'db_producer'
    STDOUT.sync = true
    Rails.logger.info('Running deimos:db_producer rake task.')
    thread_count = ENV['THREAD_COUNT'].to_i.zero? ? 1 : ENV['THREAD_COUNT'].to_i
    Deimos.start_db_backend!(thread_count: thread_count)
  end

  task db_poller: :environment do
    ENV['DEIMOS_RAKE_TASK'] = 'true'
    ENV['DEIMOS_TASK_NAME'] = 'db_poller'
    STDOUT.sync = true
    Rails.logger.info('Running deimos:db_poller rake task.')
    Deimos::Utils::DbPoller.start!
  end

  desc 'Run Schema Model Generator'
  task generate_schema_classes: :environment do
    Rails.logger.info("Running deimos:generate_schema_classes")
    Deimos::Generators::SchemaClassGenerator.start
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
deimos-ruby-1.24.2 lib/tasks/deimos.rake
deimos-ruby-1.24.1 lib/tasks/deimos.rake
deimos-ruby-1.24.0 lib/tasks/deimos.rake
deimos-ruby-1.23.3 lib/tasks/deimos.rake
deimos-ruby-1.23.2 lib/tasks/deimos.rake
deimos-ruby-1.23.1.pre.beta6 lib/tasks/deimos.rake
deimos-ruby-1.23.1.pre.beta5 lib/tasks/deimos.rake
deimos-ruby-1.23.1.pre.beta4 lib/tasks/deimos.rake
deimos-ruby-1.23.1.pre.beta3 lib/tasks/deimos.rake
deimos-ruby-1.23.1.pre.beta2 lib/tasks/deimos.rake
deimos-ruby-1.23.1.pre.beta1 lib/tasks/deimos.rake
deimos-ruby-1.23.0 lib/tasks/deimos.rake
deimos-ruby-1.22.5 lib/tasks/deimos.rake
deimos-ruby-1.22.4 lib/tasks/deimos.rake
deimos-ruby-1.22.3 lib/tasks/deimos.rake
deimos-ruby-1.22.2 lib/tasks/deimos.rake