Class: Dev::EndOfLife

Inherits:
Object show all
Defined in:
lib/firespring_dev_commands/eol.rb,
lib/firespring_dev_commands/eol/aws.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, 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

Class Method Summary collapse

Instance Method Summary collapse

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_versionsObject

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

#productsObject

Returns all products supported by the EOL api



37
38
39
# File 'lib/firespring_dev_commands/eol.rb', line 37

def products
  @products
end

#urlObject

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

Yields:



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

#checkObject

Prints all of the product version statuses Raises an error if any products are EOL



61
62
63
64
65
66
# File 'lib/firespring_dev_commands/eol.rb', line 61

def check
  puts
  status
  puts
  raise 'found EOL versions' if eol?
end

#eol?Boolean

Returns true if any of the products are EOL

Returns:

  • (Boolean)


55
56
57
# File 'lib/firespring_dev_commands/eol.rb', line 55

def eol?
  product_versions.any?(&:eol)
end

#statusObject

Prints all of the product version statuses



50
51
52
# File 'lib/firespring_dev_commands/eol.rb', line 50

def status
  product_versions.sort_by(&:name).each(&:print_status)
end