end_of_life 0.4.0 → 0.4.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 613932e8ff35287b6f1cfd47f892ec07842432a48a86de9586daafe7c7fe2e4a
4
- data.tar.gz: a8d47ebdc3838394b2dae1c86b39f02e0eb59c727fd878e956d849873ff7f1f0
3
+ metadata.gz: b8e0689d1cdf6da1fa737f8d699a060a8544184dfb345d6af4093e6e5e000c13
4
+ data.tar.gz: 608169452246f72b9351b07ae4f243d4ce74c3416c451a5fdf600b97dbc3f529
5
5
  SHA512:
6
- metadata.gz: 3919afb9fce45df1d650605e05cd401fd1281f7d17bf4df56e8bc33245df04e70184ed834ba7f09d25cb88f3b6c62448170dfd40d9b38cb3e09b048417aecc4f
7
- data.tar.gz: 792c5b7483671ea6b0a952ad3736c52046c95bf8b8d030082ff5270a0c0bf9a3af0f6937b02f015c63c32881bd8a9b8d4e0fe97e3ee29d8868299344cd3f7d99
6
+ metadata.gz: 57c0401637ca7d60d59d27ab35f4bee948f09bf188df6189a41be14ceb906c50ee77059a550076122f14a3b118c9e6fdd2f10dd520d19b562670c8fe229cf5df
7
+ data.tar.gz: 8cf1db7f6007559d3066696e1f3820fdaae1b055654456d47d48d67b6828530315992aae95ac9ea2ecf3927b3a39b80f84df7a762d24cc6c4f073bc2956d648e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.4.1] - 2025-05-23
4
+
5
+ - [BUGFIX] Handle empty/invalid version files
6
+ - if a file like `.ruby-version` was empty, we would parse it it's version as
7
+ `0` which would take precedence over any other file when comparing versions.
8
+ - We now ignore those files and any file which version parses to `0`.
9
+
3
10
  ## [0.4.0] - 2025-05-23
4
11
 
5
12
  - Skip archived repos (by default)
@@ -154,7 +161,9 @@ $ end_of_life --user=matz # searches on matz's repositories
154
161
 
155
162
  - Initial release
156
163
 
157
- [unreleased]: https://github.com/MatheusRich/end_of_life/compare/v0.3.0...HEAD
164
+ [unreleased]: https://github.com/MatheusRich/end_of_life/compare/v0.4.1...HEAD
165
+ [0.4.1]: https://github.com/MatheusRich/end_of_life/releases/tag/v0.4.1
166
+ [0.4.0]: https://github.com/MatheusRich/end_of_life/releases/tag/v0.4.0
158
167
  [0.3.0]: https://github.com/MatheusRich/end_of_life/releases/tag/v0.3.0
159
168
  [0.2.0]: https://github.com/MatheusRich/end_of_life/releases/tag/v0.2.0
160
169
  [0.1.0]: https://github.com/MatheusRich/end_of_life/releases/tag/v0.1.0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- end_of_life (0.4.0)
4
+ end_of_life (0.4.1)
5
5
  async
6
6
  dry-monads (~> 1.3)
7
7
  octokit (~> 9.0)
data/README.md CHANGED
@@ -41,9 +41,9 @@ There are some options to help you filter down the results:
41
41
  ```
42
42
  Usage: end_of_life [options]
43
43
  --exclude=NAME,NAME2 Exclude repositories containing a certain word in its name. You can specify up to five words.
44
- --public-only Searches only public repostories
45
- --private-only Searches only private repostories
46
- --repo, --repository=USER/REPO Searches a specific repostory
44
+ --public-only Searches only public repositories
45
+ --private-only Searches only private repositories
46
+ --repo, --repository=USER/REPO Searches a specific repository
47
47
  --org, --organization=ORG,ORG2 Searches within specific organizations
48
48
  -u, --user=NAME Sets the user used on the repository search
49
49
  --max-eol-days-away NUMBER Sets the maximum number of days away a version can be from EOL. It defaults to 0.
@@ -62,7 +62,8 @@ module EndOfLife
62
62
  return
63
63
  end
64
64
 
65
- puts "Found #{repositories.size} repositories using EOL Ruby (<= #{RubyVersion.latest_eol(at: max_eol_date)}):"
65
+ word = (repositories.size == 1) ? "repository" : "repositories"
66
+ puts "Found #{repositories.size} #{word} using EOL Ruby (<= #{RubyVersion.latest_eol(at: max_eol_date)}):"
66
67
  puts end_of_life_table(repositories)
67
68
  exit(-1)
68
69
  end
@@ -14,15 +14,15 @@ module EndOfLife
14
14
  options[:excludes] = excludes.first(5)
15
15
  end
16
16
 
17
- opts.on("--public-only", "Searches only public repostories") do
17
+ opts.on("--public-only", "Searches only public repositories") do
18
18
  options[:visibility] = :public
19
19
  end
20
20
 
21
- opts.on("--private-only", "Searches only private repostories") do
21
+ opts.on("--private-only", "Searches only private repositories") do
22
22
  options[:visibility] = :private
23
23
  end
24
24
 
25
- opts.on("--repo=USER/REPO", "--repository=USER/REPO", "Searches a specific repostory") do |repository|
25
+ opts.on("--repo=USER/REPO", "--repository=USER/REPO", "Searches a specific repository") do |repository|
26
26
  options[:repository] = repository
27
27
  end
28
28
 
@@ -7,7 +7,9 @@ module EndOfLife
7
7
  extend self
8
8
 
9
9
  def parse_file(file_name:, content:)
10
- if file_name == ".ruby-version"
10
+ return if content.strip.empty?
11
+
12
+ version = if file_name == ".ruby-version"
11
13
  parse_ruby_version_file(content)
12
14
  elsif file_name == "Gemfile.lock"
13
15
  parse_gemfile_lock_file(content)
@@ -18,6 +20,14 @@ module EndOfLife
18
20
  else
19
21
  raise ArgumentError, "Unsupported file #{file_name}"
20
22
  end
23
+
24
+ # Gem::Version is pretty forgiving and will accept empty strings
25
+ # as valid versions. This is a catch-all to ensure we don't return
26
+ # a version 0, which always takes precedence over any other version
27
+ # when comparing.
28
+ return if version&.zero?
29
+
30
+ version
21
31
  end
22
32
 
23
33
  private
@@ -38,11 +48,9 @@ module EndOfLife
38
48
  end
39
49
 
40
50
  def parse_gemfile_file(file_content)
41
- return if file_content.empty?
42
-
43
51
  with_temp_gemfile(file_content) do |temp_gemfile|
44
52
  gemfile_version = temp_gemfile.ruby_version&.gem_version
45
- return nil if gemfile_version.nil?
53
+ return if gemfile_version.nil?
46
54
 
47
55
  RubyVersion.new(gemfile_version)
48
56
  end
@@ -6,6 +6,8 @@ module EndOfLife
6
6
  class RubyVersion
7
7
  include Comparable
8
8
 
9
+ ZERO = Gem::Version.new("0")
10
+
9
11
  class << self
10
12
  include Dry::Monads[:try]
11
13
 
@@ -58,6 +60,8 @@ module EndOfLife
58
60
  @version <=> other.version
59
61
  end
60
62
 
63
+ def zero? = @version == ZERO
64
+
61
65
  def to_s
62
66
  @version.to_s
63
67
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EndOfLife
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: end_of_life
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matheus Richard
@@ -104,7 +104,6 @@ extensions: []
104
104
  extra_rdoc_files: []
105
105
  files:
106
106
  - ".rspec"
107
- - ".standard.yml"
108
107
  - ".tool-versions"
109
108
  - CHANGELOG.md
110
109
  - Gemfile
data/.standard.yml DELETED
@@ -1 +0,0 @@
1
- ruby_version: 2.7.1