require "set_up_development/installer"

module SetUpDevelopment
  class Registry
    DEFAULT_REGISTRY = File.expand_path("../../registry", __FILE__).freeze

    @installers = {}

    class << self
      attr_reader :installers

      def add_installer!(installer_name, check_install_proc, install_proc)
        installer = Installer.new(check_install_proc, install_proc)
        @installers.merge!({ installer_name => installer })
      end

      Dir.glob("#{DEFAULT_REGISTRY}/*").sort.each do |file|
        require file
      end
    end
  end
end
