Module: Rbcli::Autoupdate::Common
- Included in:
- GemUpdater, GithubUpdater
- Defined in:
- lib/rbcli/autoupdate/autoupdate.rb
Instance Method Summary collapse
- #get_latest_version ⇒ Object
- #show_message ⇒ Object
- #update_available? ⇒ Boolean
- #update_message ⇒ Object
Instance Method Details
#get_latest_version ⇒ Object
20 21 22 |
# File 'lib/rbcli/autoupdate/autoupdate.rb', line 20 def get_latest_version raise Exception.new "Autoupdater type #{self.class.name} must define a 'check_for_updates' method." end |
#show_message ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/rbcli/autoupdate/autoupdate.rb', line 33 def puts "WARNING: An update is available to #{Rbcli::Configurate::configuration[:scriptname]}. You are currently running version #{Rbcli.configuration[:version]}; the latest is #{@latest_version || get_latest_version}." puts puts "\n" if @force_update puts "This application requires that you update to the latest version to continue using it. It will now exit." exit 0 end end |
#update_available? ⇒ Boolean
28 29 30 31 |
# File 'lib/rbcli/autoupdate/autoupdate.rb', line 28 def update_available? @latest_version = get_latest_version Gem::Version.new(@latest_version) > Gem::Version.new(Rbcli.configuration[:version]) end |
#update_message ⇒ Object
24 25 26 |
# File 'lib/rbcli/autoupdate/autoupdate.rb', line 24 def raise Exception.new "Autoupdater type #{self.class.name} must define an 'update_message' method." end |