Sha256: df61f05ac07f317b96b953b06613975baf544a65c968cae428250874e0a4fcb1

Contents?: true

Size: 1.86 KB

Versions: 26

Compression:

Stored size: 1.86 KB

Contents

module Foobara
  class << self
    # TODO: come up with a way to change a type's manifest... Or maybe treat Model very differently?
    # ok... new manifest will be of this form...
    # { <orgs|commands|types, etc, letÅ› call this a type category...> => full_scoped_name => manifest }
    #
    # The manifest itself will only contain full scoped names. This is kind of analogous to a store serializer
    # in the http connector.
    def manifest
      to_include = Namespace.global.foobara_all_organization.to_set
      included = {}

      h = {}

      until to_include.empty?
        object = to_include.first
        to_include.delete(object)

        unless object.scoped_path_set?
          # :nocov:
          raise "no scoped path set for #{object}"
          # :nocov:
        end

        manifest_reference = object.foobara_manifest_reference.to_sym
        category_symbol = Namespace.global.foobara_category_symbol_for(object)

        unless category_symbol
          # :nocov:
          raise "no category symbol for #{object}"
          # :nocov:
        end

        if included.key?(manifest_reference)
          if included[manifest_reference] == category_symbol
            next
          else
            # :nocov:
            raise "Collision for #{manifest_reference}: #{included[manifest_reference]} and #{category_symbol}"
            # :nocov:
          end
        end

        cat = h[category_symbol] ||= {}
        cat[manifest_reference] = object.foobara_manifest(to_include:)

        included[manifest_reference] = category_symbol
      end

      h.sort.to_h
    end

    def all_organizations
      Namespace.global.foobara_all_organization
    end

    def all_domains
      Namespace.global.foobara_all_domain
    end

    def all_commands
      Namespace.global.foobara_all_command
    end

    def all_types
      Namespace.global.foobara_all_type
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
foobara-0.0.26 projects/domain/src/extensions/foobara.rb
foobara-0.0.25 projects/domain/src/extensions/foobara.rb
foobara-0.0.24 projects/domain/src/extensions/foobara.rb
foobara-0.0.23 projects/domain/src/extensions/foobara.rb
foobara-0.0.22 projects/domain/src/extensions/foobara.rb
foobara-0.0.21 projects/domain/src/extensions/foobara.rb
foobara-0.0.20 projects/domain/src/extensions/foobara.rb
foobara-0.0.19 projects/domain/src/extensions/foobara.rb
foobara-0.0.18 projects/domain/src/extensions/foobara.rb
foobara-0.0.17 projects/domain/src/extensions/foobara.rb
foobara-0.0.16 projects/domain/src/extensions/foobara.rb
foobara-0.0.15 projects/domain/src/extensions/foobara.rb
foobara-0.0.14 projects/domain/src/extensions/foobara.rb
foobara-0.0.13 projects/domain/src/extensions/foobara.rb
foobara-0.0.12 projects/domain/src/extensions/foobara.rb
foobara-0.0.11 projects/domain/src/extensions/foobara.rb
foobara-0.0.10 projects/domain/src/extensions/foobara.rb
foobara-0.0.9 projects/domain/src/extensions/foobara.rb
foobara-0.0.8 projects/domain/src/extensions/foobara.rb
foobara-0.0.7 projects/domain/src/extensions/foobara.rb