gman 7.0.6 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/gman +10 -15
- data/bin/gman_filter +1 -1
- data/config/domains.txt +21 -408
- data/config/vendor/dotgovs.csv +237 -119
- data/docs/README.md +3 -1
- data/lib/gman/domain_list.rb +1 -1
- data/lib/gman/identifier.rb +9 -6
- data/lib/gman/importer.rb +1 -1
- data/lib/gman/locality.rb +1 -1
- data/lib/gman/version.rb +1 -1
- data/lib/gman.rb +8 -6
- metadata +8 -221
- data/.github/CODEOWNERS +0 -3
- data/.github/ISSUE_TEMPLATE/bug_report.md +0 -28
- data/.github/ISSUE_TEMPLATE/feature_request.md +0 -21
- data/.github/config.yml +0 -23
- data/.github/dependabot.yml +0 -10
- data/.github/funding.yml +0 -1
- data/.github/no-response.yml +0 -15
- data/.github/release-drafter.yml +0 -4
- data/.github/settings.yml +0 -33
- data/.github/stale.yml +0 -29
- data/.github/workflows/ci.yml +0 -23
- data/.github/workflows/clean.yml +0 -31
- data/.github/workflows/codeql-analysis.yml +0 -70
- data/.github/workflows/validate.yml +0 -30
- data/.github/workflows/vendor.yml +0 -29
- data/.gitignore +0 -6
- data/.rspec +0 -2
- data/.rubocop.yml +0 -29
- data/.rubocop_todo.yml +0 -84
- data/Gemfile +0 -5
- data/docs/CODE_OF_CONDUCT.md +0 -46
- data/docs/CONTRIBUTING.md +0 -92
- data/docs/SECURITY.md +0 -3
- data/docs/_config.yml +0 -2
- data/gman.gemspec +0 -45
- data/script/add +0 -19
- data/script/alphabetize +0 -14
- data/script/bootstrap +0 -5
- data/script/cibuild +0 -8
- data/script/console +0 -3
- data/script/dedupe +0 -22
- data/script/profile +0 -21
- data/script/prune +0 -22
- data/script/reconcile-us +0 -72
- data/script/release +0 -38
- data/script/validate-domains +0 -34
- data/script/vendor +0 -13
- data/script/vendor-federal-de +0 -14
- data/script/vendor-gov-list +0 -8
- data/script/vendor-public-suffix +0 -28
- data/script/vendor-swot +0 -43
- data/script/vendor-us +0 -42
- data/spec/fixtures/domains.txt +0 -4
- data/spec/fixtures/obama.txt +0 -5
- data/spec/gman/bin_spec.rb +0 -101
- data/spec/gman/country_code_spec.rb +0 -39
- data/spec/gman/domain_list_spec.rb +0 -110
- data/spec/gman/domains_spec.rb +0 -25
- data/spec/gman/identifier_spec.rb +0 -218
- data/spec/gman/importer_spec.rb +0 -236
- data/spec/gman/locality_spec.rb +0 -24
- data/spec/gman_spec.rb +0 -74
- data/spec/spec_helper.rb +0 -31
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
# For most projects, this workflow file will not need changing; you simply need
|
|
2
|
-
# to commit it to your repository.
|
|
3
|
-
#
|
|
4
|
-
# You may wish to alter this file to override the set of languages analyzed,
|
|
5
|
-
# or to provide custom queries or build logic.
|
|
6
|
-
#
|
|
7
|
-
# ******** NOTE ********
|
|
8
|
-
# We have attempted to detect the languages in your repository. Please check
|
|
9
|
-
# the `language` matrix defined below to confirm you have the correct set of
|
|
10
|
-
# supported CodeQL languages.
|
|
11
|
-
#
|
|
12
|
-
name: "CodeQL"
|
|
13
|
-
|
|
14
|
-
on:
|
|
15
|
-
push:
|
|
16
|
-
branches: [ main ]
|
|
17
|
-
pull_request:
|
|
18
|
-
# The branches below must be a subset of the branches above
|
|
19
|
-
branches: [ main ]
|
|
20
|
-
schedule:
|
|
21
|
-
- cron: '38 17 * * 5'
|
|
22
|
-
|
|
23
|
-
jobs:
|
|
24
|
-
analyze:
|
|
25
|
-
name: Analyze
|
|
26
|
-
runs-on: ubuntu-latest
|
|
27
|
-
permissions:
|
|
28
|
-
actions: read
|
|
29
|
-
contents: read
|
|
30
|
-
security-events: write
|
|
31
|
-
|
|
32
|
-
strategy:
|
|
33
|
-
fail-fast: false
|
|
34
|
-
matrix:
|
|
35
|
-
language: [ 'ruby' ]
|
|
36
|
-
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
|
37
|
-
# Learn more about CodeQL language support at https://git.io/codeql-language-support
|
|
38
|
-
|
|
39
|
-
steps:
|
|
40
|
-
- name: Checkout repository
|
|
41
|
-
uses: actions/checkout@v2
|
|
42
|
-
|
|
43
|
-
# Initializes the CodeQL tools for scanning.
|
|
44
|
-
- name: Initialize CodeQL
|
|
45
|
-
uses: github/codeql-action/init@v2
|
|
46
|
-
with:
|
|
47
|
-
languages: ${{ matrix.language }}
|
|
48
|
-
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
49
|
-
# By default, queries listed here will override any specified in a config file.
|
|
50
|
-
# Prefix the list here with "+" to use these queries and those in the config file.
|
|
51
|
-
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
|
52
|
-
|
|
53
|
-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
|
54
|
-
# If this step fails, then you should remove it and run the build manually (see below)
|
|
55
|
-
- name: Autobuild
|
|
56
|
-
uses: github/codeql-action/autobuild@v2
|
|
57
|
-
|
|
58
|
-
# ℹ️ Command-line programs to run using the OS shell.
|
|
59
|
-
# 📚 https://git.io/JvXDl
|
|
60
|
-
|
|
61
|
-
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
|
62
|
-
# and modify them (or add more) to build your code if your project
|
|
63
|
-
# uses a compiled language
|
|
64
|
-
|
|
65
|
-
#- run: |
|
|
66
|
-
# make bootstrap
|
|
67
|
-
# make release
|
|
68
|
-
|
|
69
|
-
- name: Perform CodeQL Analysis
|
|
70
|
-
uses: github/codeql-action/analyze@v2
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
name: "Validate Domain List"
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
schedule:
|
|
5
|
-
- cron: '0 0 15 * *'
|
|
6
|
-
workflow_dispatch: {}
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
validate:
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
|
|
12
|
-
steps:
|
|
13
|
-
- uses: actions/checkout@v3
|
|
14
|
-
- name: Set up Ruby
|
|
15
|
-
|
|
16
|
-
uses: ruby/setup-ruby@v1
|
|
17
|
-
with:
|
|
18
|
-
ruby-version: 3.0
|
|
19
|
-
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
|
20
|
-
|
|
21
|
-
- name: Validate domains
|
|
22
|
-
run: bundle exec script/validate-domains
|
|
23
|
-
|
|
24
|
-
- name: Create Pull Request
|
|
25
|
-
uses: peter-evans/create-pull-request@v4
|
|
26
|
-
if: always()
|
|
27
|
-
with:
|
|
28
|
-
commit-message: Remove invalid domains
|
|
29
|
-
title: Remove invalid domains
|
|
30
|
-
add-paths: config/*
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
name: "Vendor Domain List"
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
schedule:
|
|
5
|
-
- cron: '0 0 1 * * '
|
|
6
|
-
workflow_dispatch: {}
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
vendor:
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
|
|
12
|
-
steps:
|
|
13
|
-
- uses: actions/checkout@v3
|
|
14
|
-
- name: Set up Ruby
|
|
15
|
-
|
|
16
|
-
uses: ruby/setup-ruby@v1
|
|
17
|
-
with:
|
|
18
|
-
ruby-version: 3.0
|
|
19
|
-
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
|
20
|
-
|
|
21
|
-
- name: Vendor
|
|
22
|
-
run: script/vendor
|
|
23
|
-
|
|
24
|
-
- name: Create Pull Request
|
|
25
|
-
uses: peter-evans/create-pull-request@v4
|
|
26
|
-
with:
|
|
27
|
-
commit-message: Vendor domain list
|
|
28
|
-
title: Vendor domain list
|
|
29
|
-
add-paths: config/*
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.rubocop.yml
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
inherit_from: .rubocop_todo.yml
|
|
2
|
-
|
|
3
|
-
require:
|
|
4
|
-
- rubocop-performance
|
|
5
|
-
- rubocop-rspec
|
|
6
|
-
|
|
7
|
-
AllCops:
|
|
8
|
-
NewCops: enable
|
|
9
|
-
TargetRubyVersion: 2.5
|
|
10
|
-
Exclude:
|
|
11
|
-
- config/**/*
|
|
12
|
-
- vendor/**/*
|
|
13
|
-
|
|
14
|
-
Style/Documentation:
|
|
15
|
-
Enabled: false
|
|
16
|
-
|
|
17
|
-
Metrics/AbcSize:
|
|
18
|
-
Exclude:
|
|
19
|
-
- lib/gman/importer.rb
|
|
20
|
-
|
|
21
|
-
Metrics/ClassLength:
|
|
22
|
-
Enabled: false
|
|
23
|
-
|
|
24
|
-
Metrics/BlockLength:
|
|
25
|
-
Enabled: false
|
|
26
|
-
|
|
27
|
-
Style/AccessModifierDeclarations:
|
|
28
|
-
Exclude:
|
|
29
|
-
- lib/gman/identifier.rb
|
data/.rubocop_todo.yml
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
# This configuration was generated by
|
|
2
|
-
# `rubocop --auto-gen-config`
|
|
3
|
-
# on 2020-11-13 00:12:15 UTC using RuboCop version 1.3.0.
|
|
4
|
-
# The point is for the user to remove these configuration records
|
|
5
|
-
# one by one as the offenses are removed from the code base.
|
|
6
|
-
# Note that changes in the inspected code, or installation of new
|
|
7
|
-
# versions of RuboCop, may require this file to be generated again.
|
|
8
|
-
|
|
9
|
-
# Offense count: 1
|
|
10
|
-
# Configuration parameters: MinSize.
|
|
11
|
-
Performance/CollectionLiteralInLoop:
|
|
12
|
-
Exclude:
|
|
13
|
-
- 'spec/gman/domains_spec.rb'
|
|
14
|
-
|
|
15
|
-
# Offense count: 40
|
|
16
|
-
# Configuration parameters: Prefixes.
|
|
17
|
-
# Prefixes: when, with, without
|
|
18
|
-
RSpec/ContextWording:
|
|
19
|
-
Exclude:
|
|
20
|
-
- 'spec/gman/bin_spec.rb'
|
|
21
|
-
- 'spec/gman/domain_list_spec.rb'
|
|
22
|
-
- 'spec/gman/identifier_spec.rb'
|
|
23
|
-
- 'spec/gman/importer_spec.rb'
|
|
24
|
-
- 'spec/gman/locality_spec.rb'
|
|
25
|
-
- 'spec/gman_spec.rb'
|
|
26
|
-
|
|
27
|
-
# Offense count: 4
|
|
28
|
-
# Configuration parameters: IgnoredMetadata.
|
|
29
|
-
RSpec/DescribeClass:
|
|
30
|
-
Exclude:
|
|
31
|
-
- 'spec/gman/bin_spec.rb'
|
|
32
|
-
- 'spec/gman/country_code_spec.rb'
|
|
33
|
-
- 'spec/gman/domains_spec.rb'
|
|
34
|
-
- 'spec/gman/identifier_spec.rb'
|
|
35
|
-
|
|
36
|
-
# Offense count: 3
|
|
37
|
-
# Configuration parameters: Max.
|
|
38
|
-
RSpec/ExampleLength:
|
|
39
|
-
Exclude:
|
|
40
|
-
- 'spec/gman/bin_spec.rb'
|
|
41
|
-
- 'spec/gman/country_code_spec.rb'
|
|
42
|
-
- 'spec/gman/domains_spec.rb'
|
|
43
|
-
|
|
44
|
-
# Offense count: 2
|
|
45
|
-
# Configuration parameters: AssignmentOnly.
|
|
46
|
-
RSpec/InstanceVariable:
|
|
47
|
-
Exclude:
|
|
48
|
-
- 'spec/gman/importer_spec.rb'
|
|
49
|
-
|
|
50
|
-
# Offense count: 23
|
|
51
|
-
RSpec/MultipleExpectations:
|
|
52
|
-
Max: 3
|
|
53
|
-
|
|
54
|
-
# Offense count: 24
|
|
55
|
-
# Configuration parameters: AllowSubject.
|
|
56
|
-
RSpec/MultipleMemoizedHelpers:
|
|
57
|
-
Max: 9
|
|
58
|
-
|
|
59
|
-
# Offense count: 81
|
|
60
|
-
# Configuration parameters: IgnoreSharedExamples.
|
|
61
|
-
RSpec/NamedSubject:
|
|
62
|
-
Exclude:
|
|
63
|
-
- 'spec/gman/country_code_spec.rb'
|
|
64
|
-
- 'spec/gman/domain_list_spec.rb'
|
|
65
|
-
- 'spec/gman/identifier_spec.rb'
|
|
66
|
-
- 'spec/gman/importer_spec.rb'
|
|
67
|
-
- 'spec/gman_spec.rb'
|
|
68
|
-
|
|
69
|
-
# Offense count: 10
|
|
70
|
-
RSpec/NestedGroups:
|
|
71
|
-
Max: 5
|
|
72
|
-
|
|
73
|
-
# Offense count: 2
|
|
74
|
-
RSpec/ScatteredSetup:
|
|
75
|
-
Exclude:
|
|
76
|
-
- 'spec/gman/importer_spec.rb'
|
|
77
|
-
|
|
78
|
-
# Offense count: 4
|
|
79
|
-
Security/Open:
|
|
80
|
-
Exclude:
|
|
81
|
-
- 'script/reconcile-us'
|
|
82
|
-
- 'script/vendor-federal-de'
|
|
83
|
-
- 'script/vendor-municipal-de'
|
|
84
|
-
- 'script/vendor-us'
|
data/Gemfile
DELETED
data/docs/CODE_OF_CONDUCT.md
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
|
2
|
-
|
|
3
|
-
## Our Pledge
|
|
4
|
-
|
|
5
|
-
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
|
6
|
-
|
|
7
|
-
## Our Standards
|
|
8
|
-
|
|
9
|
-
Examples of behavior that contributes to creating a positive environment include:
|
|
10
|
-
|
|
11
|
-
* Using welcoming and inclusive language
|
|
12
|
-
* Being respectful of differing viewpoints and experiences
|
|
13
|
-
* Gracefully accepting constructive criticism
|
|
14
|
-
* Focusing on what is best for the community
|
|
15
|
-
* Showing empathy towards other community members
|
|
16
|
-
|
|
17
|
-
Examples of unacceptable behavior by participants include:
|
|
18
|
-
|
|
19
|
-
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
|
20
|
-
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
21
|
-
* Public or private harassment
|
|
22
|
-
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
|
23
|
-
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
|
24
|
-
|
|
25
|
-
## Our Responsibilities
|
|
26
|
-
|
|
27
|
-
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
|
28
|
-
|
|
29
|
-
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
|
30
|
-
|
|
31
|
-
## Scope
|
|
32
|
-
|
|
33
|
-
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
|
34
|
-
|
|
35
|
-
## Enforcement
|
|
36
|
-
|
|
37
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at ben@balter.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
|
38
|
-
|
|
39
|
-
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
|
40
|
-
|
|
41
|
-
## Attribution
|
|
42
|
-
|
|
43
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
|
44
|
-
|
|
45
|
-
[homepage]: http://contributor-covenant.org
|
|
46
|
-
[version]: http://contributor-covenant.org/version/1/4/
|
data/docs/CONTRIBUTING.md
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
# Contributing to Gman
|
|
2
|
-
|
|
3
|
-
Hi there! We're thrilled that you'd like to contribute to Gman. Your help is essential for keeping it great.
|
|
4
|
-
|
|
5
|
-
Gman is an open source project supported by the efforts of an entire community and built one contribution at a time by users like you. We'd love for you to get involved. Whatever your level of skill or however much time you can give, your contribution is greatly appreciated. There are many ways to contribute, from writing tutorials or blog posts, improving the documentation, submitting bug reports and feature requests, helping other users by commenting on issues, or writing code which can be incorporated into Gman itself.
|
|
6
|
-
|
|
7
|
-
Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue, assessing changes, and helping you finalize your pull requests.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## How to report a bug
|
|
12
|
-
|
|
13
|
-
Think you found a bug? Please check [the list of open issues](https://github.com/benbalter/gman/issues) to see if your bug has already been reported. If it hasn't please [submit a new issue](https://github.com/benbalter/gman/issues/new).
|
|
14
|
-
|
|
15
|
-
Here are a few tips for writing *great* bug reports:
|
|
16
|
-
|
|
17
|
-
* Describe the specific problem (e.g., "widget doesn't turn clockwise" versus "getting an error")
|
|
18
|
-
* Include the steps to reproduce the bug, what you expected to happen, and what happened instead
|
|
19
|
-
* Check that you are using the latest version of the project and its dependencies
|
|
20
|
-
* Include what version of the project your using, as well as any relevant dependencies
|
|
21
|
-
* Only include one bug per issue. If you have discovered two bugs, please file two issues
|
|
22
|
-
* Include screenshots or screencasts whenever possible
|
|
23
|
-
* Even if you don't know how to fix the bug, including a failing test may help others track it down
|
|
24
|
-
|
|
25
|
-
**If you find a security vulnerability, do not open an issue. Please email ben@balter.com instead.**
|
|
26
|
-
|
|
27
|
-
## How to suggest a feature or enhancement
|
|
28
|
-
|
|
29
|
-
If you find yourself wishing for a feature that doesn't exist in Gman, you are probably not alone. There are bound to be others out there with similar needs. Many of the features that Gman has today have been added because our users saw the need.
|
|
30
|
-
|
|
31
|
-
Feature requests are welcome. But take a moment to find out whether your idea fits with the scope and goals of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Please provide as much detail and context as possible, including describing the problem you're trying to solve.
|
|
32
|
-
|
|
33
|
-
[Open an issue](https://github.com/benbalter/gman/issues/new) which describes the feature you would like to see, why you want it, how it should work, etc.
|
|
34
|
-
|
|
35
|
-
## Domains
|
|
36
|
-
|
|
37
|
-
Domains live in [`config/domains.txt`](../config/domains.txt) as a list of TLDs and SLD+TLDs.
|
|
38
|
-
|
|
39
|
-
Right now, the only valid government top level domains (TLDs), represent the US government and are `.gov`, and `.mil`. Secondary domains (e.g., `gov.uk`, or `mil.au`) represent non-US government entities.
|
|
40
|
-
|
|
41
|
-
To add or remove a domain from the list of known government domains, simply edit the `domains.txt` file.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
## Your first contribution
|
|
45
|
-
|
|
46
|
-
We'd love for you to contribute to the project. Unsure where to begin contributing to Gman? You can start by looking through these "good first issue" and "help wanted" issues:
|
|
47
|
-
|
|
48
|
-
* [Good first issues](https://github.com/benbalter/gman/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) - issues which should only require a few lines of code and a test or two
|
|
49
|
-
* [Help wanted issues](https://github.com/benbalter/gman/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) - issues which may be a bit more involved, but are specifically seeking community contributions
|
|
50
|
-
|
|
51
|
-
*p.s. Feel free to ask for help; everyone is a beginner at first* :smiley_cat:
|
|
52
|
-
|
|
53
|
-
## How to propose changes
|
|
54
|
-
|
|
55
|
-
Here's a few general guidelines for proposing changes:
|
|
56
|
-
|
|
57
|
-
* If you are changing any user-facing functionality, please be sure to update the documentation
|
|
58
|
-
* If you are adding a new behavior or changing an existing behavior, please be sure to update the corresponding test(s)
|
|
59
|
-
* Each pull request should implement **one** feature or bug fix. If you want to add or fix more than one thing, submit more than one pull request
|
|
60
|
-
* Do not commit changes to files that are irrelevant to your feature or bug fix
|
|
61
|
-
* Don't bump the version number in your pull request (it will be bumped prior to release)
|
|
62
|
-
* Write [a good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
|
|
63
|
-
|
|
64
|
-
At a high level, [the process for proposing changes](https://guides.github.com/introduction/flow/) is:
|
|
65
|
-
|
|
66
|
-
1. [Fork](https://github.com/benbalter/gman/fork) and clone the project
|
|
67
|
-
2. Configure and install the dependencies: `script/bootstrap`
|
|
68
|
-
3. Make sure the tests pass on your machine: `script/cibuild`
|
|
69
|
-
4. Create a descriptively named branch: `git checkout -b my-branch-name`
|
|
70
|
-
5. Make your change, add tests and documentation, and make sure the tests still pass
|
|
71
|
-
6. Push to your fork and [submit a pull request](https://github.com/benbalter/gman/compare) describing your change
|
|
72
|
-
7. Pat your self on the back and wait for your pull request to be reviewed and merged
|
|
73
|
-
|
|
74
|
-
**Interesting in submitting your first Pull Request?** It's easy! You can learn how from this *free* series [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github)
|
|
75
|
-
|
|
76
|
-
## Bootstrapping your local development environment
|
|
77
|
-
|
|
78
|
-
`script/bootstrap`
|
|
79
|
-
|
|
80
|
-
## Running tests
|
|
81
|
-
|
|
82
|
-
`script/cibuild`
|
|
83
|
-
|
|
84
|
-
## Code of conduct
|
|
85
|
-
|
|
86
|
-
This project is governed by [the Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code.
|
|
87
|
-
|
|
88
|
-
## Additional Resources
|
|
89
|
-
|
|
90
|
-
* [Contributing to Open Source on GitHub](https://guides.github.com/activities/contributing-to-open-source/)
|
|
91
|
-
* [Using Pull Requests](https://help.github.com/articles/using-pull-requests/)
|
|
92
|
-
* [GitHub Help](https://help.github.com)
|
data/docs/SECURITY.md
DELETED
data/docs/_config.yml
DELETED
data/gman.gemspec
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require File.expand_path './lib/gman/version', File.dirname(__FILE__)
|
|
4
|
-
|
|
5
|
-
Gem::Specification.new do |s|
|
|
6
|
-
s.name = 'gman'
|
|
7
|
-
s.summary = <<-SUMMARY
|
|
8
|
-
Check if a given domain or email address belong to a governemnt entity
|
|
9
|
-
SUMMARY
|
|
10
|
-
s.description = <<-DESC
|
|
11
|
-
A ruby gem to check if the owner of a given email address is working for
|
|
12
|
-
THE MAN.
|
|
13
|
-
DESC
|
|
14
|
-
s.version = Gman::VERSION
|
|
15
|
-
s.authors = ['Ben Balter']
|
|
16
|
-
s.email = 'ben.balter@github.com'
|
|
17
|
-
s.homepage = 'https://github.com/benbalter/gman'
|
|
18
|
-
s.licenses = ['MIT']
|
|
19
|
-
|
|
20
|
-
s.files = `git ls-files`.split("\n")
|
|
21
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map do |f|
|
|
22
|
-
File.basename(f)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
s.require_paths = ['lib']
|
|
26
|
-
s.required_ruby_version = '>= 2.5', '< 4.0'
|
|
27
|
-
|
|
28
|
-
s.add_dependency('colored', '~> 1.2')
|
|
29
|
-
s.add_dependency('iso_country_codes', '~> 0.6')
|
|
30
|
-
s.add_dependency('naughty_or_nice', '>= 2.1.1')
|
|
31
|
-
s.add_dependency('public_suffix', '>= 3.0')
|
|
32
|
-
|
|
33
|
-
s.add_development_dependency('addressable', '~> 2.3')
|
|
34
|
-
s.add_development_dependency('mechanize', '~> 2.7')
|
|
35
|
-
s.add_development_dependency('parallel', '~> 1.6')
|
|
36
|
-
s.add_development_dependency('pry', '~> 0.10')
|
|
37
|
-
s.add_development_dependency('rspec', '~> 3.5')
|
|
38
|
-
s.add_development_dependency('rubocop', '~> 1.0')
|
|
39
|
-
s.add_development_dependency('rubocop-performance', '~> 1.5')
|
|
40
|
-
s.add_development_dependency('rubocop-rspec', '~> 2.0')
|
|
41
|
-
s.add_development_dependency('ruby-prof', '~> 1.4')
|
|
42
|
-
s.add_development_dependency('ruby-progressbar', '~> 1.10')
|
|
43
|
-
s.add_development_dependency('swot', '~> 1.0')
|
|
44
|
-
s.metadata['rubygems_mfa_required'] = 'true'
|
|
45
|
-
end
|
data/script/add
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
#! /usr/bin/env ruby
|
|
2
|
-
# frozen_string_literal: true
|
|
3
|
-
|
|
4
|
-
#
|
|
5
|
-
# Add one or more domains to a given group, running the standard import checks
|
|
6
|
-
#
|
|
7
|
-
# Usage: script/add [GROUP] [DOMAIN(S)]
|
|
8
|
-
|
|
9
|
-
require './lib/gman/importer'
|
|
10
|
-
|
|
11
|
-
if ARGV.length < 2
|
|
12
|
-
puts 'Usage: script/add [GROUP] [DOMAIN(S)]'
|
|
13
|
-
exit 1
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
group = ARGV[0]
|
|
17
|
-
domains = ARGV.drop(1)
|
|
18
|
-
|
|
19
|
-
Gman.import(group => domains)
|
data/script/alphabetize
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
#! /usr/bin/env ruby
|
|
2
|
-
# frozen_string_literal: true
|
|
3
|
-
|
|
4
|
-
#
|
|
5
|
-
# Alphabetizes entries in the domains.txt file
|
|
6
|
-
#
|
|
7
|
-
# usage: script/alphabetize
|
|
8
|
-
|
|
9
|
-
require_relative '../lib/gman'
|
|
10
|
-
require_relative '../lib/gman/importer'
|
|
11
|
-
|
|
12
|
-
current = Gman::DomainList.current
|
|
13
|
-
current.alphabetize
|
|
14
|
-
current.write
|
data/script/cibuild
DELETED
data/script/console
DELETED
data/script/dedupe
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
#! /usr/bin/env ruby
|
|
2
|
-
# frozen_string_literal: true
|
|
3
|
-
|
|
4
|
-
require 'yaml'
|
|
5
|
-
require 'open-uri'
|
|
6
|
-
require './lib/gman'
|
|
7
|
-
require './lib/gman/importer'
|
|
8
|
-
|
|
9
|
-
current = Gman::DomainList.current
|
|
10
|
-
|
|
11
|
-
puts 'Checking for duplicate domains in the domain list...'
|
|
12
|
-
puts "Current list contains #{current.count} domains..."
|
|
13
|
-
|
|
14
|
-
dupe = current.count - current.domains.uniq.count
|
|
15
|
-
puts "Found #{dupe} duplicate domains"
|
|
16
|
-
exit 0 if dupe.zero?
|
|
17
|
-
|
|
18
|
-
dupes = current.domains.select { |domain| current.domains.count(domain) > 1 }
|
|
19
|
-
|
|
20
|
-
puts 'Duplicate domains:'
|
|
21
|
-
puts dupes
|
|
22
|
-
exit 1
|
data/script/profile
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#! /usr/bin/env ruby
|
|
2
|
-
# frozen_string_literal: true
|
|
3
|
-
|
|
4
|
-
require 'ruby-prof'
|
|
5
|
-
require './lib/gman'
|
|
6
|
-
|
|
7
|
-
# Pick N random domains directly,
|
|
8
|
-
# without pre-loading the Gman list for an accurate benchmark
|
|
9
|
-
count = (ARGV[0] || 100).to_i
|
|
10
|
-
domains = File.readlines('./config/domains.txt')
|
|
11
|
-
domains = domains.grep(/^[a-z0-9]/i)
|
|
12
|
-
domains = domains.sample(count)
|
|
13
|
-
|
|
14
|
-
RubyProf.start
|
|
15
|
-
domains.each do |domain|
|
|
16
|
-
Gman.new("foo@bar.#{domain}").valid?
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
result = RubyProf.stop
|
|
20
|
-
printer = RubyProf::FlatPrinter.new(result)
|
|
21
|
-
printer.print($stdout)
|
data/script/prune
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
# frozen_string_literal: true
|
|
3
|
-
|
|
4
|
-
# Given an array of domains, removes them from the list
|
|
5
|
-
# Example usage: script/prune foo.invalid, bar.invalid, foo.bar.invalid
|
|
6
|
-
|
|
7
|
-
require_relative '../lib/gman'
|
|
8
|
-
require_relative '../lib/gman/domain_list'
|
|
9
|
-
|
|
10
|
-
domains = ARGV
|
|
11
|
-
domains = domains.clone.map { |d| d.delete ',' }
|
|
12
|
-
|
|
13
|
-
list = File.read('./config/domains.txt')
|
|
14
|
-
puts "Starting list: #{Gman::DomainList.current.count} domains"
|
|
15
|
-
|
|
16
|
-
domains.each do |domain|
|
|
17
|
-
list.gsub!(/^#{Regexp.escape(domain)}$\n/, '')
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
File.write './config/domains.txt', list
|
|
21
|
-
|
|
22
|
-
puts "Ending list: #{Gman::DomainList.current.count} domains"
|
data/script/reconcile-us
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
# frozen_string_literal: true
|
|
3
|
-
|
|
4
|
-
#
|
|
5
|
-
# Reconciles the USA.gov-maintained list of US domains with domains.txt
|
|
6
|
-
# to show domains listed in the USA.gov-maintained list that we reject and why
|
|
7
|
-
#
|
|
8
|
-
# Usage: script/reconcile-us
|
|
9
|
-
|
|
10
|
-
require './lib/gman/importer'
|
|
11
|
-
require 'yaml'
|
|
12
|
-
|
|
13
|
-
ENV['RECONCILING'] = 'true'
|
|
14
|
-
blacklist = ['usagovQUASI']
|
|
15
|
-
source = 'https://raw.githubusercontent.com/GSA/govt-urls/master/government-urls-hierarchical-list.txt'
|
|
16
|
-
|
|
17
|
-
data = URI.open(source).read
|
|
18
|
-
data = data.split('_' * 74)
|
|
19
|
-
data = data.last.strip
|
|
20
|
-
data = data.split(/\r?\n/).reject(&:empty?)
|
|
21
|
-
|
|
22
|
-
domains = {}
|
|
23
|
-
group = ''
|
|
24
|
-
data.each do |row|
|
|
25
|
-
if /^\w/.match?(row)
|
|
26
|
-
group = row
|
|
27
|
-
domains[group] = []
|
|
28
|
-
else
|
|
29
|
-
domains[group].push row.sub(".\t", '').strip
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
domains.reject! { |g, _domain| blacklist.include?(g) }
|
|
34
|
-
importer = Gman::Importer.new(domains)
|
|
35
|
-
|
|
36
|
-
importer.logger.info "Starting with #{importer.domains.count} domains"
|
|
37
|
-
|
|
38
|
-
importer.domains.list.each_value do |d|
|
|
39
|
-
d.map! { |domain| Gman.new(domain).to_s }
|
|
40
|
-
d.map! { |domain| importer.normalize_domain(domain) }
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
count = importer.domains.domains.count
|
|
44
|
-
importer.logger.info "Filtered down to #{count} normalized domains"
|
|
45
|
-
|
|
46
|
-
missing = {}
|
|
47
|
-
importer.domains.list.each do |g, usagovdomains|
|
|
48
|
-
next unless importer.current.list[g]
|
|
49
|
-
|
|
50
|
-
missing[g] = importer.current.list[g] - usagovdomains
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
missing.reject! { |_key, value| value.empty? }
|
|
54
|
-
|
|
55
|
-
count = missing.values.count
|
|
56
|
-
importer.logger.info "Found #{count} domains not on the USA.gov list"
|
|
57
|
-
puts "Here's the list of missing domains:"
|
|
58
|
-
puts YAML.dump(missing)
|
|
59
|
-
|
|
60
|
-
domains = importer.domains.domains
|
|
61
|
-
domains = domains.group_by do |domain|
|
|
62
|
-
importer.valid_domain?(domain, skip_dupe: true)
|
|
63
|
-
end
|
|
64
|
-
domains.delete(true)
|
|
65
|
-
domains.delete(false)
|
|
66
|
-
domains.delete('locality')
|
|
67
|
-
|
|
68
|
-
count = domains.values.flatten.count
|
|
69
|
-
importer.logger.info "Calling out #{count} rejected domains"
|
|
70
|
-
|
|
71
|
-
puts 'Here are the rejected domains and why they were rejected:'
|
|
72
|
-
puts YAML.dump(domains)
|