-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moving Version::Checker class into it's own file. Less intrusive
- Loading branch information
Matt Bridges
committed
Aug 13, 2012
1 parent
dba7e63
commit d14b333
Showing
3 changed files
with
31 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
module Dotify | ||
class Version | ||
# The Checkup class is responsible for | ||
# reaching out to Rubygems.org and retrieving | ||
# the latest gem version. | ||
class Checker | ||
|
||
class << self | ||
attr_reader :result, :resp | ||
end | ||
|
||
def self.check_latest_release! | ||
@result = latest == Version.build.level | ||
end | ||
|
||
def self.latest | ||
fetch.map { |v| v['number'] }.max | ||
end | ||
|
||
private | ||
|
||
def self.fetch | ||
require 'multi_json' | ||
@resp = Net::HTTP.get('rubygems.org', '/api/v1/versions/dotify.json') | ||
MultiJson.load(@resp) | ||
end | ||
|
||
end | ||
end | ||
end |