Class: Dev::EndOfLife
- Defined in:
- lib/firespring_dev_commands/eol.rb,
lib/firespring_dev_commands/eol/aws.rb,
lib/firespring_dev_commands/eol/php.rb,
lib/firespring_dev_commands/eol/node.rb,
lib/firespring_dev_commands/eol/ruby.rb,
lib/firespring_dev_commands/eol/product_version.rb
Overview
Class that contains methods for checking product versions of all tracked projects
Defined Under Namespace
Classes: Aws, Config, Node, Php, ProductVersion, Ruby
Constant Summary collapse
- END_OF_LIFE_API_URL =
The URL of the end of life project api
'https://endoflife.date/api'.freeze
Instance Attribute Summary collapse
-
#product_versions ⇒ Object
Returns the value of attribute product_versions.
-
#products ⇒ Object
Returns all products supported by the EOL api.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
-
.config {|@config| ... } ⇒ Object
(also: configure)
Instantiates a new top level config object if one hasn’t already been created Yields that config object to any given block Returns the resulting config object.
Instance Method Summary collapse
-
#check ⇒ Object
Prints all of the product version statuses Raises an error if any products are EOL.
-
#eol? ⇒ Boolean
Returns true if any of the products are EOL.
-
#initialize(product_versions: self.class.config.product_versions) ⇒ EndOfLife
constructor
A new instance of EndOfLife.
-
#product?(product) ⇒ Boolean
Returns true if the given product is supported either in the endoflife api products or a manual product.
-
#status ⇒ Object
Prints all of the product version statuses.
Constructor Details
#initialize(product_versions: self.class.config.product_versions) ⇒ EndOfLife
Returns a new instance of EndOfLife.
31 32 33 34 |
# File 'lib/firespring_dev_commands/eol.rb', line 31 def initialize(product_versions: self.class.config.product_versions) @product_versions = Array(product_versions) raise 'product version must be of type Dev::EndOfLife::ProductVersions' unless @product_versions.all?(Dev::EndOfLife::ProductVersion) end |
Instance Attribute Details
#product_versions ⇒ Object
Returns the value of attribute product_versions.
29 30 31 |
# File 'lib/firespring_dev_commands/eol.rb', line 29 def product_versions @product_versions end |
#products ⇒ Object
Returns all products supported by the EOL api
37 38 39 |
# File 'lib/firespring_dev_commands/eol.rb', line 37 def products @products end |
#url ⇒ Object
Returns the value of attribute url.
29 30 31 |
# File 'lib/firespring_dev_commands/eol.rb', line 29 def url @url end |
Class Method Details
.config {|@config| ... } ⇒ Object Also known as: configure
Instantiates a new top level config object if one hasn’t already been created Yields that config object to any given block Returns the resulting config object
19 20 21 22 23 |
# File 'lib/firespring_dev_commands/eol.rb', line 19 def config @config ||= Config.new yield(@config) if block_given? @config end |
Instance Method Details
#check ⇒ Object
Prints all of the product version statuses Raises an error if any products are EOL
71 72 73 74 75 76 |
# File 'lib/firespring_dev_commands/eol.rb', line 71 def check puts status puts raise 'found EOL versions' if eol? end |
#eol? ⇒ Boolean
Returns true if any of the products are EOL
65 66 67 |
# File 'lib/firespring_dev_commands/eol.rb', line 65 def eol? product_versions.any?(&:eol) end |
#product?(product) ⇒ Boolean
Returns true if the given product is supported either in the endoflife api products or a manual product
50 51 52 |
# File 'lib/firespring_dev_commands/eol.rb', line 50 def product?(product) products.include?(product) || self.class.config.manual_dates.any? { |key, _| key.to_s.start_with?("#{product}_") } end |
#status ⇒ Object
Prints all of the product version statuses
55 56 57 58 59 60 61 62 |
# File 'lib/firespring_dev_commands/eol.rb', line 55 def status if product_versions.empty? puts ' no tracked products' return end product_versions.sort_by(&:name).each(&:print_status) end |