eol_rb 0.4.0 → 0.6.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/README.md +26 -10
 - data/lib/eol_rb/client.rb +4 -2
 - data/lib/eol_rb/cycle.rb +3 -1
 - data/lib/eol_rb/models/cycle.rb +35 -0
 - data/lib/eol_rb/products.rb +1 -1
 - data/lib/eol_rb/version.rb +1 -1
 - data/lib/eol_rb.rb +3 -2
 - metadata +31 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 7d69c96762db4b69e4ae3b06009a2727dda41b3f2a8db4c60caa368e24ae93fd
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 868897d47432ecfc2393df155ce3e302dfb4438a0c5a58dea01f65c209b08c72
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 55c7de394f55a141f69ad781cbebfd696743e7e9ef9fe9c83bf3de403525bb285c8d7ae4fc6fddf96d880114f6db88f52d112fd5672950c008e587e4120ffcd5
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 7da113e2ba7c209ba6b340f8826dc9bdcaf71c67520b851484ba9950f323cae644ba87ab9d041d19fc81bb9a52547a7ebbb9ebd2a50624a09cd7843e9f20251d
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -26,25 +26,41 @@ end 
     | 
|
| 
       26 
26 
     | 
    
         
             
            EOL.products
         
     | 
| 
       27 
27 
     | 
    
         
             
            # => ["almalinux", "alpine", "amazon-eks", ...
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
            EOL. 
     | 
| 
      
 29 
     | 
    
         
            +
            EOL.info('ruby')
         
     | 
| 
       30 
30 
     | 
    
         
             
            # => 
         
     | 
| 
       31 
     | 
    
         
            -
            # [ 
     | 
| 
       32 
     | 
    
         
            -
            #   
     | 
| 
       33 
     | 
    
         
            -
            # 
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
            # 
     | 
| 
      
 31 
     | 
    
         
            +
            # [#<EOL::Models::Cycle:0x000000010403dd60             
         
     | 
| 
      
 32 
     | 
    
         
            +
            #  @eol=#<Date: 2026-03-31 ((2461131j,0s,0n),+0s,2299161j)>,
         
     | 
| 
      
 33 
     | 
    
         
            +
            #  @is_supported=true,                                
         
     | 
| 
      
 34 
     | 
    
         
            +
            #  @latest=Gem::Version.new("3.2.1"),                 
         
     | 
| 
      
 35 
     | 
    
         
            +
            #  @latest_release_date=#<Date: 2023-02-08 ((2459984j,0s,0n),+0s,2299161j)>,
         
     | 
| 
      
 36 
     | 
    
         
            +
            #  @lts=false,                                        
         
     | 
| 
      
 37 
     | 
    
         
            +
            #  @release_date=#<Date: 2022-12-25 ((2459939j,0s,0n),+0s,2299161j)>,
         
     | 
| 
      
 38 
     | 
    
         
            +
            #  @version=Gem::Version.new("3.2")>, 
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
            EOL.info('ruby', cycle: '3.1')
         
     | 
| 
      
 41 
     | 
    
         
            +
            # => 
         
     | 
| 
      
 42 
     | 
    
         
            +
            # #<EOL::Models::Cycle:0x0000000104044890
         
     | 
| 
      
 43 
     | 
    
         
            +
            #  @eol=#<Date: 2025-03-31 ((2460766j,0s,0n),+0s,2299161j)>,
         
     | 
| 
      
 44 
     | 
    
         
            +
            #  @is_supported=true,
         
     | 
| 
      
 45 
     | 
    
         
            +
            #  @latest=Gem::Version.new("3.1.3"),
         
     | 
| 
      
 46 
     | 
    
         
            +
            #  @latest_release_date=#<Date: 2022-11-24 ((2459908j,0s,0n),+0s,2299161j)>,
         
     | 
| 
      
 47 
     | 
    
         
            +
            #  @lts=false,
         
     | 
| 
      
 48 
     | 
    
         
            +
            #  @release_date=#<Date: 2021-12-25 ((2459574j,0s,0n),+0s,2299161j)>,
         
     | 
| 
      
 49 
     | 
    
         
            +
            #  @version=Gem::Version.new("3.1")>
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
            EOL.info('ruby', cycle: '2.6').supported?
         
     | 
| 
      
 52 
     | 
    
         
            +
            # => false
         
     | 
| 
       37 
53 
     | 
    
         
             
            ```
         
     | 
| 
       38 
54 
     | 
    
         | 
| 
       39 
55 
     | 
    
         
             
            ## Development
         
     | 
| 
       40 
56 
     | 
    
         | 
| 
       41 
     | 
    
         
            -
            After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
         
     | 
| 
      
 57 
     | 
    
         
            +
            After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
         
     | 
| 
       42 
58 
     | 
    
         | 
| 
       43 
59 
     | 
    
         
             
            To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
         
     | 
| 
       44 
60 
     | 
    
         | 
| 
       45 
61 
     | 
    
         
             
            ## Contributing
         
     | 
| 
       46 
62 
     | 
    
         | 
| 
       47 
     | 
    
         
            -
            Bug reports and pull requests are welcome on GitHub at https://github.com/ 
     | 
| 
      
 63 
     | 
    
         
            +
            Bug reports and pull requests are welcome on GitHub at [Coolomina/eol_rb](https://github.com/Coolomina/eol-rb/issues). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/Coolomina/eol_rb/blob/main/CODE_OF_CONDUCT.md).
         
     | 
| 
       48 
64 
     | 
    
         | 
| 
       49 
65 
     | 
    
         
             
            ## License
         
     | 
| 
       50 
66 
     | 
    
         | 
| 
         @@ -52,4 +68,4 @@ The gem is available as open source under the terms of the [MIT License](https:/ 
     | 
|
| 
       52 
68 
     | 
    
         | 
| 
       53 
69 
     | 
    
         
             
            ## Code of Conduct
         
     | 
| 
       54 
70 
     | 
    
         | 
| 
       55 
     | 
    
         
            -
            Everyone interacting in the EolRb project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/ 
     | 
| 
      
 71 
     | 
    
         
            +
            Everyone interacting in the EolRb project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/Coolomina/eol_rb/blob/main/CODE_OF_CONDUCT.md).
         
     | 
    
        data/lib/eol_rb/client.rb
    CHANGED
    
    | 
         @@ -7,8 +7,10 @@ require "json" 
     | 
|
| 
       7 
7 
     | 
    
         
             
            module EOL
         
     | 
| 
       8 
8 
     | 
    
         
             
              # HTTP client for endoflife.date API
         
     | 
| 
       9 
9 
     | 
    
         
             
              class Client
         
     | 
| 
       10 
     | 
    
         
            -
                 
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
      
 10 
     | 
    
         
            +
                attr_reader :http
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                def initialize(http = nil)
         
     | 
| 
      
 13 
     | 
    
         
            +
                  @http = http || Faraday.new(
         
     | 
| 
       12 
14 
     | 
    
         
             
                    url: "#{api.scheme}://#{api.host}",
         
     | 
| 
       13 
15 
     | 
    
         
             
                    headers: {
         
     | 
| 
       14 
16 
     | 
    
         
             
                      "Content-Type" => "application/json",
         
     | 
    
        data/lib/eol_rb/cycle.rb
    CHANGED
    
    | 
         @@ -21,7 +21,9 @@ module EOL 
     | 
|
| 
       21 
21 
     | 
    
         
             
                            "Cycle #{cycle} could not be found under product #{product}. Try any of #{available_cycles.inspect}"
         
     | 
| 
       22 
22 
     | 
    
         
             
                    end
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
                    JSON.parse(res.body)
         
     | 
| 
      
 24 
     | 
    
         
            +
                    specs = JSON.parse(res.body).merge({ "cycle" => cycle })
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                    Models::Cycle.new(specs)
         
     | 
| 
       25 
27 
     | 
    
         
             
                  end
         
     | 
| 
       26 
28 
     | 
    
         
             
                end
         
     | 
| 
       27 
29 
     | 
    
         
             
              end
         
     | 
| 
         @@ -0,0 +1,35 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module EOL
         
     | 
| 
      
 4 
     | 
    
         
            +
              module Models
         
     | 
| 
      
 5 
     | 
    
         
            +
                # EOL Cycle model https://endoflife.date/docs/api
         
     | 
| 
      
 6 
     | 
    
         
            +
                class Cycle
         
     | 
| 
      
 7 
     | 
    
         
            +
                  attr_reader :version, :eol, :latest, :latest_release_date, :release_date, :lts
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                  def initialize(specs)
         
     | 
| 
      
 10 
     | 
    
         
            +
                    @version = Gem::Version.new(specs.fetch("cycle"))
         
     | 
| 
      
 11 
     | 
    
         
            +
                    @eol = parse_eol(specs.fetch("eol"))
         
     | 
| 
      
 12 
     | 
    
         
            +
                    @latest = Gem::Version.new(specs.fetch("latest"))
         
     | 
| 
      
 13 
     | 
    
         
            +
                    @latest_release_date = Date.parse(specs.fetch("latestReleaseDate"))
         
     | 
| 
      
 14 
     | 
    
         
            +
                    @release_date = Date.parse(specs.fetch("releaseDate"))
         
     | 
| 
      
 15 
     | 
    
         
            +
                    @lts = specs.fetch("lts")
         
     | 
| 
      
 16 
     | 
    
         
            +
                  end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                  def supported?
         
     | 
| 
      
 19 
     | 
    
         
            +
                    return !eol if [true, false].include? eol
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                    @eol > Time.now.to_date
         
     | 
| 
      
 22 
     | 
    
         
            +
                  end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                  private
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                  def parse_eol(eol)
         
     | 
| 
      
 27 
     | 
    
         
            +
                    return false if eol.nil?
         
     | 
| 
      
 28 
     | 
    
         
            +
                    return eol if [true, false].include? eol
         
     | 
| 
      
 29 
     | 
    
         
            +
                    return Date.parse(eol) if eol.is_a? String
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                    nil
         
     | 
| 
      
 32 
     | 
    
         
            +
                  end
         
     | 
| 
      
 33 
     | 
    
         
            +
                end
         
     | 
| 
      
 34 
     | 
    
         
            +
              end
         
     | 
| 
      
 35 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/eol_rb/products.rb
    CHANGED
    
    
    
        data/lib/eol_rb/version.rb
    CHANGED
    
    
    
        data/lib/eol_rb.rb
    CHANGED
    
    | 
         @@ -4,13 +4,14 @@ require_relative "eol_rb/client" 
     | 
|
| 
       4 
4 
     | 
    
         
             
            require_relative "eol_rb/configuration"
         
     | 
| 
       5 
5 
     | 
    
         
             
            require_relative "eol_rb/products"
         
     | 
| 
       6 
6 
     | 
    
         
             
            require_relative "eol_rb/cycle"
         
     | 
| 
      
 7 
     | 
    
         
            +
            require_relative "eol_rb/models/cycle"
         
     | 
| 
       7 
8 
     | 
    
         | 
| 
       8 
9 
     | 
    
         
             
            # Root module for EndOfLife
         
     | 
| 
       9 
10 
     | 
    
         
             
            module EOL
         
     | 
| 
       10 
11 
     | 
    
         
             
              class << self
         
     | 
| 
       11 
12 
     | 
    
         
             
                extend Forwardable
         
     | 
| 
       12 
13 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
                def_delegators :new, : 
     | 
| 
      
 14 
     | 
    
         
            +
                def_delegators :new, :info, :products
         
     | 
| 
       14 
15 
     | 
    
         | 
| 
       15 
16 
     | 
    
         
             
                def new
         
     | 
| 
       16 
17 
     | 
    
         
             
                  Instance.new
         
     | 
| 
         @@ -35,7 +36,7 @@ module EOL 
     | 
|
| 
       35 
36 
     | 
    
         
             
                  Products.all(@client)
         
     | 
| 
       36 
37 
     | 
    
         
             
                end
         
     | 
| 
       37 
38 
     | 
    
         | 
| 
       38 
     | 
    
         
            -
                def  
     | 
| 
      
 39 
     | 
    
         
            +
                def info(product, cycle: "")
         
     | 
| 
       39 
40 
     | 
    
         
             
                  if cycle.empty?
         
     | 
| 
       40 
41 
     | 
    
         
             
                    Products.get(@client, product)
         
     | 
| 
       41 
42 
     | 
    
         
             
                  else
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: eol_rb
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.6.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Alejandro Colomina
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2023-05-17 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: faraday
         
     | 
| 
         @@ -66,6 +66,34 @@ dependencies: 
     | 
|
| 
       66 
66 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       67 
67 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       68 
68 
     | 
    
         
             
                    version: '1.39'
         
     | 
| 
      
 69 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 70 
     | 
    
         
            +
              name: rubocop-rake
         
     | 
| 
      
 71 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 72 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 73 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 74 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 75 
     | 
    
         
            +
                    version: 0.6.0
         
     | 
| 
      
 76 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 77 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 78 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 79 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 80 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 81 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 82 
     | 
    
         
            +
                    version: 0.6.0
         
     | 
| 
      
 83 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 84 
     | 
    
         
            +
              name: rubocop-rspec
         
     | 
| 
      
 85 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 86 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 87 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 88 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 89 
     | 
    
         
            +
                    version: '2.22'
         
     | 
| 
      
 90 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 91 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 92 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 93 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 94 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 95 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 96 
     | 
    
         
            +
                    version: '2.22'
         
     | 
| 
       69 
97 
     | 
    
         
             
            description: Ruby client for endoflife.date API
         
     | 
| 
       70 
98 
     | 
    
         
             
            email:
         
     | 
| 
       71 
99 
     | 
    
         
             
            - ale@coolomina.dev
         
     | 
| 
         @@ -80,6 +108,7 @@ files: 
     | 
|
| 
       80 
108 
     | 
    
         
             
            - lib/eol_rb/client.rb
         
     | 
| 
       81 
109 
     | 
    
         
             
            - lib/eol_rb/configuration.rb
         
     | 
| 
       82 
110 
     | 
    
         
             
            - lib/eol_rb/cycle.rb
         
     | 
| 
      
 111 
     | 
    
         
            +
            - lib/eol_rb/models/cycle.rb
         
     | 
| 
       83 
112 
     | 
    
         
             
            - lib/eol_rb/products.rb
         
     | 
| 
       84 
113 
     | 
    
         
             
            - lib/eol_rb/version.rb
         
     | 
| 
       85 
114 
     | 
    
         
             
            homepage: https://github.com/Coolomina/eol-rb
         
     |