<commit_before># encoding: utf-8

module OpenSesame
  class Engine < ::Rails::Engine
    isolate_namespace OpenSesame

    config.generators do |g|
      g.test_framework :rspec, :view_specs => false
    end

    ActiveSupport.on_load(:action_controller) do
      include OpenSesame::Helpers::ControllerHelper
    end

    ActiveSupport.on_load(:action_view) do
      include OpenSesame::Helpers::ViewHelper
    end

    initializer "openseseame precompile" do |app|
      app.config.assets.precompile += ['open_sesame/opensesame.css']
    end

    initializer "opensesame.middleware", :after => :load_config_initializers do |app|
      require 'open_sesame/github_warden'

      app.config.middleware.use OpenSesame::GithubAuth,
        OpenSesame.github_application[:id],
        OpenSesame.github_application[:secret],
        :path_prefix => OpenSesame.mount_prefix

      if defined?(Devise)
        Devise.setup do |config|
          config.warden do |manager|
            manager.default_strategies(:opensesame_github, :scope => :opensesame)
            manager.failure_app = OpenSesame::Failure::DeviseApp.new
          end
        end
      else
        app.config.middleware.use ::Warden::Manager do |manager|
          manager.default_strategies(:opensesame_github, :scope => :opensesame)
          manager.failure_app = OpenSesame::Failure::App.new
        end
      end

    end
  end
end
<commit_msg>don't run initializers if not enabled<commit_after># encoding: utf-8

module OpenSesame
  class Engine < ::Rails::Engine
    isolate_namespace OpenSesame

    config.generators do |g|
      g.test_framework :rspec, :view_specs => false
    end

    ActiveSupport.on_load(:action_controller) do
      include OpenSesame::Helpers::ControllerHelper
    end

    ActiveSupport.on_load(:action_view) do
      include OpenSesame::Helpers::ViewHelper
    end

    initializer "openseseame precompile" do |app|
      app.config.assets.precompile += ['open_sesame/opensesame.css']
    end

    initializer "opensesame.middleware", :after => :load_config_initializers do |app|
      if OpenSesame.enabled?
        require 'open_sesame/github_warden'
        app.config.middleware.use OpenSesame::GithubAuth,
          OpenSesame.github_application[:id],
          OpenSesame.github_application[:secret],
          :path_prefix => OpenSesame.mount_prefix

        if defined?(Devise)
          Devise.setup do |config|
            config.warden do |manager|
              manager.default_strategies(:opensesame_github, :scope => :opensesame)
              manager.failure_app = OpenSesame::Failure::DeviseApp.new
            end
          end
        else
          app.config.middleware.use ::Warden::Manager do |manager|
            manager.default_strategies(:opensesame_github, :scope => :opensesame)
            manager.failure_app = OpenSesame::Failure::App.new
          end
        end
      end

    end
  end
end

{'fraction_non_alphanumeric': 0.09261790840738209, 'fraction_numerical': 0.000683526999316473, 'mean_word_length': 2.8768211920529803, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4300617', 'n_tokens_mistral': 893, 'n_tokens_neox': 882, 'n_words': 168}