Commit c62f9ee7 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Support old syntax of categories.json file.

Avoid fatal crash - instead print out warning.
parent 8e55f800
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -15,6 +15,12 @@ module JsDuck
    def parse(path)
    def parse(path)
      @categories = JsonDuck.read(path)
      @categories = JsonDuck.read(path)


      # Don't crash if old syntax is used.
      if @categories.is_a?(Hash) && @categories["categories"]
        Logger.instance.warn('Update categories file to contain just the array inside {"categories": [...]}')
        @categories = @categories["categories"]
      end

      # Perform expansion on all class names containing * wildcard
      # Perform expansion on all class names containing * wildcard
      @categories.each do |cat|
      @categories.each do |cat|
        cat["groups"].each do |group|
        cat["groups"].each do |group|