nomius 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +7 -0
  2. data/.dockerignore +5 -0
  3. data/.editorconfig +12 -0
  4. data/.overcommit.yml +29 -0
  5. data/.rspec +3 -0
  6. data/.rubocop.yml +27 -0
  7. data/CHANGELOG.md +5 -0
  8. data/CODE_OF_CONDUCT.md +133 -0
  9. data/CONTRIBUTING.md +63 -0
  10. data/Dockerfile +11 -0
  11. data/Gemfile +20 -0
  12. data/LICENSE +21 -0
  13. data/README.md +297 -0
  14. data/Rakefile +12 -0
  15. data/exe/nomius +6 -0
  16. data/lib/nomius/bulk_checker.rb +39 -0
  17. data/lib/nomius/checker.rb +30 -0
  18. data/lib/nomius/cli/command.rb +106 -0
  19. data/lib/nomius/cli/parser/file_parser/csv_parser.rb +31 -0
  20. data/lib/nomius/cli/parser/file_parser/txt_parser.rb +40 -0
  21. data/lib/nomius/cli/parser/file_parser.rb +27 -0
  22. data/lib/nomius/cli/parser/strings_parser.rb +37 -0
  23. data/lib/nomius/cli/parser.rb +22 -0
  24. data/lib/nomius/cli/runner.rb +42 -0
  25. data/lib/nomius/cli/writer/console_writer.rb +68 -0
  26. data/lib/nomius/cli/writer/csv_writer.rb +51 -0
  27. data/lib/nomius/cli.rb +24 -0
  28. data/lib/nomius/detector/base_domain_name_detector.rb +86 -0
  29. data/lib/nomius/detector/base_url_detector.rb +46 -0
  30. data/lib/nomius/detector/dockerhub_detector.rb +26 -0
  31. data/lib/nomius/detector/domain_com_detector.rb +15 -0
  32. data/lib/nomius/detector/domain_org_detector.rb +15 -0
  33. data/lib/nomius/detector/github_detector.rb +26 -0
  34. data/lib/nomius/detector/npmjs_detector.rb +26 -0
  35. data/lib/nomius/detector/pypi_detector.rb +26 -0
  36. data/lib/nomius/detector/rubygems_detector.rb +26 -0
  37. data/lib/nomius/detector/util/http_requester.rb +78 -0
  38. data/lib/nomius/detector.rb +28 -0
  39. data/lib/nomius/logger/silent.rb +31 -0
  40. data/lib/nomius/logger/verbose.rb +47 -0
  41. data/lib/nomius/logger.rb +18 -0
  42. data/lib/nomius/name.rb +26 -0
  43. data/lib/nomius/status/available.rb +22 -0
  44. data/lib/nomius/status/base.rb +16 -0
  45. data/lib/nomius/status/formatter/ascii_mark.rb +24 -0
  46. data/lib/nomius/status/formatter/mark.rb +24 -0
  47. data/lib/nomius/status/unavailable.rb +22 -0
  48. data/lib/nomius/status/unresolved.rb +22 -0
  49. data/lib/nomius/status.rb +5 -0
  50. data/lib/nomius/version.rb +5 -0
  51. data/lib/nomius.rb +13 -0
  52. metadata +229 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 308bde52bb6827228b328640da6422ae263c06df4c60b5d08e84dd00383243bb
4
+ data.tar.gz: b810b61fc6c73882c5d91f0deae8128ce1cfc895e67710e31295226a0d04b052
5
+ SHA512:
6
+ metadata.gz: 0c7ea9f1d3c24221d19a258ce57889617adef1f1358faf7e3f08f5f370ad9d6a26dabcbeab52a9fe35d67a0e88de18a14737951efd8197992f60dd670f1442f0
7
+ data.tar.gz: 36542e45dcea9c89aebce4de4d4eedee7b76e50430ba8df4cf8010206917d395d3131657bfd639e3e39dc5764dc09ba406ba4cfd954abcb50318c5a41b63fc52
data/.dockerignore ADDED
@@ -0,0 +1,5 @@
1
+ .bundle/*
2
+ .idea*
3
+ log/*
4
+ tmp/*
5
+ .ruby-lsp/*
data/.editorconfig ADDED
@@ -0,0 +1,12 @@
1
+ # Defines the coding style for different editors and IDEs.
2
+ # http://editorconfig.org
3
+
4
+ root = true
5
+
6
+ [*]
7
+ charset = utf-8
8
+ end_of_line = lf
9
+ insert_final_newline = true
10
+ indent_style = space
11
+ indent_size = 2
12
+ trim_trailing_whitespace = true
data/.overcommit.yml ADDED
@@ -0,0 +1,29 @@
1
+ PreCommit:
2
+ ALL:
3
+ on_warn: fail
4
+ BundleCheck:
5
+ enabled: true
6
+ FileSize:
7
+ enabled: true
8
+ size_limit_bytes: 1_000_000
9
+ ForbiddenBranches:
10
+ enabled: true
11
+ LineEndings:
12
+ enabled: true
13
+ RuboCop:
14
+ enabled: true
15
+ TrailingWhitespace:
16
+ enabled: true
17
+ YamlSyntax:
18
+ enabled: true
19
+
20
+ CommitMsg:
21
+ ALL:
22
+ on_warn: fail
23
+ # Disable some default Overcommit checks to avoid collisions with commitlint.
24
+ TextWidth:
25
+ enabled: false
26
+ CapitalizedSubject:
27
+ enabled: false
28
+ SingleLineSubject:
29
+ enabled: false
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,27 @@
1
+ require:
2
+ - rubocop-rspec
3
+
4
+ AllCops:
5
+ NewCops: enable
6
+ TargetRubyVersion: 2.6
7
+
8
+ Style/StringLiterals:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Style/StringLiteralsInInterpolation:
13
+ Enabled: true
14
+ EnforcedStyle: double_quotes
15
+
16
+ Layout/LineLength:
17
+ Max: 120
18
+
19
+ # Relax RSpec metrics
20
+ RSpec/ExampleLength:
21
+ Max: 20 # Defaut is 5
22
+
23
+ RSpec/MultipleExpectations:
24
+ Max: 3 # Defaut is 1
25
+
26
+ RSpec/MultipleMemoizedHelpers:
27
+ Max: 10 # Defaut is 5
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2023-05-02
4
+
5
+ - Initial release
@@ -0,0 +1,133 @@
1
+
2
+ # Contributor Covenant Code of Conduct
3
+
4
+ ## Our Pledge
5
+
6
+ We as members, contributors, and leaders pledge to make participation in our
7
+ community a harassment-free experience for everyone, regardless of age, body
8
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
9
+ identity and expression, level of experience, education, socio-economic status,
10
+ nationality, personal appearance, race, caste, color, religion, or sexual
11
+ identity and orientation.
12
+
13
+ We pledge to act and interact in ways that contribute to an open, welcoming,
14
+ diverse, inclusive, and healthy community.
15
+
16
+ ## Our Standards
17
+
18
+ Examples of behavior that contributes to a positive environment for our
19
+ community include:
20
+
21
+ * Demonstrating empathy and kindness toward other people
22
+ * Being respectful of differing opinions, viewpoints, and experiences
23
+ * Giving and gracefully accepting constructive feedback
24
+ * Accepting responsibility and apologizing to those affected by our mistakes,
25
+ and learning from the experience
26
+ * Focusing on what is best not just for us as individuals, but for the overall
27
+ community
28
+
29
+ Examples of unacceptable behavior include:
30
+
31
+ * The use of sexualized language or imagery, and sexual attention or advances of
32
+ any kind
33
+ * Trolling, insulting or derogatory comments, and personal or political attacks
34
+ * Public or private harassment
35
+ * Publishing others' private information, such as a physical or email address,
36
+ without their explicit permission
37
+ * Other conduct which could reasonably be considered inappropriate in a
38
+ professional setting
39
+
40
+ ## Enforcement Responsibilities
41
+
42
+ Community leaders are responsible for clarifying and enforcing our standards of
43
+ acceptable behavior and will take appropriate and fair corrective action in
44
+ response to any behavior that they deem inappropriate, threatening, offensive,
45
+ or harmful.
46
+
47
+ Community leaders have the right and responsibility to remove, edit, or reject
48
+ comments, commits, code, wiki edits, issues, and other contributions that are
49
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
50
+ decisions when appropriate.
51
+
52
+ ## Scope
53
+
54
+ This Code of Conduct applies within all community spaces, and also applies when
55
+ an individual is officially representing the community in public spaces.
56
+ Examples of representing our community include using an official e-mail address,
57
+ posting via an official social media account, or acting as an appointed
58
+ representative at an online or offline event.
59
+
60
+ ## Enforcement
61
+
62
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
63
+ reported to the community leaders responsible for enforcement at
64
+ ospo@syngenta.com.
65
+ All complaints will be reviewed and investigated promptly and fairly.
66
+
67
+ All community leaders are obligated to respect the privacy and security of the
68
+ reporter of any incident.
69
+
70
+ ## Enforcement Guidelines
71
+
72
+ Community leaders will follow these Community Impact Guidelines in determining
73
+ the consequences for any action they deem in violation of this Code of Conduct:
74
+
75
+ ### 1. Correction
76
+
77
+ **Community Impact**: Use of inappropriate language or other behavior deemed
78
+ unprofessional or unwelcome in the community.
79
+
80
+ **Consequence**: A private, written warning from community leaders, providing
81
+ clarity around the nature of the violation and an explanation of why the
82
+ behavior was inappropriate. A public apology may be requested.
83
+
84
+ ### 2. Warning
85
+
86
+ **Community Impact**: A violation through a single incident or series of
87
+ actions.
88
+
89
+ **Consequence**: A warning with consequences for continued behavior. No
90
+ interaction with the people involved, including unsolicited interaction with
91
+ those enforcing the Code of Conduct, for a specified period of time. This
92
+ includes avoiding interactions in community spaces as well as external channels
93
+ like social media. Violating these terms may lead to a temporary or permanent
94
+ ban.
95
+
96
+ ### 3. Temporary Ban
97
+
98
+ **Community Impact**: A serious violation of community standards, including
99
+ sustained inappropriate behavior.
100
+
101
+ **Consequence**: A temporary ban from any sort of interaction or public
102
+ communication with the community for a specified period of time. No public or
103
+ private interaction with the people involved, including unsolicited interaction
104
+ with those enforcing the Code of Conduct, is allowed during this period.
105
+ Violating these terms may lead to a permanent ban.
106
+
107
+ ### 4. Permanent Ban
108
+
109
+ **Community Impact**: Demonstrating a pattern of violation of community
110
+ standards, including sustained inappropriate behavior, harassment of an
111
+ individual, or aggression toward or disparagement of classes of individuals.
112
+
113
+ **Consequence**: A permanent ban from any sort of public interaction within the
114
+ community.
115
+
116
+ ## Attribution
117
+
118
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119
+ version 2.1, available at
120
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
121
+
122
+ Community Impact Guidelines were inspired by
123
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
124
+
125
+ For answers to common questions about this code of conduct, see the FAQ at
126
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
127
+ [https://www.contributor-covenant.org/translations][translations].
128
+
129
+ [homepage]: https://www.contributor-covenant.org
130
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
131
+ [Mozilla CoC]: https://github.com/mozilla/diversity
132
+ [FAQ]: https://www.contributor-covenant.org/faq
133
+ [translations]: https://www.contributor-covenant.org/translations
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,63 @@
1
+ # Contributing
2
+
3
+ - [Introduction](#introduction)
4
+ - [Reporting issues](#reporting-issues)
5
+ - [Contributing to code](#contributing-to-code)
6
+ - [Workflow for local development](#workflow-for-local-development)
7
+ - [Workflow for GitHub Codespaces in-browser development](#workflow-for-github-codespaces-in-browser-development)
8
+ - [About using VSCode](#about-using-vscode)
9
+
10
+ ## Introduction
11
+
12
+ Contribution is welcome!
13
+
14
+ This project adheres to the [Code of Conduct](CODE_OF_CONDUCT.md). We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
15
+
16
+ ## Reporting issues
17
+
18
+ Please, report any issues or bugs you find in the project's [Issues](https://github.com/syngenta/nomius/issues) section on GitHub.
19
+
20
+ ## Contributing to code
21
+
22
+ ### Workflow for local development
23
+
24
+ 1. [Fork the repo](https://docs.github.com/en/get-started/quickstart/fork-a-repo#forking-a-repository).
25
+ 2. [Clone the forked repo](https://docs.github.com/en/get-started/quickstart/fork-a-repo#cloning-your-forked-repository) to your local machine.
26
+ 3. Create a new branch for your changes:
27
+ `git checkout -b "feat/my-new-feature"`.
28
+ 4. Make your changes. We recommend using [VSCode + Docker](#about-using-vscode) locally.
29
+ 5. Commit your changes:
30
+ `git commit -m "feat: my new feature"`.
31
+ 6. Push your changes to your forked repo:
32
+ `git push origin feat/my-new-feature`.
33
+ 7. [Create a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork) from your forked repo to the main repo.
34
+
35
+ ### Workflow for GitHub Codespaces in-browser development
36
+
37
+ 1. [Fork the repo](https://docs.github.com/en/get-started/quickstart/fork-a-repo#forking-a-repository).
38
+ 2. Open Codespaces by clicking the green button **Code** on the top right corner of the repo and then **Open with Codespaces**.
39
+ GitHub Codespaces will create and open a full-featured dev environment in the browser. You don't need to install anything locally.
40
+ 3. Create a new branch for your changes:
41
+ `git checkout -b "feat/my-new-feature"`
42
+ 4. Make your changes.
43
+ 5. Commit your changes:
44
+ `git commit -m "feat: my new feature"`
45
+ 6. Push your changes to your forked repo:
46
+ `git push origin feat/my-new-feature`
47
+ 7. [Create a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork) from your forked repo to the main repo.
48
+
49
+ ### About using VSCode
50
+
51
+ The recommended way for local development is to use VSCode + Docker Desktop.
52
+
53
+ - [VSCode](https://code.visualstudio.com/)
54
+ - [Docker Desktop](https://www.docker.com/)
55
+
56
+ VSCode supports `.devcontainer` configuration that will automatically build a full-featured dev environment for you. All plugins and hooks are already configured for you.
57
+
58
+ ```shell
59
+ git clone git@github.com:syngenta/nomius.git
60
+ cd nomius
61
+
62
+ code .
63
+ ```
data/Dockerfile ADDED
@@ -0,0 +1,11 @@
1
+ FROM ruby:3.2.2
2
+ LABEL maintainer="Oleksii Leonov <oleksii.leonov@syngenta.com>"
3
+
4
+ RUN bundle config --global without development test
5
+
6
+ WORKDIR /usr/src/app
7
+
8
+ COPY . .
9
+ RUN bundle install
10
+
11
+ ENTRYPOINT ["bundle", "exec", "nomius"]
data/Gemfile ADDED
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Gem's dependencies are in nomius.gemspec.
6
+ gemspec
7
+
8
+ group :development do
9
+ gem "overcommit", "0.60.0"
10
+ gem "rubocop", "1.50.2"
11
+ gem "rubocop-rspec", "2.20.0"
12
+ end
13
+
14
+ group :test do
15
+ gem "rspec", "~> 3.12.0"
16
+ end
17
+
18
+ group :development, :test do
19
+ gem "rake"
20
+ end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Syngenta Group Co. Ltd.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,297 @@
1
+ # Nomius — bulk domain & package name availability checker
2
+
3
+ - [Description](#description)
4
+ - [Ratio](#ratio)
5
+ - [Installation](#installation)
6
+ - [Ruby gem](#ruby-gem)
7
+ - [Docker image](#docker-image)
8
+ - [Usage](#usage)
9
+ - [Basic usage](#basic-usage)
10
+ - [Built-in help](#built-in-help)
11
+ - [Using TXT file as input](#using-txt-file-as-input)
12
+ - [Using CSV file as input](#using-csv-file-as-input)
13
+ - [Using CSV file as input and output](#using-csv-file-as-input-and-output)
14
+ - [Using as a Ruby library](#using-as-a-ruby-library)
15
+ - [Contributing](#contributing)
16
+ - [Notes](#notes)
17
+
18
+ ## Description
19
+
20
+ `nomius` takes a list of names as input and check domain name (`.com`, `.org`) and package name (RubyGems, PyPi, NPMjs, etc.) availability.
21
+
22
+ The very basic usage example:
23
+
24
+ ```shell
25
+ user@home:~$ nomius biochem biochemio biochemus
26
+
27
+ ┌───────────┬──────┬──────┬────┬────────┬─────┬─────┬─────┐
28
+ │ Name │ .com │ .org │ GH │ Docker │ npm │ pip │ gem │
29
+ ├───────────┼──────┼──────┼────┼────────┼─────┼─────┼─────┤
30
+ │ biochem │ ❌ │ ❌ │ ❌ │ ❌ │ ✅ │ ✅ │ ✅ │
31
+ │ biochemio │ ✅ │ ✅ │ ✅ │ ✅ │ ✅ │ ✅ │ ✅ │
32
+ │ biochemus │ ✅ │ ✅ │ ✅ │ ✅ │ ✅ │ ✅ │ ✅ │
33
+ └───────────┴──────┴──────┴────┴────────┴─────┴─────┴─────┘
34
+ ```
35
+
36
+ - `nomius` is a console utility. Could be installed & used as:
37
+ - [Ruby gem](#ruby-gem) (Ruby 2.6+);
38
+ - [Docker image](#docker-image).
39
+ - Availability checks supported:
40
+ - domain name (`.com`,`.org`);
41
+ - [RubyGems](https://rubygems.org/) package name;
42
+ - [PyPi](https://pypi.org/) package name;
43
+ - [NPMjs](https://www.npmjs.com/) package name;
44
+ - [GitHub](https://github.com/) user/org name;
45
+ - [DockerHub](https://hub.docker.com/) user/org name.
46
+ - Input is a name, list of names or CSV file with a list of names.
47
+ - Output is a table with check results for each name. You could choose output to console or CSV file.
48
+
49
+ ## Ratio
50
+
51
+ For example, you have created a new biochemistry project. Now you need to find a short and memorable name, with a domain and package name available to register.
52
+
53
+ You may brainstorm dozens of names (or use a script to generate hundreds of names in different combinations):
54
+
55
+ ```txt
56
+ liber, chimeia, bchem, chemb, biochem, chembio, biochemio, biochemus
57
+ ```
58
+
59
+ Now you need to filter this list to names that have a domain name and package name available to register. But in popular domain zones (`.com`, `.org`) most of the short and memoizable names are already registered. Also, a good package name may be hard to find, especially if you want the name to be available across different languages and package managers.
60
+
61
+ Manually checking all those names to have available domains (`.com`, `.org`) and package names (`pip`, `npm`, `gem`) is a tedious manual task.
62
+
63
+ `nomius` will check all your names in a minute 🚀
64
+
65
+ ```shell
66
+ user@home:~$ nomius liber chimeia bchem chemb biochem chembio biochemio biochemus
67
+
68
+ ┌───────────┬──────┬──────┬────┬────────┬─────┬─────┬─────┐
69
+ │ Name │ .com │ .org │ GH │ Docker │ npm │ pip │ gem │
70
+ ├───────────┼──────┼──────┼────┼────────┼─────┼─────┼─────┤
71
+ │ bchem │ ❌ │ ❌ │ ❌ │ ✅ │ ✅ │ ✅ │ ✅ │
72
+ │ biochem │ ❌ │ ❌ │ ❌ │ ❌ │ ✅ │ ✅ │ ✅ │
73
+ │ biochemio │ ✅ │ ✅ │ ✅ │ ✅ │ ✅ │ ✅ │ ✅ │
74
+ │ biochemus │ ✅ │ ✅ │ ✅ │ ✅ │ ✅ │ ✅ │ ✅ │
75
+ │ chemb │ ❌ │ ✅ │ ❌ │ ✅ │ ✅ │ ✅ │ ✅ │
76
+ │ chembio │ ❌ │ ❌ │ ❌ │ ✅ │ ✅ │ ✅ │ ✅ │
77
+ │ chimeia │ ❌ │ ❌ │ ❌ │ ✅ │ ✅ │ ✅ │ ✅ │
78
+ │ liber │ ❌ │ ❌ │ ❌ │ ❌ │ ❌ │ ❌ │ ✅ │
79
+ └───────────┴──────┴──────┴────┴────────┴─────┴─────┴─────┘
80
+ ```
81
+
82
+ ## Installation
83
+
84
+ ### Ruby gem
85
+
86
+ ```shell
87
+ # Install nomius gem.
88
+ user@home:~$ gem install nomius
89
+
90
+ # Run nomius.
91
+ user@home:~$ nomius biochem
92
+
93
+ ┌─────────┬──────┬──────┬────┬────────┬─────┬─────┬─────┐
94
+ │ Name │ .com │ .org │ GH │ Docker │ npm │ pip │ gem │
95
+ ├─────────┼──────┼──────┼────┼────────┼─────┼─────┼─────┤
96
+ │ biochem │ ❌ │ ❌ │ ❌ │ ❌ │ ✅ │ ✅ │ ✅ │
97
+ └─────────┴──────┴──────┴────┴────────┴─────┴─────┴─────┘
98
+ ```
99
+
100
+ ### Docker image
101
+
102
+ All the options are the same as for the Ruby gem.
103
+
104
+ > Docker image is not published yet. But you could build it yourself.
105
+
106
+ ```shell
107
+ # 1. Clone the repository.
108
+ user@home:~$ git clone git@github.com:syngenta/nomius.git
109
+ user@home:~$ cd nomius
110
+
111
+ # 2. Build the Docker image.
112
+ user@home:~$ docker build -t nomius .
113
+
114
+ # 3. Run the Docker container.
115
+ user@home:~$ docker run -t --rm nomius biochem
116
+
117
+ ┌─────────┬──────┬──────┬────┬────────┬─────┬─────┬─────┐
118
+ │ Name │ .com │ .org │ GH │ Docker │ npm │ pip │ gem │
119
+ ├─────────┼──────┼──────┼────┼────────┼─────┼─────┼─────┤
120
+ │ biochem │ ❌ │ ❌ │ ❌ │ ❌ │ ✅ │ ✅ │ ✅ │
121
+ └─────────┴──────┴──────┴────┴────────┴─────┴─────┴─────┘
122
+ ```
123
+
124
+ ## Usage
125
+
126
+ ### Basic usage
127
+
128
+ ```shell
129
+ # Run nomius with a list of names to check.
130
+ user@home:~$ nomius biochem biochemio biochemus
131
+
132
+ ┌───────────┬──────┬──────┬────┬────────┬─────┬─────┬─────┐
133
+ │ Name │ .com │ .org │ GH │ Docker │ npm │ pip │ gem │
134
+ ├───────────┼──────┼──────┼────┼────────┼─────┼─────┼─────┤
135
+ │ biochem │ ❌ │ ❌ │ ❌ │ ❌ │ ✅ │ ✅ │ ✅ │
136
+ │ biochemio │ ✅ │ ✅ │ ✅ │ ✅ │ ✅ │ ✅ │ ✅ │
137
+ │ biochemus │ ✅ │ ✅ │ ✅ │ ✅ │ ✅ │ ✅ │ ✅ │
138
+ └───────────┴──────┴──────┴────┴────────┴─────┴─────┴─────┘
139
+ ```
140
+
141
+ ### Built-in help
142
+
143
+ ```shell
144
+ # Run built-in help.
145
+ user@home:~$ nomius --help
146
+
147
+ Usage: nomius [OPTIONS] [NAMES...]
148
+
149
+ Nomius — bulk domain & package name availability checker.
150
+
151
+ Options:
152
+ -h, --help Print usage
153
+ -i, --input string Input file. Could be:
154
+ - TXT with each name on a separate line;
155
+ - CSV file with 2 columns: "name","comment" ("comment"
156
+ is optional).
157
+
158
+ -o, --output string Output CSV file
159
+ -s, --silent Print less output
160
+ --version Print version
161
+
162
+ Examples:
163
+ Basic usage
164
+ Check "firstname" and "othername" names.
165
+ $ nomius firstname othername
166
+
167
+ Usage with a TXT file
168
+ $ nomius --input names.txt
169
+ or
170
+ $ cat names.txt | nomius
171
+ or
172
+ $ nomius < names.txt
173
+
174
+ Usage with a CSV file
175
+ $ nomius --input names.csv
176
+
177
+ Usage with a CSV file and output to a CSV file
178
+ $ nomius --input names.csv --output results.csv
179
+ ```
180
+
181
+ ### Using TXT file as input
182
+
183
+ Use a TXT file with each name on a separate line.
184
+ Wrap strings in quotes if it contains any non-alphanumeric characters.
185
+
186
+ ```txt
187
+ biochem
188
+ biochemio
189
+ biochemus
190
+ ```
191
+
192
+ ```shell
193
+ user@home:~$ nomius --input names.txt
194
+
195
+ ┌───────────┬──────┬──────┬────┬────────┬─────┬─────┬─────┐
196
+ │ Name │ .com │ .org │ GH │ Docker │ npm │ pip │ gem │
197
+ ├───────────┼──────┼──────┼────┼────────┼─────┼─────┼─────┤
198
+ │ biochem │ ❌ │ ❌ │ ❌ │ ❌ │ ✅ │ ✅ │ ✅ │
199
+ │ biochemio │ ✅ │ ✅ │ ✅ │ ✅ │ ✅ │ ✅ │ ✅ │
200
+ │ biochemus │ ✅ │ ✅ │ ✅ │ ✅ │ ✅ │ ✅ │ ✅ │
201
+ └───────────┴──────┴──────┴────┴────────┴─────┴─────┴─────┘
202
+ ```
203
+
204
+ Also, you could use shell pipe:
205
+
206
+ ```shell
207
+ user@home:~$ cat names.txt | nomius
208
+ # or
209
+ user@home:~$ nomius < names.txt
210
+ ```
211
+
212
+ ### Using CSV file as input
213
+
214
+ Input CSV file with 2 columns: _name_, _comment_.
215
+ _Name_ is required, _comment_ is optional:
216
+
217
+ ```CSV
218
+ biochem,"short of bio+chemistry"
219
+ biochemio,"short of biochemistry + fancy ending"
220
+ biochemus,"short of biochemistry + fancy ending"
221
+ ```
222
+
223
+ ```shell
224
+ user@home:~$ nomius --input names.csv
225
+
226
+ ┌───────────┬──────┬──────┬────┬────────┬─────┬─────┬─────┬──────────────────────────────────────┐
227
+ │ Name │ .com │ .org │ GH │ Docker │ npm │ pip │ gem │ Comment │
228
+ ├───────────┼──────┼──────┼────┼────────┼─────┼─────┼─────┼──────────────────────────────────────┤
229
+ │ biochem │ ❌ │ ❌ │ ❌ │ ❌ │ ✅ │ ✅ │ ✅ │ short of bio+chemistry │
230
+ │ biochemio │ ✅ │ ✅ │ ✅ │ ✅ │ ✅ │ ✅ │ ✅ │ short of biochemistry + fancy ending │
231
+ │ biochemus │ ✅ │ ✅ │ ✅ │ ✅ │ ✅ │ ✅ │ ✅ │ short of biochemistry + fancy ending │
232
+ └───────────┴──────┴──────┴────┴────────┴─────┴─────┴─────┴──────────────────────────────────────┘
233
+ ```
234
+
235
+ ### Using CSV file as input and output
236
+
237
+ ```shell
238
+ user@home:~$ nomius --input names.csv --output results.csv
239
+ ```
240
+
241
+ Output in `results.csv` CSV file:
242
+
243
+ ```csv
244
+ Name,Comment,bchem.com,bchem.org,GitHub.com,hub.docker.com,NPMjs.com,PyPi.org,RubyGems.org
245
+ biochem,short of bio+chemistry,-,-,-,-,+,+,+
246
+ biochemio,short of biochemistry + fancy ending,+,+,+,+,+,+,+
247
+ biochemus,short of biochemistry + fancy ending,+,+,+,+,+,+,+
248
+ ```
249
+
250
+ ## Using as a Ruby library
251
+
252
+ `nomius` is designed to be a CLI tool, but you could use it as a Ruby library.
253
+
254
+ ```shell
255
+ # Install nomius gem.
256
+ user@home:~$ gem install nomius
257
+ ```
258
+
259
+ ```ruby
260
+ require 'nomius'
261
+
262
+ # Run all checks:
263
+ results = Nomius::BulkChecker.check(
264
+ names: ["biochem", "biochemio", "biochemus"]
265
+ )
266
+
267
+ # Run only specific checks:
268
+ results = Nomius::BulkChecker.check(
269
+ names: ["biochem", "biochemio", "biochemus"],
270
+ detectors: [Nomius::Detector::DomainComDetector]
271
+ )
272
+
273
+ # Run with verbose logger:
274
+ results = Nomius::BulkChecker.check(
275
+ names: ["biochem", "biochemio", "biochemus"],
276
+ logger: Nomius::Logger::Verbose.new
277
+ )
278
+
279
+ # Use names with comments
280
+ names = [
281
+ Nomius::Name.new(name: "biochem", comment: 'short of bio+chemistry'),
282
+ Nomius::Name.new(name: "biochemio", comment: 'short of biochemistry + fancy ending')
283
+ ]
284
+ results = Nomius::BulkChecker.check(names: names)
285
+ ```
286
+
287
+ ## Contributing
288
+
289
+ Bug reports and pull requests are welcome on GitHub at [https://github.com/syngenta/nomius](https://github.com/syngenta/nomius).
290
+
291
+ Please, check our [Contribution guide](CONTRIBUTING.md) for more details.
292
+
293
+ This project adheres to the [Code of Conduct](CODE_OF_CONDUCT.md). We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
294
+
295
+ ## Notes
296
+
297
+ - `nomius` uses DNS and WHOIS checks to verify domain name availability. Results may not be 100% precise.
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec]
data/exe/nomius ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "nomius/cli"
5
+
6
+ Nomius::CLI.run