end_of_life 0.1.0 → 0.2.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/CHANGELOG.md +34 -1
- data/Gemfile.lock +2 -4
- data/README.md +3 -1
- data/demo.gif +0 -0
- data/end_of_life.gemspec +2 -3
- data/lib/end_of_life/repository.rb +25 -10
- data/lib/end_of_life/ruby_version.rb +4 -1
- data/lib/end_of_life/version.rb +1 -1
- data/lib/end_of_life.rb +55 -7
- metadata +5 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e058c01c970e9fde4fdceeabde71c29a623374ef989987d5b5ab10e1e247ca4
|
4
|
+
data.tar.gz: 58adcd9c3aa9fbf64b1adb7a7f2f68d1d551ee41925ff9f06c03ce9e21298448
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87d59b8b0d1aa556bf0b2bc7295a617fe5890bb0056437c7728d497468a05df6b57150f13680ac0be0ae9a400d40d02dac05331a5999d59943bcce7821d767f9
|
7
|
+
data.tar.gz: 38acbd80942af304503ec510b666f2b18ce1de8a728d92254c5fd3acd1393d6eadeb3c8e24aa1de242bc6a7f5243226a446a11e529c03d5e6443adcd571408a6
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,38 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
-
|
3
|
+
### Added
|
4
|
+
|
5
|
+
- Allow searching a specific repository.
|
6
|
+
|
7
|
+
```sh
|
8
|
+
$ end_of_life --repo=MatheusRich/ez_attributes
|
9
|
+
```
|
10
|
+
|
11
|
+
- Allow specifying the user used on the repository search.
|
12
|
+
|
13
|
+
```sh
|
14
|
+
$ end_of_life --user=matz # searches on matz's repositories
|
15
|
+
```
|
16
|
+
|
17
|
+
### Fixed
|
18
|
+
|
19
|
+
- Load end_of_life JSON database from dynamic path [#10](https://github.com/MatheusRich/end_of_life/pull/10).
|
20
|
+
|
21
|
+
When installed on a fresh Ruby installation without the source code cloned,
|
22
|
+
the JSON file couldn't be found because it was looking at the cwd of the
|
23
|
+
running process instead of the Gem's lib directory path.
|
24
|
+
|
25
|
+
### Changed
|
26
|
+
|
27
|
+
- Exit with -1 if EOL repos are present.
|
28
|
+
|
29
|
+
- Upgrade `octokit` to v4.22, which fixes [a Faraday warning], so we can remove the dependency on the `warning` gem.
|
30
|
+
|
31
|
+
[a faraday warning]: https://github.com/octokit/octokit.rb/pull/1359
|
32
|
+
|
33
|
+
## [0.1.0] - 2022-01-17
|
4
34
|
|
5
35
|
- Initial release
|
36
|
+
|
37
|
+
[unreleased]: https://github.com/MatheusRich/end_of_life/compare/v0.1.0...HEAD
|
38
|
+
[0.1.0]: https://github.com/MatheusRich/end_of_life/releases/tag/v0.1.0
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
end_of_life (0.
|
4
|
+
end_of_life (0.2.0)
|
5
5
|
dry-monads (~> 1.3)
|
6
6
|
octokit (~> 4.0)
|
7
7
|
pastel (~> 0.8.0)
|
8
8
|
tty-spinner (~> 0.9.0)
|
9
9
|
tty-table (~> 0.12.0)
|
10
|
-
warning (~> 1.2.1)
|
11
10
|
|
12
11
|
GEM
|
13
12
|
remote: https://rubygems.org/
|
@@ -48,7 +47,7 @@ GEM
|
|
48
47
|
faraday-rack (1.0.0)
|
49
48
|
faraday-retry (1.0.3)
|
50
49
|
multipart-post (2.1.1)
|
51
|
-
octokit (4.
|
50
|
+
octokit (4.22.0)
|
52
51
|
faraday (>= 0.9)
|
53
52
|
sawyer (~> 0.8.0, >= 0.5.3)
|
54
53
|
parallel (1.21.0)
|
@@ -118,7 +117,6 @@ GEM
|
|
118
117
|
tty-screen (~> 0.8)
|
119
118
|
unicode-display_width (2.1.0)
|
120
119
|
unicode_utils (1.4.0)
|
121
|
-
warning (1.2.1)
|
122
120
|
|
123
121
|
PLATFORMS
|
124
122
|
x86_64-darwin-20
|
data/README.md
CHANGED
data/demo.gif
ADDED
Binary file
|
data/end_of_life.gemspec
CHANGED
@@ -8,9 +8,9 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ["Matheus Richard"]
|
9
9
|
spec.email = ["matheusrichardt@gmail.com"]
|
10
10
|
|
11
|
-
spec.summary = "Lists repositories using end-of-life Ruby versions"
|
11
|
+
spec.summary = "Lists repositories using end-of-life Ruby versions."
|
12
12
|
spec.description = "Searches your GitHub repositores and lists the ones using end-of-life, i.e. " \
|
13
|
-
"unmaintained, Ruby versions"
|
13
|
+
"unmaintained, Ruby versions."
|
14
14
|
spec.homepage = "https://github.com/MatheusRich/end_of_life"
|
15
15
|
spec.license = "MIT"
|
16
16
|
spec.required_ruby_version = ">= 2.7.0"
|
@@ -37,7 +37,6 @@ Gem::Specification.new do |spec|
|
|
37
37
|
spec.add_dependency "dry-monads", "~> 1.3"
|
38
38
|
spec.add_dependency "tty-spinner", "~> 0.9.0"
|
39
39
|
spec.add_dependency "tty-table", "~> 0.12.0"
|
40
|
-
spec.add_dependency "warning", "~> 1.2.1"
|
41
40
|
|
42
41
|
# For more information and examples about making a new gem, check out our
|
43
42
|
# guide at: https://bundler.io/guides/creating_gem.html
|
@@ -5,19 +5,23 @@ module EndOfLife
|
|
5
5
|
class << self
|
6
6
|
include Dry::Monads[:result, :maybe]
|
7
7
|
|
8
|
-
def fetch(language:, user: nil)
|
9
|
-
github_client.
|
8
|
+
def fetch(language:, user:, repository: nil)
|
9
|
+
github_client.bind do |github|
|
10
10
|
user ||= github.user.login
|
11
|
-
|
11
|
+
query = search_query_for(language: language, user: user, repository: repository)
|
12
|
+
|
13
|
+
response = github.search_repositories(query, per_page: 100)
|
12
14
|
warn "Incomplete results: we only search 100 repos at a time" if response.incomplete_results
|
13
15
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
Success(
|
17
|
+
response.items.map do |repo|
|
18
|
+
Repository.new(
|
19
|
+
full_name: repo.full_name,
|
20
|
+
url: repo.html_url,
|
21
|
+
github_client: github
|
22
|
+
)
|
23
|
+
end
|
24
|
+
)
|
21
25
|
rescue => e
|
22
26
|
Failure("Unexpected error: #{e}")
|
23
27
|
end
|
@@ -29,6 +33,17 @@ module EndOfLife
|
|
29
33
|
.fmap { |token| Octokit::Client.new(access_token: token) }
|
30
34
|
.or { Failure("Please set GITHUB_TOKEN environment variable") }
|
31
35
|
end
|
36
|
+
|
37
|
+
def search_query_for(language:, user:, repository:)
|
38
|
+
query = "language:#{language}"
|
39
|
+
query += if repository
|
40
|
+
" repo:#{repository}"
|
41
|
+
else
|
42
|
+
" user:#{user}"
|
43
|
+
end
|
44
|
+
|
45
|
+
query
|
46
|
+
end
|
32
47
|
end
|
33
48
|
|
34
49
|
attr :full_name, :url
|
@@ -1,10 +1,13 @@
|
|
1
|
+
require "rubygems"
|
1
2
|
require_relative "ruby_version/parser"
|
2
3
|
|
3
4
|
module EndOfLife
|
4
5
|
class RubyVersion
|
5
6
|
include Comparable
|
6
7
|
|
7
|
-
|
8
|
+
DB_PATH = File.join(__dir__, "../end_of_life.json")
|
9
|
+
|
10
|
+
EOL = File.read(DB_PATH)
|
8
11
|
.then { |json| JSON.parse(json, symbolize_names: true) }
|
9
12
|
.filter { |version| Date.parse(version[:eol]) <= Date.today }
|
10
13
|
.map { |version| Gem::Version.new(version[:latest]) }
|
data/lib/end_of_life/version.rb
CHANGED
data/lib/end_of_life.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require "json"
|
4
4
|
require "octokit"
|
5
|
-
require "
|
5
|
+
require "optparse"
|
6
6
|
require_relative "end_of_life/repository"
|
7
7
|
require_relative "end_of_life/ruby_version"
|
8
8
|
require_relative "end_of_life/terminal_helper"
|
@@ -11,23 +11,70 @@ require_relative "end_of_life/version"
|
|
11
11
|
module EndOfLife
|
12
12
|
extend TerminalHelper
|
13
13
|
|
14
|
-
Warning.ignore(/Faraday::Connection#authorization/)
|
15
|
-
|
16
14
|
class CLI
|
17
15
|
include TerminalHelper
|
18
16
|
|
19
17
|
def call(argv)
|
20
|
-
|
18
|
+
parse_options(argv)
|
19
|
+
.then { |options| execute_command(options) }
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def execute_command(options)
|
25
|
+
case options[:command]
|
26
|
+
when :help
|
27
|
+
puts options[:parser]
|
28
|
+
when :version
|
29
|
+
puts "end_of_life v#{EndOfLife::VERSION}"
|
30
|
+
when :print_error
|
31
|
+
puts error_msg(options[:error])
|
32
|
+
exit(-1)
|
33
|
+
else
|
34
|
+
check_eol_ruby_on_repositories(options)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def check_eol_ruby_on_repositories(options)
|
39
|
+
fetch_repositories(user: options[:user], repository: options[:repository])
|
21
40
|
.fmap { |repositories| filter_repositories_with_end_of_life(repositories) }
|
22
41
|
.fmap { |repositories| print_diagnose_for(repositories) }
|
23
42
|
.or { |error| puts "\n#{error_msg(error)}" }
|
24
43
|
end
|
25
44
|
|
26
|
-
|
45
|
+
def parse_options(argv)
|
46
|
+
options = {}
|
47
|
+
|
48
|
+
OptionParser.new do |opts|
|
49
|
+
options[:parser] = opts
|
50
|
+
|
51
|
+
opts.banner = "Usage: end_of_life [options]"
|
52
|
+
|
53
|
+
opts.on("--repo=USER/REPO", "--repository=USER/REPO", "Searches a specific repostory") do |repository|
|
54
|
+
options[:repository] = repository
|
55
|
+
end
|
56
|
+
|
57
|
+
opts.on("-u NAME", "--user=NAME", "Sets the user used on the repository search") do |user|
|
58
|
+
options[:user] = user
|
59
|
+
end
|
60
|
+
|
61
|
+
opts.on("-v", "--version", "Displays end_of_life version") do
|
62
|
+
options[:command] = :version
|
63
|
+
end
|
64
|
+
|
65
|
+
opts.on("-h", "--help", "Displays this help") do
|
66
|
+
options[:command] = :help
|
67
|
+
end
|
68
|
+
end.parse!(argv)
|
69
|
+
|
70
|
+
options
|
71
|
+
rescue OptionParser::ParseError => e
|
72
|
+
{command: :print_error, error: e}
|
73
|
+
end
|
27
74
|
|
28
|
-
def fetch_repositories
|
75
|
+
def fetch_repositories(user:, repository:)
|
29
76
|
with_loading_spinner("Fetching repositories...") do |spinner|
|
30
|
-
result = Repository.fetch(language: "ruby")
|
77
|
+
result = Repository.fetch(language: "ruby", user: user, repository: repository)
|
31
78
|
|
32
79
|
spinner.error if result.failure?
|
33
80
|
|
@@ -51,6 +98,7 @@ module EndOfLife
|
|
51
98
|
|
52
99
|
puts "Found #{repositories.size} repositories using EOL Ruby (<= #{RubyVersion::EOL}):"
|
53
100
|
puts end_of_life_table(repositories)
|
101
|
+
exit(-1)
|
54
102
|
end
|
55
103
|
|
56
104
|
def end_of_life_table(repositories)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: end_of_life
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matheus Richard
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|
@@ -80,22 +80,8 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 0.12.0
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: warning
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 1.2.1
|
90
|
-
type: :runtime
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 1.2.1
|
97
83
|
description: Searches your GitHub repositores and lists the ones using end-of-life,
|
98
|
-
i.e. unmaintained, Ruby versions
|
84
|
+
i.e. unmaintained, Ruby versions.
|
99
85
|
email:
|
100
86
|
- matheusrichardt@gmail.com
|
101
87
|
executables:
|
@@ -115,6 +101,7 @@ files:
|
|
115
101
|
- Rakefile
|
116
102
|
- bin/console
|
117
103
|
- bin/setup
|
104
|
+
- demo.gif
|
118
105
|
- end_of_life.gemspec
|
119
106
|
- exe/end_of_life
|
120
107
|
- exe/eol
|
@@ -150,5 +137,5 @@ requirements: []
|
|
150
137
|
rubygems_version: 3.2.32
|
151
138
|
signing_key:
|
152
139
|
specification_version: 4
|
153
|
-
summary: Lists repositories using end-of-life Ruby versions
|
140
|
+
summary: Lists repositories using end-of-life Ruby versions.
|
154
141
|
test_files: []
|