Sha256: 2c11c904897a9a9240e2778ef386a9293cb60f0f2fc16572729abd8c6d8e9478
Contents?: true
Size: 1 KB
Versions: 2
Compression:
Stored size: 1 KB
Contents
module Bundleup GemStatus = Struct.new(:name, :old_version, :new_version, :newest_version, :pin) do def pinned? !pin.nil? end def upgraded? new_version != old_version end def added? old_version.nil? end def removed? new_version.nil? end def color if major_upgrade? || removed? :red elsif minor_upgrade? :yellow elsif added? :blue else :plain end end def major_upgrade? return false if new_version.nil? || old_version.nil? major(new_version) != major(old_version) end def minor_upgrade? return false if new_version.nil? || old_version.nil? !major_upgrade? && minor(new_version) != minor(old_version) end private def major(version) version.split(".", 2)[0] end def minor(version) version.split(".", 3)[1] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bundleup-0.5.0 | lib/bundleup/gem_status.rb |
bundleup-0.4.0 | lib/bundleup/gem_status.rb |