Sha256: 63db3cf35dbf6bceabc83a92f2eefefd7317525b9bbb1dc54e6c79c33f0104ff

Contents?: true

Size: 1.33 KB

Versions: 6

Compression:

Stored size: 1.33 KB

Contents

# frozen_string_literal: true

require 'cloudenvoy'

ENV['GOOGLE_AUTH_SUPPRESS_CREDENTIALS_WARNINGS'] ||= 'true'

namespace :cloudenvoy do
  desc 'Setup publishers and subscribers.'
  task setup: :environment do
    Rake::Task['cloudenvoy:setup_publishers'].invoke
    Rake::Task['cloudenvoy:setup_subscribers'].invoke
  end

  desc 'Create required subscriptions for all subcribers.'
  task setup_subscribers: :environment do
    # Force registration of subscribers
    Rails.application.eager_load!

    # Setup subscriptions
    list = Cloudenvoy.setup_subscribers.sort_by(&:name)

    puts "\n"

    # Notify user when no suscribers
    if list.empty?
      puts 'Skipping subscribers (none defined)'
      next
    end

    puts 'The following subscribers are configured:'
    list.each do |e|
      puts "- #{e.name}"
    end

    puts "\n"
  end

  desc 'Create required topics for all publishers.'
  task setup_publishers: :environment do
    # Force registration of publishers
    Rails.application.eager_load!

    # Setup topics
    list = Cloudenvoy.setup_publishers.sort_by(&:name)

    puts "\n"

    # Notify user when no topics
    if list.empty?
      puts 'Skipping publishers (none defined)'
      next
    end

    puts 'The following topics are configured:'
    list.each do |e|
      puts "- #{e.name}"
    end

    puts "\n"
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cloudenvoy-0.6.0 lib/tasks/cloudenvoy.rake
cloudenvoy-0.6.rc1 lib/tasks/cloudenvoy.rake
cloudenvoy-0.5.0 lib/tasks/cloudenvoy.rake
cloudenvoy-0.5.rc1 lib/tasks/cloudenvoy.rake
cloudenvoy-0.4.2 lib/tasks/cloudenvoy.rake
cloudenvoy-0.4.1 lib/tasks/cloudenvoy.rake