Module: Rbcli::Autoupdate::Common
- Included in:
- GemUpdater, GithubUpdater
- Defined in:
- lib/rbcli/features/autoupdate/common/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
27 28 29 |
# File 'lib/rbcli/features/autoupdate/common/autoupdate.rb', line 27 def get_latest_version raise Exception.new "Autoupdater type #{self.class.name} must define a 'check_for_updates' method." end |
#show_message ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/rbcli/features/autoupdate/common/autoupdate.rb', line 40 def puts "WARNING: An update is available to #{Rbcli.configuration(:me, :scriptname)}. You are currently running version #{Rbcli.configuration(:me, :version)}; the latest is #{@latest_version || get_latest_version}." puts @message || 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
35 36 37 38 |
# File 'lib/rbcli/features/autoupdate/common/autoupdate.rb', line 35 def update_available? @latest_version = get_latest_version Gem::Version.new(@latest_version) > Gem::Version.new(Rbcli.configuration(:me, :version)) end |
#update_message ⇒ Object
31 32 33 |
# File 'lib/rbcli/features/autoupdate/common/autoupdate.rb', line 31 def raise Exception.new "Autoupdater type #{self.class.name} must define an 'update_message' method." end |