-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcopy_assets.rb
69 lines (63 loc) · 2.41 KB
/
copy_assets.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
require 'ftools'
def syncDirs(sourceDirName, targetDirName)
Dir.foreach(sourceDirName) do |x|
sourcePathName = "#{sourceDirName}/#{x}";
targetPathName = "#{targetDirName}/#{x}";
if File.exists?(targetPathName)
if File.directory?(sourcePathName)
if x != "." && x != ".." && x != ".DS_Store" && x != ".git"
syncDirs(sourcePathName, targetPathName)
end
else
sourceTime = File.mtime(sourcePathName)
targetTime = File.mtime(targetPathName)
if sourceTime > targetTime
puts "#{sourcePathName} is newer: #{sourceTime} : #{targetTime} copying"
File.copy(sourcePathName, targetPathName)
end
end
else
if x != "400" && x != "300" && x != "50" && !( (sourceDirName =~ /planet_side$/) && (x =~ /[0-9].png$/) ) && x != "ui RyanKnope" && x != "ui" && x != "web ui" && x != ".git"
if File.directory?(sourcePathName)
puts "#{sourcePathName} is missing, making"
Dir.mkdir(targetPathName)
syncDirs(sourcePathName, targetPathName)
else
puts "#{sourcePathName} is missing, coping it over"
File.copy(sourcePathName, targetPathName)
end
end
end
end
end
def cleanDirs(toCleanDirName, masterDirName)
Dir.foreach(toCleanDirName) do |x|
toCleanPathName = "#{toCleanDirName}/#{x}";
masterPathName = "#{masterDirName}/#{x}";
if File.exists?(masterPathName)
if File.directory?(toCleanPathName)
if x != "." && x != ".." && x != ".DS_Store" && x != ".git"
cleanDirs(toCleanPathName, masterPathName)
end
end
else
if x != "resources.json" && x != ".DS_Store" && x != ".git"
if File.directory?(toCleanPathName)
puts "#{toCleanPathName} is missing from master"
#Dir.mkdir(masterPathName)
else
puts "#{toCleanPathName} is missing from master"
#File.copy(toCleanPathName, masterPathName)
end
end
end
end
end
def getNewResources()
exec "curl http://pt.lacunaexpanse.com/resources.json > UniversalClient/assets/resources.json"
end
# syncDirs("/users/rundeks/Dropbox/space game/iphone ui", "./UniversalClient/assets/iphone ui")
syncDirs("../Lacuna-Assets", "./UniversalClient/assets")
# cleanDirs("./UniversalClient/assets/iphone ui", "/users/rundeks/Dropbox/space game/iphone ui")
cleanDirs("./UniversalClient/assets", "../Lacuna-Assets")
getNewResources()