<commit_before>
module Versionator
  module Detector
    # Detects {Open Atrium}[http://openatrium.com/].
    class OpenAtrium < Base
      set :app_name, "Open Atrium"
      set :project_url, "http://openatrium.com"
      set :project_download_url, "https://drupal.org/project/openatrium"

      set :detect_dirs, %w{includes misc modules profiles profiles/openatrium scripts sites themes}
      set :detect_files, %w{cron.php index.php install.php xmlrpc.php}

      set :installed_version_file, "foo" # placeholder
      set :installed_version_regexp, /^(foo)$/ # placeholder

      set :newest_version_url, 'https://drupal.org/project/openatrium'
      set :newest_version_selector, '.view-project-release-download-table .views-field-field-release-version a'
      set :newest_version_regexp, /^7\.x-(.+)$/

      # Overridden to take into account different files for different versions
      def detected?
        super && (
          File.readable?(File.join(base_dir, "profiles/openatrium/openatrium.info")) ||
          File.readable?(File.join(base_dir, "profiles/openatrium/VERSION.txt"))
        )
      end

      def version_2x?
        File.readable?(File.join(base_dir, "profiles/openatrium/openatrium.info"))
      end

      protected

      # Overridden to take into account different files for different versions
      def installed_version_file
        if version_2x?
          "profiles/openatrium/openatrium.info"
        else
          "profiles/openatrium/VERSION.txt"
        end
      end

      # Overridden to take into account different files for different versions
      def installed_version_regexp
        if version_2x?
          /^version = "7.x-(.+)"$/<commit_msg>Simplify OpenAtrium detector<commit_after>
module Versionator
  module Detector
    # Detects {Open Atrium}[http://openatrium.com/].
    class OpenAtrium < Base
      set :app_name, "Open Atrium"
      set :project_url, "http://openatrium.com"
      set :project_download_url, "https://drupal.org/project/openatrium"

      set :detect_dirs, %w{includes misc modules profiles profiles/openatrium scripts sites themes}
      set :detect_files, %w{cron.php index.php install.php xmlrpc.php}

      set :installed_version_file, nil # placeholder
      set :installed_version_regexp, nil # placeholder

      set :newest_version_url, 'https://drupal.org/project/openatrium'
      set :newest_version_selector, '.view-project-release-download-table .views-field-field-release-version a'
      set :newest_version_regexp, /^7\.x-(.+)$/

      # Overridden to take into account different files for different versions
      def detected?
        super && installed_version_file
      end

      protected

      # Overridden to take into account different files for different versions
      def installed_version_file
        %w{
            profiles/openatrium/modules/contrib/oa_core/oa_core.info
            profiles/openatrium/VERSION.txt
        }.find{ |version_file| File.readable?(File.join(base_dir, version_file)) }
      end

      # Overridden to take into account different files for different versions
      def installed_version_regexp
        if installed_version_file.end_with? ".info"
          /^version = "\d.x-(.+)"$/
{'fraction_non_alphanumeric': 0.10003096934035305, 'fraction_numerical': 0.0018581604211830288, 'mean_word_length': 2.9390243902439024, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1199749', 'n_tokens_mistral': 981, 'n_tokens_neox': 949, 'n_words': 225}