Class: Admincredible::Resources::Upgrade
Instance Attribute Summary
#client
Instance Method Summary
collapse
#config, #connection, #initialize
Instance Method Details
#cleanup ⇒ Object
40
41
42
|
# File 'lib/admincredible/resources/Upgrade.rb', line 40
def cleanup
client.jget('upgrade', 'cleanup')
end
|
#create ⇒ Object
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/admincredible/resources/Upgrade.rb', line 44
def create
response = download
return response unless response['status'] == 200
response = create_restoration_file
return response unless response['status'] == 200
response = start
return response unless response['status'] == 302
response = step
return response unless response['status'] == 200
response = finalize
return response unless response['status'] == 200
return cleanup
end
|
#create_restoration_file ⇒ Object
12
13
14
|
# File 'lib/admincredible/resources/Upgrade.rb', line 12
def create_restoration_file
client.jget('upgrade', 'create_restoration_file')
end
|
#download ⇒ Object
8
9
10
|
# File 'lib/admincredible/resources/Upgrade.rb', line 8
def download
client.jget('upgrade', 'download')
end
|
#finalize ⇒ Object
36
37
38
|
# File 'lib/admincredible/resources/Upgrade.rb', line 36
def finalize
client.jget('upgrade', 'finalize')
end
|
#info ⇒ Object
4
5
6
|
# File 'lib/admincredible/resources/Upgrade.rb', line 4
def info
client.jget('upgrade', 'info')['data']
end
|
#start ⇒ Object
16
17
18
|
# File 'lib/admincredible/resources/Upgrade.rb', line 16
def start
client.jget('upgrade', 'start')
end
|
#step(repeat_until_done = true) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/admincredible/resources/Upgrade.rb', line 20
def step(repeat_until_done=true)
response = client.jget('upgrade', 'step')
if response['status'] == 'working' && repeat_until_done
seconds_left = config.step_after_seconds
seconds_left.times do |i|
sleep 1
end
return step
end
response
end
|