end_of_life 0.5.0 → 1.0.0.alpha
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/.standard.yml +3 -0
- data/CHANGELOG.md +28 -2
- data/Gemfile +2 -1
- data/Gemfile.lock +25 -10
- data/README.md +95 -27
- data/bin/end_of_life +1 -0
- data/end_of_life.gemspec +9 -2
- data/lib/end_of_life/api.rb +3 -0
- data/lib/end_of_life/check.rb +46 -0
- data/lib/end_of_life/cli/command/registry.rb +46 -0
- data/lib/end_of_life/cli.rb +109 -14
- data/lib/end_of_life/helpers/terminal.rb +3 -3
- data/lib/end_of_life/helpers/text.rb +11 -0
- data/lib/end_of_life/helpers/time.rb +35 -0
- data/lib/end_of_life/parsers/gemfile.rb +1 -1
- data/lib/end_of_life/parsers/gemfile_lock.rb +2 -0
- data/lib/end_of_life/parsers/mise_toml.rb +15 -0
- data/lib/end_of_life/parsers/tool_versions.rb +1 -0
- data/lib/end_of_life/product/registry.rb +5 -4
- data/lib/end_of_life/product/release.rb +22 -1
- data/lib/end_of_life/product.rb +10 -9
- data/lib/end_of_life/repository/search.rb +13 -2
- data/lib/end_of_life/repository.rb +3 -0
- data/lib/end_of_life/scanner/report.rb +37 -0
- data/lib/end_of_life/scanner.rb +16 -10
- data/lib/end_of_life/version.rb +1 -1
- data/lib/end_of_life/version_detector.rb +2 -2
- data/lib/end_of_life/version_detectors/nodejs.rb +31 -0
- data/lib/end_of_life/version_detectors/ruby.rb +8 -1
- data/lib/end_of_life/version_detectors.rb +0 -2
- data/lib/end_of_life.rb +3 -7
- metadata +96 -10
- data/.tool-versions +0 -1
- data/lib/end_of_life/options.rb +0 -63
- data/lib/end_of_life/report.rb +0 -35
data/lib/end_of_life/options.rb
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
require "optparse"
|
|
2
|
-
|
|
3
|
-
module EndOfLife
|
|
4
|
-
module Options
|
|
5
|
-
def self.from(argv)
|
|
6
|
-
options = {product: Product.find("ruby"), max_eol_date: Date.today, skip_archived: true}
|
|
7
|
-
OptionParser.new do |parser|
|
|
8
|
-
options[:parser] = parser
|
|
9
|
-
|
|
10
|
-
parser.banner = "Usage: end_of_life [options]"
|
|
11
|
-
|
|
12
|
-
product_names = EndOfLife.products.map(&:name)
|
|
13
|
-
parser.on("-p NAME", "--product NAME", /#{product_names.join("|")}/i, "Sets the product to scan for (default: ruby). Supported products are: #{product_names.join(", ")}.") do |name|
|
|
14
|
-
options[:product] = Product.find(name)
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
parser.on("--exclude=NAME,NAME2", Array, "Exclude repositories containing a certain word in its name. You can specify up to five words.") do |excludes|
|
|
18
|
-
options[:excludes] = excludes.first(5)
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
parser.on("--public-only", "Searches only public repositories") do
|
|
22
|
-
options[:visibility] = :public
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
parser.on("--private-only", "Searches only private repositories") do
|
|
26
|
-
options[:visibility] = :private
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
parser.on("--repo=USER/REPO", "--repository=USER/REPO", "Searches a specific repository") do |repository|
|
|
30
|
-
options[:repository] = repository
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
parser.on("--org=ORG,ORG2...", "--organization=ORG,ORG2", Array, "Searches within specific organizations") do |organizations|
|
|
34
|
-
options[:organizations] = organizations
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
parser.on("-u NAME", "--user=NAME", "Sets the user used on the repository search") do |user|
|
|
38
|
-
options[:user] = user
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
parser.on("--max-eol-days-away NUMBER", "Sets the maximum number of days away a version can be from EOL. It defaults to 0.") do |days|
|
|
42
|
-
options[:max_eol_date] = Date.today + days.to_i.abs
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
parser.on("--include-archived", "Includes archived repositories on the search") do
|
|
46
|
-
options[:skip_archived] = false
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
parser.on("-v", "--version", "Displays end_of_life version") do
|
|
50
|
-
options[:command] = :version
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
parser.on("-h", "--help", "Displays this help") do
|
|
54
|
-
options[:command] = :help
|
|
55
|
-
end
|
|
56
|
-
end.parse!(argv)
|
|
57
|
-
|
|
58
|
-
options
|
|
59
|
-
rescue OptionParser::ParseError => e
|
|
60
|
-
{command: :print_error, error: e}
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
end
|
data/lib/end_of_life/report.rb
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
require "stringio"
|
|
2
|
-
|
|
3
|
-
module EndOfLife
|
|
4
|
-
class Report < Data.define(:product, :repositories, :max_eol_date)
|
|
5
|
-
include Helpers::Terminal
|
|
6
|
-
|
|
7
|
-
def to_s
|
|
8
|
-
report = StringIO.new
|
|
9
|
-
report.puts
|
|
10
|
-
|
|
11
|
-
if repositories.empty?
|
|
12
|
-
report.puts "No repositories using EOL #{product}."
|
|
13
|
-
else
|
|
14
|
-
word = (repositories.size == 1) ? "repository" : "repositories"
|
|
15
|
-
report.puts "Found #{repositories.size} #{word} using EOL #{product} (<= #{product.latest_eol_release(at: max_eol_date)}):"
|
|
16
|
-
report.puts end_of_life_table(repositories)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
report.string
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def failure? = repositories.any?
|
|
23
|
-
|
|
24
|
-
private
|
|
25
|
-
|
|
26
|
-
def end_of_life_table(repositories)
|
|
27
|
-
headers = ["", "Repository", "#{product} version"]
|
|
28
|
-
rows = repositories.map.with_index(1) do |repo, i|
|
|
29
|
-
[i, repo.url, repo.min_release_of(product)]
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
table(headers, rows)
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|