Class: Deproll::ProjectGem
Instance Attribute Summary collapse
-
#gemspec ⇒ Object
readonly
Returns the value of attribute gemspec.
Instance Method Summary collapse
-
#initialize(gemspec) ⇒ ProjectGem
constructor
A new instance of ProjectGem.
- #lib ⇒ Object
- #name ⇒ Object
- #requirement ⇒ Object
- #source ⇒ Object
- #to_hash ⇒ Object
- #to_s ⇒ Object
- #updateable? ⇒ Boolean
- #version ⇒ Object
Methods included from Helper
Constructor Details
#initialize(gemspec) ⇒ ProjectGem
Returns a new instance of ProjectGem.
79 80 81 |
# File 'lib/deproll.rb', line 79 def initialize(gemspec) @gemspec = gemspec end |
Instance Attribute Details
#gemspec ⇒ Object (readonly)
Returns the value of attribute gemspec.
77 78 79 |
# File 'lib/deproll.rb', line 77 def gemspec @gemspec end |
Instance Method Details
#lib ⇒ Object
104 105 106 |
# File 'lib/deproll.rb', line 104 def lib gemspec.lib end |
#name ⇒ Object
96 97 98 |
# File 'lib/deproll.rb', line 96 def name gemspec.name end |
#requirement ⇒ Object
92 93 94 |
# File 'lib/deproll.rb', line 92 def requirement gemspec.requirement end |
#source ⇒ Object
100 101 102 |
# File 'lib/deproll.rb', line 100 def source gemspec.source || Gem.sources.first end |
#to_hash ⇒ Object
83 84 85 86 87 88 89 90 |
# File 'lib/deproll.rb', line 83 def to_hash { :name => name.to_s, :current_version => version.to_s, :available_version => latest_version.to_s, :source => source.to_s, :lib => lib.to_s, :requirement => requirement.to_s } end |
#to_s ⇒ Object
113 114 115 116 117 118 119 120 |
# File 'lib/deproll.rb', line 113 def to_s case when vendored? then "#{name} is #{version} (vendored), can be updated to #{latest_version} from #{source}" when installed? then "#{name} is #{version} (installed), can be updated to #{latest_version} from #{source}" else "#{name} is not yet installed. Version #{latest_version} is available on #{source}" end end |
#updateable? ⇒ Boolean
108 109 110 111 |
# File 'lib/deproll.rb', line 108 def updateable? return false if available_versions.empty? latest_version > version end |
#version ⇒ Object
122 123 124 125 126 127 128 129 |
# File 'lib/deproll.rb', line 122 def version case when vendored? then vendored_version when installed? then installed_version else '0' end end |