Sha256: 96f01919d8d22bc15b5be6788af295ca0a0ef7b87c7003d9f84a5e1191b5ca9f

Contents?: true

Size: 1.02 KB

Versions: 675

Compression:

Stored size: 1.02 KB

Contents

[dependency_name | credentials] = System.argv()

grouped_creds = Enum.reduce credentials, [], fn cred, acc ->
  if List.last(acc) == nil || List.last(acc)[:token] do
    List.insert_at(acc, -1, %{ organization: cred })
  else
    { item, acc } = List.pop_at(acc, -1)
    item = Map.put(item, :token, cred)
    List.insert_at(acc, -1, item)
  end
end

Enum.each grouped_creds, fn cred ->
  hexpm = Hex.Repo.get_repo("hexpm")
  repo = %{
    url: hexpm.url <> "/repos/#{cred.organization}",
    public_key: nil,
    auth_key: cred.token
  }

  Hex.Config.read()
  |> Hex.Config.read_repos()
  |> Map.put("hexpm:#{cred.organization}", repo)
  |> Hex.Config.update_repos()
end

# dependency atom
dependency = String.to_atom(dependency_name)

# Fetch dependencies that needs updating
{dependency_lock, rest_lock} = Map.split(Mix.Dep.Lock.read(), [dependency])
Mix.Dep.Fetcher.by_name([dependency_name], dependency_lock, rest_lock, [])

lockfile_content =
  "mix.lock"
  |> File.read()
  |> :erlang.term_to_binary()

IO.write(:stdio, lockfile_content)

Version data entries

675 entries across 673 versions & 2 rubygems

Version Path
dependabot-hex-0.119.3 helpers/lib/do_update.exs
dependabot-hex-0.119.2 helpers/lib/do_update.exs
dependabot-hex-0.119.1 helpers/lib/do_update.exs
dependabot-hex-0.119.0 helpers/lib/do_update.exs
dependabot-hex-0.118.16 helpers/lib/do_update.exs
dependabot-hex-0.118.15 helpers/lib/do_update.exs
dependabot-hex-0.118.14 helpers/lib/do_update.exs
dependabot-hex-0.119.0.beta1 helpers/lib/do_update.exs
dependabot-hex-0.119.0.beta1 helpers/install-dir/hex/lib/do_update.exs
dependabot-hex-0.118.13 helpers/lib/do_update.exs
dependabot-hex-0.118.12 helpers/lib/do_update.exs
dependabot-hex-0.118.11 helpers/lib/do_update.exs
dependabot-hex-0.118.10 helpers/lib/do_update.exs
dependabot-hex-0.118.8 helpers/lib/do_update.exs
dependabot-hex-0.118.7 helpers/lib/do_update.exs
dependabot-hex-0.118.6 helpers/lib/do_update.exs
dependabot-hex-0.118.5 helpers/lib/do_update.exs
dependabot-hex-0.118.4 helpers/lib/do_update.exs
dependabot-hex-0.118.3 helpers/lib/do_update.exs
dependabot-hex-0.118.2 helpers/lib/do_update.exs