25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/adaptrex/deletetool.rb', line 25
def promptForDeletion
@appInfoList = []
@appPages = @appConfig.pages
if @appPages.length < 1
puts "There are no pages to delete.".warn
return
end
puts "Page List".blue
index = 0
@appPages.sort.map.each {|appPath,appValue|
appName = appValue.split(",")[0]
@appInfoList.push({
"name" => appName,
"path" => appPath,
"text" => appName + " (" + appPath + ")"
})
i = index + 1
if i < 10 then pad = " " else pad = "" end
puts " [" + pad + i.to_s + "] " + appName + " (" + appPath + ")"
index += 1
}
puts ""
appToDelete = promptForApplication
puts(("Are you sure you want to delete " + appToDelete["text"] + ")?").warn)
print "Type 'DELETE' to confirm: ".indent
confirm = STDIN.gets.chomp
if confirm == "DELETE"
FileUtils.rm_rf(appToDelete["path"])
@appConfig.pages.delete(appToDelete["path"])
@appConfig.write
puts((appToDelete["text"] + " has been deleted\n\n").success)
else
puts "Your app (page) was not deleted".warn
end
print "Do you want to delete another page? [n]: "
doAnother = STDIN.gets.chomp.downcase
if (doAnother == "y" or doAnother == "yes")
puts ""
return promptForDeletion
end
end
|