Module: Rbcli::Autoupdate::Common

Included in:
GemUpdater, GithubUpdater
Defined in:
lib/rbcli/autoupdate/autoupdate.rb

Instance Method Summary collapse

Instance Method Details

#get_latest_versionObject



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_messageObject



33
34
35
36
37
38
39
40
41
# File 'lib/rbcli/autoupdate/autoupdate.rb', line 33

def show_message
	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 update_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

Returns:

  • (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_messageObject



24
25
26
# File 'lib/rbcli/autoupdate/autoupdate.rb', line 24

def update_message
	raise Exception.new "Autoupdater type #{self.class.name} must define an 'update_message' method."
end