diff --git a/README.md b/README.md index 198583b..10ace17 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,17 @@ -Test Status Hex Version +# Namor -Namor is a name generator for Elixir that creates random, url-friendly names. This comes in handy if you need to generate unique subdomains like many PaaS/SaaS providers do, or unique names for anything else. +Namor is a name generator for Elixir that creates random, url-friendly names. This comes in handy if you need to generate unique subdomains like many PaaS/SaaS providers do, or unique names for anything else. Supports compile-time dictionary loading, subdomain validation with reserved names, custom dictionaries and reserved word lists, alternate dictionaries, and more. -* ⚡️ Compile-time dictionary loading -* 🔒 Subdomain validation with reserved names -* 📚 Custom dictionaries and reserved word lists -* 🏋️ Hilarious alternate dictionaries -* ✅ 100% test coverage +[See a demo here.](https://namor.jsonmaur.com) Also available for [Javascript](https://github.com/jsonmaur/namor.js). -[Browse the documentation](https://hexdocs.pm/namor) or [see it in action](https://namor.jsonmaur.com). Also available for [Javascript](https://github.com/jsonmaur/namor.js). +> _Please Note: Generated names are not always guaranteed to be unique. To reduce the chances of collision, you can increase the length of the trailing number ([see here for collision stats](#collision-stats)). Always be sure to check your database before assuming a generated value is unique._ -> _Please Note: Generated names are not always guaranteed to be unique. To reduce the chances of collision, you can increase the length of the trailing number ([see here for collision stats](#collision)). Always be sure to check your database before assuming a generated value is unique._ +- [Installation](#installation) +- [Getting Started](#getting-started) +- [Collision Stats](#collision-stats) +- [Custom Dictionaries](#custom-dictionaries) -## Getting Started +## Installation ```elixir def deps do @@ -22,6 +21,8 @@ def deps do end ``` +## Getting Started + ```elixir iex> require Namor @@ -57,11 +58,9 @@ defmodule MyApp.Subdomains do end ``` - - ## Collision Stats -The following stats give you the total number of permutations based on the word count (without a salt), and can help you make a decision on how long to make your salt. This data is based on the number of words we currently have in our [dictionary files](https://github.com/jsonmaur/namor.ex/tree/master/dict). +The following stats give you the total number of permutations based on the word count (without a salt), and can help you make a decision on how long to make your salt. This data is based on the number of words we currently have in our [dictionary files](https://github.com/jsonmaur/namor/tree/master/dict). ##### `:default` dictionary @@ -82,13 +81,12 @@ The following stats give you the total number of permutations based on the word In order for our dictionary files to be loaded into your application during compilation, [`generate/1`](https://hexdocs.pm/namor/Namor.html#generate/1) and [`reserved?/1`](https://hexdocs.pm/namor/Namor.html#reserved?/1) are defined as a macros. This means they can only be used after calling `use Namor` or `require Namor`, which should be done during compilation (and not inside a function). If you want to use your own dictionary, consider calling [`Namor.Helpers.get_dict!/2`](https://hexdocs.pm/namor/Namor.Helpers.html#get_dict!/2) in a place that executes during compilation and **not** runtime. For example: ``` -┌ dictionaries/ -│ ┌── foobar/ -│ │ ┌── adjectives.txt -│ │ ├── nouns.txt -│ │ └── verbs.txt -│ └── reserved.txt -│ foobar.ex +┌── dictionaries/ +│ ┌── foobar/ +│ │ ┌── adjectives.txt +│ │ ├── nouns.txt +│ │ └── verbs.txt +│ └── reserved.txt ``` ```elixir diff --git a/demo/lib/namor_demo_web/live/index_live.html.heex b/demo/lib/namor_demo_web/live/index_live.html.heex index af4cef4..d85c0a8 100644 --- a/demo/lib/namor_demo_web/live/index_live.html.heex +++ b/demo/lib/namor_demo_web/live/index_live.html.heex @@ -74,7 +74,7 @@ - + diff --git a/lib/namor.ex b/lib/namor.ex index 9612104..8fddef0 100644 --- a/lib/namor.ex +++ b/lib/namor.ex @@ -1,6 +1,6 @@ defmodule Namor do @moduledoc """ - A subdomain-safe name generator. + A subdomain-safe name generator. Check out the [README](readme.html) to get started. """ alias Namor.Helpers diff --git a/mix.exs b/mix.exs index 84f801d..d0e84a5 100644 --- a/mix.exs +++ b/mix.exs @@ -1,13 +1,13 @@ defmodule Namor.MixProject do use Mix.Project - @url "https://github.com/jsonmaur/namor.ex" + @url "https://github.com/jsonmaur/namor" def project do [ app: :namor, name: "Namor", - version: "1.0.2", + version: "1.0.3", elixir: "~> 1.13", build_embedded: Mix.env() == :prod, start_permanent: Mix.env() == :prod, @@ -16,7 +16,6 @@ defmodule Namor.MixProject do source_url: @url, homepage_url: "#{@url}#readme", description: "A subdomain-safe name generator", - authors: ["Jason Maurer"], package: [ licenses: ["MIT"], links: %{"GitHub" => @url, "Demo" => "https://namor.jsonmaur.com"}, @@ -24,7 +23,8 @@ defmodule Namor.MixProject do ], docs: [ main: "readme", - extras: ["README.md"] + extras: ["README.md"], + authors: ["Jason Maurer"] ] ] end diff --git a/mix.lock b/mix.lock index 0127bd2..2b47401 100644 --- a/mix.lock +++ b/mix.lock @@ -1,8 +1,8 @@ %{ - "earmark_parser": {:hex, :earmark_parser, "1.4.29", "149d50dcb3a93d9f3d6f3ecf18c918fb5a2d3c001b5d3305c926cddfbd33355b", [:mix], [], "hexpm", "4902af1b3eb139016aed210888748db8070b8125c2342ce3dcae4f38dcc63503"}, - "ex_doc": {:hex, :ex_doc, "0.29.1", "b1c652fa5f92ee9cf15c75271168027f92039b3877094290a75abcaac82a9f77", [:mix], [{:earmark_parser, "~> 1.4.19", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "b7745fa6374a36daf484e2a2012274950e084815b936b1319aeebcf7809574f6"}, + "earmark_parser": {:hex, :earmark_parser, "1.4.32", "fa739a0ecfa34493de19426681b23f6814573faee95dfd4b4aafe15a7b5b32c6", [:mix], [], "hexpm", "b8b0dd77d60373e77a3d7e8afa598f325e49e8663a51bcc2b88ef41838cca755"}, + "ex_doc": {:hex, :ex_doc, "0.29.4", "6257ecbb20c7396b1fe5accd55b7b0d23f44b6aa18017b415cb4c2b91d997729", [:mix], [{:earmark_parser, "~> 1.4.31", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "2c6699a737ae46cb61e4ed012af931b57b699643b24dabe2400a8168414bc4f5"}, "makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"}, - "makeup_elixir": {:hex, :makeup_elixir, "0.16.0", "f8c570a0d33f8039513fbccaf7108c5d750f47d8defd44088371191b76492b0b", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "28b2cbdc13960a46ae9a8858c4bebdec3c9a6d7b4b9e7f4ed1502f8159f338e7"}, + "makeup_elixir": {:hex, :makeup_elixir, "0.16.1", "cc9e3ca312f1cfeccc572b37a09980287e243648108384b97ff2b76e505c3555", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "e127a341ad1b209bd80f7bd1620a15693a9908ed780c3b763bccf7d200c767c6"}, "makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"}, - "nimble_parsec": {:hex, :nimble_parsec, "1.2.3", "244836e6e3f1200c7f30cb56733fd808744eca61fd182f731eac4af635cc6d0b", [:mix], [], "hexpm", "c8d789e39b9131acf7b99291e93dae60ab48ef14a7ee9d58c6964f59efb570b0"}, + "nimble_parsec": {:hex, :nimble_parsec, "1.3.1", "2c54013ecf170e249e9291ed0a62e5832f70a476c61da16f6aac6dca0189f2af", [:mix], [], "hexpm", "2682e3c0b2eb58d90c6375fc0cc30bc7be06f365bf72608804fb9cffa5e1b167"}, }