-
Notifications
You must be signed in to change notification settings - Fork 5
/
engine.rb
47 lines (38 loc) · 997 Bytes
/
engine.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
require 'json'
# A Engine is simply a name to allow engine operations
# All data is stored in the engine install
#
class Engine
UPDATE_VALID_PERIOD=7200
@@last_update_check=Time.at(0)
# Is the cache out of date?
def self._update_check_needed
(Time.now - @@last_update_check) > UPDATE_VALID_PERIOD
end
# Force check what updates are available
def self._check_for_updates
@@update_info = CCProcess.complete("sdk-manage --sdk --upgradable")
@@last_update_check = Time.now
rescue CCProcess::Failed
@@update_info=""
end
def self.update_info
if _update_check_needed then
_check_for_updates
end
return @@update_info
end
# Are any updates available
def self.update_available?
update_info != ""
end
def self.version
_ :version_not_available
end
def self.update
CCProcess.start("sdk-manage --sdk --upgrade", (_ :updating_engine) + " #{@name}", 60*15)
@@last_update_check=Time.at(0)
end
def self.load
end
end