Class: GemsStatus::IsRubygems
- Inherits:
-
GemChecker
- Object
- GemChecker
- GemsStatus::IsRubygems
- Defined in:
- lib/gems-status/checkers/is_rubygems.rb
Instance Attribute Summary collapse
-
#gem_md5 ⇒ Object
readonly
Returns the value of attribute gem_md5.
-
#rubygems_md5 ⇒ Object
readonly
Returns the value of attribute rubygems_md5.
Instance Method Summary collapse
- #check?(gem) ⇒ Boolean
- #description ⇒ Object
-
#initialize(configuration) ⇒ IsRubygems
constructor
A new instance of IsRubygems.
Constructor Details
#initialize(configuration) ⇒ IsRubygems
Returns a new instance of IsRubygems.
11 12 13 14 15 |
# File 'lib/gems-status/checkers/is_rubygems.rb', line 11 def initialize(configuration) @rubygems_md5 = nil @gem_md5 = nil super configuration end |
Instance Attribute Details
#gem_md5 ⇒ Object (readonly)
Returns the value of attribute gem_md5.
9 10 11 |
# File 'lib/gems-status/checkers/is_rubygems.rb', line 9 def gem_md5 @gem_md5 end |
#rubygems_md5 ⇒ Object (readonly)
Returns the value of attribute rubygems_md5.
9 10 11 |
# File 'lib/gems-status/checkers/is_rubygems.rb', line 9 def rubygems_md5 @rubygems_md5 end |
Instance Method Details
#check?(gem) ⇒ Boolean
17 18 19 20 21 22 23 24 |
# File 'lib/gems-status/checkers/is_rubygems.rb', line 17 def check?(gem) Utils::log_debug("Looking for #{gem.name}") result = nil gem_uri = "http://rubygems.org/downloads/#{gem.name}-#{gem.version}.gem" @rubygems_md5 = Utils::download_md5(gem.name, gem.version, "http://rubygems.org/downloads") @gem_md5 = gem.md5 @rubygems_md5 && @gem_md5 && @gem_md5 == @rubygems_md5 end |
#description ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/gems-status/checkers/is_rubygems.rb', line 26 def description if !@rubygems_md5 "This gem does not exist in rubygems.org " elsif !@gem_md5 "This gem does not exist in your server" elsif @rubygems_md5 != @gem_md5 "This gem has a different md5sum than in rubygems.org\nrubygems: #{@rubygems_md5} your server #{@gem_md5}" end end |