Share
Embed
Transcript
25 slides
-
What is Hex? • A set of specifications for building
clients and servers: https://github.com/hexpm/specifications • -
What is Hex? • A set of specifications for building
clients and servers: https://github.com/hexpm/specifications • A server, like the official one at https://hex.pm • -
What is Hex? • A set of specifications for building
clients and servers: https://github.com/hexpm/specifications • A server, like the official one at https://hex.pm • Repo API, e.g.: https://repo.hex.pm • -
What is Hex? • A set of specifications for building
clients and servers: https://github.com/hexpm/specifications • A server, like the official one at https://hex.pm • Repo API, e.g.: https://repo.hex.pm • HTTP API, e.g.: https://hex.pm/api • -
What is Hex? • A set of specifications for building
clients and servers: https://github.com/hexpm/specifications • A server, like the official one at https://hex.pm • Repo API, e.g.: https://repo.hex.pm • HTTP API, e.g.: https://hex.pm/api • A client • -
What is Hex? • A set of specifications for building
clients and servers: https://github.com/hexpm/specifications • A server, like the official one at https://hex.pm • Repo API, e.g.: https://repo.hex.pm • HTTP API, e.g.: https://hex.pm/api • A client • Build tools: Hex for Elixir, rebar3_hex for Erlang etc • -
What is Hex? • A set of specifications for building
clients and servers: https://github.com/hexpm/specifications • A server, like the official one at https://hex.pm • Repo API, e.g.: https://repo.hex.pm • HTTP API, e.g.: https://hex.pm/api • A client • Build tools: Hex for Elixir, rebar3_hex for Erlang etc • Other tools: hex-tweet, HexView, Hexagon etc -
hex_core • The goal is to be the reference implementation
of Hex specifications used by Hex clients and servers. • -
hex_core • The goal is to be the reference implementation
of Hex specifications used by Hex clients and servers. • Written in Erlang • -
hex_core • The goal is to be the reference implementation
of Hex specifications used by Hex clients and servers. • Written in Erlang • Available at https://github.com/hexpm/hex_core • -
hex_core • The goal is to be the reference implementation
of Hex specifications used by Hex clients and servers. • Written in Erlang • Available at https://github.com/hexpm/hex_core • Available at https://hex.pm/packages/hex_core -
hex_core • The goal is to be the reference implementation
of Hex specifications used by Hex clients and servers. • Written in Erlang • Available at https://github.com/hexpm/hex_core • Available at https://hex.pm/packages/hex_core -
iex> config = :hex_core.default_config() %{ api_url: "https://hex.pm/api", http_adapter: :hex_http_httpc, http_adapter_config:
%{profile: :default}, http_user_agent_fragment: "(httpc)", repo_public_key: "-----BEGIN PUBLIC KEY...——", repo_url: "https://repo.hex.pm", repo_verify: true } -
iex> config = :hex_core.default_config() iex> :hex_repo.get_names(config) {:ok, {200, %{ "accept-ranges"
=> "bytes", "age" => "49", "cache-control" => "public, max-age=600", "connection" => "keep-alive", "content-length" => "37816", ... }, %{ packages: [ %{name: "a_message"}, %{name: "aadya"}, %{name: "aatree"}, %{name: "aba"}, %{name: "aba_api"}, %{name: "aba_cli"}, %{name: "aba_model"}, %{name: "abacus"}, %{...}, ... ] }}} -
iex> config = :hex_core.default_config() iex> {:ok, {200, _, %{packages: packages}}}
= :hex_repo.get_names(config) -
iex> config = :hex_core.default_config() iex> {:ok, {200, _, %{packages: packages}}}
= :hex_repo.get_names(config) iex> length(packages) 6868 -
iex> config = :hex_core.default_config() iex> {:ok, {200, _, %{packages: packages}}}
= :hex_repo.get_names(config) iex> length(packages) 6868 # search for packages matching "riak" iex> options = [sort: :downloads] iex> {:ok, {200, _, packages}} = :hex_api_package.search(config, "riak", options) iex> Enum.map(packages, & &1["name"]) ["riak_pb", "riakc", ...]