<commit_before># frozen_string_literal: true

module PackageManager
  class Elm < Base
    HAS_VERSIONS = true
    HAS_DEPENDENCIES = true
    BIBLIOTHECARY_SUPPORT = true
    URL = "http://package.elm-lang.org/"
    COLOR = "#60B5CC"

    def self.package_link(project, version = nil)
      "http://package.elm-lang.org/packages/#{project.name}/#{version || 'latest'}"
    end

    def self.download_url(name, version = "master")
      "https://github.com/#{name}/archive/#{version}.zip"
    end

    def self.install_instructions(project, version = nil)
      "elm-package install #{project.name} #{version}"
    end

    def self.project_names
      projects.keys
    end

    def self.projects
      @projects ||= get("http://package.elm-lang.org/all-packages")
    end

    def self.recent_names
      get("http://package.elm-lang.org/new-packages")
    end

    def self.project(name)
      get("http://package.elm-lang.org/packages/#{name}/latest/elm.json")
    end

    def self.mapping(project)
      {
        name: project["name"],
        description: project["summary"],
        repository_url: "https://github.com/#{project['name']}",
      }
    end

    def self.versions(_project, name)
      get("https://package.elm-lang.org/packages/#{name}/releases.json")
        .map do |version, timestamp|
          {
            number: version,
            published_at: Time.at(timestamp),
          }
        end
    end

    def self.dependencies(name, version, _mapped_project)
      get("http://package.elm-lang.org/packages/#{name}/#{version}/elm.json")
        .fetch("dependencies", {})
        .map do |name, requirement|
          {
            project_name: name,
            requirements: requirement,
            kind: "runtime",
          }
        end
    end
  end
end
<commit_msg>Ensure Elm deps have a platform value.<commit_after># frozen_string_literal: true

module PackageManager
  class Elm < Base
    HAS_VERSIONS = true
    HAS_DEPENDENCIES = true
    BIBLIOTHECARY_SUPPORT = true
    URL = "http://package.elm-lang.org/"
    COLOR = "#60B5CC"

    def self.package_link(project, version = nil)
      "http://package.elm-lang.org/packages/#{project.name}/#{version || 'latest'}"
    end

    def self.download_url(name, version = "master")
      "https://github.com/#{name}/archive/#{version}.zip"
    end

    def self.install_instructions(project, version = nil)
      "elm-package install #{project.name} #{version}"
    end

    def self.project_names
      projects.keys
    end

    def self.projects
      @projects ||= get("http://package.elm-lang.org/all-packages")
    end

    def self.recent_names
      get("http://package.elm-lang.org/new-packages")
    end

    def self.project(name)
      get("http://package.elm-lang.org/packages/#{name}/latest/elm.json")
    end

    def self.mapping(project)
      {
        name: project["name"],
        description: project["summary"],
        repository_url: "https://github.com/#{project['name']}",
      }
    end

    def self.versions(_project, name)
      get("https://package.elm-lang.org/packages/#{name}/releases.json")
        .map do |version, timestamp|
          {
            number: version,
            published_at: Time.at(timestamp),
          }
        end
    end

    def self.dependencies(name, version, _mapped_project)
      get("http://package.elm-lang.org/packages/#{name}/#{version}/elm.json")
        .fetch("dependencies", {})
        .map do |name, requirement|
          {
            project_name: name,
            requirements: requirement,
            kind: "runtime",
            platform: self.name.demodulize,
          }
        end
    end
  end
end

{'fraction_non_alphanumeric': 0.14037469454249255, 'fraction_numerical': 0.001629106706489275, 'mean_word_length': 2.283422459893048, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5608070', 'n_tokens_mistral': 1145, 'n_tokens_neox': 1115, 'n_words': 208}