require 'registerable_calendar'

namespace :panopticon do
  desc "Register application metadata with panopticon"
  task :register => :environment do
    require 'gds_api/panopticon'
    logger = GdsApi::Base.logger = Logger.new(STDERR).tap { |l| l.level = Logger::INFO }
    logger.info "Registering with panopticon..."

    registerer = GdsApi::Panopticon::Registerer.new(
      owning_app: "calendars",
      kind: "answer"
    )
    Dir.glob(Rails.root.join("lib/data/*.json")).each do |file|
      details = RegisterableCalendar.new(file)
      registerer.register(details)
    end
  end
end

require 'registerable_calendar'

namespace :panopticon do
  desc "Register application metadata with panopticon"
  task :register => :environment do
    require 'gds_api/panopticon'
    logger = GdsApi::Base.logger = Logger.new(STDERR).tap { |l| l.level = Logger::INFO }
    logger.info "Registering with panopticon..."

    registerer = GdsApi::Panopticon::Registerer.new(owning_app: "calendars")
    Dir.glob(Rails.root.join("lib/data/*.json")).each do |file|
      details = RegisterableCalendar.new(file)
      registerer.register(details)
    end
  end
end

Revert "Add a 'kind' parameter when registering calendars."
Revert "Add a 'kind' parameter when registering calendars."

These artefacts should be registered as custom applications, and should
be passed through as such to Rummager. The actual fix for the reported
problem of these being displayed as custom applications on the public
search page is to add a condition in Rummager itself.

This reverts commit 9bcf7ce7a6e9397797f0604440a730fb6843d4d3.
