Sha256: ecd89c6c4601d0ed30685e09ae42f076c82f4e1dcefb0cedddee43eb69616bf4

Contents?: true

Size: 912 Bytes

Versions: 1

Compression:

Stored size: 912 Bytes

Contents

# frozen_string_literal: true

module DiscoursePluginStatistics
  PLUGIN_NAME ||= "discourse_plugin_statistics"

  class Engine < ::Rails::Engine
    engine_name PLUGIN_NAME
    isolate_namespace DiscoursePluginStatistics

    config.before_initialize do
      config.i18n.load_path += Dir["#{config.root}/config/locales/**/*.yml"]
      Rails.autoloaders.main.ignore(config.root) if defined?(Rails) == "constant"
      Discourse.plugins_by_name[PLUGIN_NAME] = self
    end

    config.after_initialize do
      %w[
        ./discourse
        ./plugin
        ./statistics
        ../../app/jobs/discourse_plugin_statistics/update_statistics
      ].each do |path|
        require_relative path
      end

      Statistics.update! if ::Discourse.running_in_rack?
    end
  end

  class << self
    def root
      Rails.root
    end

    def server_url
      "https://statistics.pavilion.tech"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
discourse_plugin_statistics-0.1.0.pre1 lib/discourse_plugin_statistics/engine.rb