Sha256: f2c52a2871c003acc1821c4f7cfd6ab9e02426f52deb3d435e0017fed1415998

Contents?: true

Size: 909 Bytes

Versions: 19

Compression:

Stored size: 909 Bytes

Contents

# frozen_string_literal: true

module KafkaConsumer
  module Generators
    module Concerns
      module Configuration
        extend ActiveSupport::Concern

        CONFIG_PATH = "config/kafka_consumer.yml"

        def check_config_file!
          config_path = File.expand_path(CONFIG_PATH)
          return if File.exist?(config_path)

          generate = ask "The file #{config_path} does not appear to exist. " \
                       "Would you like to generate it? [Yn]"

          generator_name = "kafka_consumer:install"
          if (generate.presence || "y").casecmp("y").zero?
            generate generator_name
          else
            raise Rails::Generators::Error, "Please generate #{config_path} " \
                           "by running `bin/rails g #{generator_name}` " \
                           "or add this file manually."
          end
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
sbmt-kafka_consumer-3.3.0 lib/generators/kafka_consumer/concerns/configuration.rb
sbmt-kafka_consumer-3.2.2 lib/generators/kafka_consumer/concerns/configuration.rb
sbmt-kafka_consumer-3.2.1 lib/generators/kafka_consumer/concerns/configuration.rb
sbmt-kafka_consumer-3.2.0 lib/generators/kafka_consumer/concerns/configuration.rb
sbmt-kafka_consumer-3.1.0 lib/generators/kafka_consumer/concerns/configuration.rb
sbmt-kafka_consumer-2.8.0 lib/generators/kafka_consumer/concerns/configuration.rb
sbmt-kafka_consumer-3.0.0 lib/generators/kafka_consumer/concerns/configuration.rb
sbmt-kafka_consumer-2.7.1 lib/generators/kafka_consumer/concerns/configuration.rb
sbmt-kafka_consumer-2.7.0 lib/generators/kafka_consumer/concerns/configuration.rb
sbmt-kafka_consumer-2.6.1 lib/generators/kafka_consumer/concerns/configuration.rb
sbmt-kafka_consumer-2.6.0 lib/generators/kafka_consumer/concerns/configuration.rb
sbmt-kafka_consumer-2.5.0 lib/generators/kafka_consumer/concerns/configuration.rb
sbmt-kafka_consumer-2.4.1 lib/generators/kafka_consumer/concerns/configuration.rb
sbmt-kafka_consumer-2.4.0 lib/generators/kafka_consumer/concerns/configuration.rb
sbmt-kafka_consumer-2.3.1 lib/generators/kafka_consumer/concerns/configuration.rb
sbmt-kafka_consumer-2.3.0 lib/generators/kafka_consumer/concerns/configuration.rb
sbmt-kafka_consumer-2.2.0 lib/generators/kafka_consumer/concerns/configuration.rb
sbmt-kafka_consumer-2.1.0 lib/generators/kafka_consumer/concerns/configuration.rb
sbmt-kafka_consumer-2.0.0 lib/generators/kafka_consumer/concerns/configuration.rb