Sha256: b67456e261e64b727913ec202ba784f22cdb4ab2d3e90e166f7111f6d7af492a

Contents?: true

Size: 1.46 KB

Versions: 14

Compression:

Stored size: 1.46 KB

Contents

require 'closure_tree'
require 'dragonfly'

require 'push_type/core_ext/to_bool'

module PushType

  class << self

    def version
      PushType::VERSION
    end

    def config
      PushType::Config
    end

    def setup(&block)
      yield config if block
    end

    def root_nodes
      subclasses_from_list(:node, config.root_nodes)
    end

    def unexposed_nodes
      subclasses_from_list(:node, config.unexposed_nodes)
    end

    def subclasses_from_list(scope, types = nil)
      return [] unless types
      descendants = "push_type/#{ scope }".camelcase.constantize.descendants.map { |c| c.name.underscore }
      types_array = Array.wrap(types)

      if types_array.include? :all
        descendants
      else
        descendants & types_array.map(&:to_s)
      end.sort
    end

    def dragonfly_app_setup!
      Dragonfly.app.configure do
        plugin      :imagemagick
        url_format  "/media/:job/:name"
        secret      PushType.config.dragonfly_secret
        datastore   PushType.config.dragonfly_datastore, PushType.config.dragonfly_datastore_options
      end
    end

    def menu(key, &block)
      PushType::MenuBuilder.select(key, &block)
    end

  end

  module Core
    ActiveSupport.run_load_hooks(:push_type_core, PushType)
  end

end

require 'push_type/config'
require 'push_type/core/engine'
require 'push_type/rails/routes'
require 'push_type/field_type'
require 'push_type/menu_builder'
require 'push_type/presenter'
require 'push_type/version'

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
push_type_core-0.9.5 lib/push_type/core.rb
push_type_core-0.9.3 lib/push_type/core.rb
push_type_core-0.9.2 lib/push_type/core.rb
push_type_core-0.9.1 lib/push_type/core.rb
push_type_core-0.9.0 lib/push_type/core.rb
push_type_core-0.9.0.beta.4 lib/push_type/core.rb
push_type_core-0.9.0.beta.3 lib/push_type/core.rb
push_type_core-0.9.0.beta.2 lib/push_type/core.rb
push_type_core-0.8.2 lib/push_type/core.rb
push_type_core-0.8.1 lib/push_type/core.rb
push_type_core-0.8.0 lib/push_type/core.rb
push_type_core-0.8.0.beta.3 lib/push_type/core.rb
push_type_core-0.8.0.beta.2 lib/push_type/core.rb
push_type_core-0.8.0.beta.1 lib/push_type/core.rb