Class: Dev::EndOfLife
- Defined in:
- lib/firespring_dev_commands/eol.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: Config, ProductVersion
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.
-
#initialize(product_versions: self.class.config.product_versions) ⇒ EndOfLife
constructor
A new instance of EndOfLife.
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
51 52 53 54 55 56 |
# File 'lib/firespring_dev_commands/eol.rb', line 51 def check puts product_versions.sort_by(&:name).each(&:print_status) puts raise 'found EOL versions' if product_versions.any?(&:eol) end |