Class: Dev::EndOfLife::Ruby
- Defined in:
- lib/firespring_dev_commands/eol/ruby.rb
Overview
Class which checks for eol packges referenced by the ruby package manager
Instance Attribute Summary collapse
-
#lockfile ⇒ Object
readonly
Returns the value of attribute lockfile.
-
#ruby ⇒ Object
readonly
Returns the value of attribute ruby.
Instance Method Summary collapse
-
#default_products ⇒ Object
Default to Rubygems products.
-
#initialize(ruby = Dev::Ruby.new) ⇒ Ruby
constructor
A new instance of Ruby.
-
#rubygems_products ⇒ Object
1.) Parse the rubygems lock file 2.) Do some package name and version manipulation 3.) Return the product if it looks like something that the EOL library tracks.
Constructor Details
Instance Attribute Details
#lockfile ⇒ Object (readonly)
Returns the value of attribute lockfile.
5 6 7 |
# File 'lib/firespring_dev_commands/eol/ruby.rb', line 5 def lockfile @lockfile end |
#ruby ⇒ Object (readonly)
Returns the value of attribute ruby.
5 6 7 |
# File 'lib/firespring_dev_commands/eol/ruby.rb', line 5 def ruby @ruby end |
Instance Method Details
#default_products ⇒ Object
Default to Rubygems products
13 14 15 |
# File 'lib/firespring_dev_commands/eol/ruby.rb', line 13 def default_products rubygems_products end |
#rubygems_products ⇒ Object
1.) Parse the rubygems lock file 2.) Do some package name and version manipulation 3.) Return the product if it looks like something that the EOL library tracks
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/firespring_dev_commands/eol/ruby.rb', line 20 def rubygems_products eol = Dev::EndOfLife.new major_version_only_products = [] [].tap do |ary| packages = Bundler::LockfileParser.new(Bundler.read_file(lockfile)).specs packages.each do |package| name = package.name product = name # Make sure what we found is supported by the EOL library next unless eol.product?(product) version = package.version.to_s.reverse.split('.')[-2..].join('.').reverse.tr('v', '') version = version.split('.').first if major_version_only_products.include?(product) version.chop! if version.end_with?('.00') ary << Dev::EndOfLife::ProductVersion.new(product, version, name) end end end |