Class: Dev::EndOfLife::Ruby
- Defined in:
- lib/firespring_dev_commands/eol/ruby.rb
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
- #composer_products ⇒ Object
- #default_products ⇒ Object
-
#initialize(ruby = Dev::Ruby.new) ⇒ Ruby
constructor
A new instance of Ruby.
Constructor Details
#initialize(ruby = Dev::Ruby.new) ⇒ Ruby
Returns a new instance of Ruby.
6 7 8 9 |
# File 'lib/firespring_dev_commands/eol/ruby.rb', line 6 def initialize(ruby = Dev::Ruby.new) @ruby = ruby @lockfile = File.join(ruby.local_path, "#{ruby.package_file.reverse.split('.')[-1].reverse}.lock") end |
Instance Attribute Details
#lockfile ⇒ Object (readonly)
Returns the value of attribute lockfile.
4 5 6 |
# File 'lib/firespring_dev_commands/eol/ruby.rb', line 4 def lockfile @lockfile end |
#ruby ⇒ Object (readonly)
Returns the value of attribute ruby.
4 5 6 |
# File 'lib/firespring_dev_commands/eol/ruby.rb', line 4 def ruby @ruby end |
Instance Method Details
#composer_products ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/firespring_dev_commands/eol/ruby.rb', line 15 def composer_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 |
#default_products ⇒ Object
11 12 13 |
# File 'lib/firespring_dev_commands/eol/ruby.rb', line 11 def default_products composer_products end |