-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate.rb
47 lines (47 loc) · 1.4 KB
/
update.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 'git'
require 'fileutils'
puts "Removing old apps..."
FileUtils.rm_rf("HTMLoader-apps")
FileUtils.rm_rf("apps")
puts "Downloading main repo..."
Git.clone("https://github.com/Daniel-Bradbury/HTMLoader-apps.git","HTMLoader-apps")
Dir.chdir "HTMLoader-apps"
urlsf=File.open('appurls.txt')
urls=urlsf.read
urlsf.close()
puts "Downloading apps..."
urls.each_line do |line|
puts " Downloading "+line.chomp+"..."
Git.clone(line.chomp,File.basename(line.chomp,".git"))
end
puts "Renaming folders..."
namesf=File.open('appnames.txt')
names=namesf.read
namesf.close()
names.gsub!(/\r\n?/, "\n")
names.each_line do |line|
File.rename(line.chomp.split("|")[0], line.chomp.split("|")[1])
end
puts "Setting icons..."
apps = Dir.glob('*').select {|f| File.directory? f}
apps.each do |app|
if File.file?("_icon/"+app.chomp+".ico")
FileUtils.mv("_icon/"+app.chomp+".ico", app.chomp+"/favicon.ico")
puts " "+app.chomp+".ico found."
end
if File.file?("_icon/"+app.chomp+".png")
FileUtils.mv("_icon/"+app.chomp+".png", app.chomp+"/icon.png")
puts " "+app.chomp+".png found."
end
end
puts "Preparing patch..."
File.delete("appurls.txt")
File.delete("appnames.txt")
FileUtils.rm_rf("_icon")
Dir.chdir "../"
FileUtils.mv("HTMLoader-apps", "apps")
FileUtils.rm_rf("apps/.git")
system("ruby module/patch.rb")
puts "Finishing..."
FileUtils.rm_rf("apps")
File.rename("patched", "apps")