-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunity
executable file
·101 lines (78 loc) · 1.78 KB
/
unity
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/usr/bin/env ruby
# A utility to help get information about Unity projects
# ---
require 'slop'
def write_file(filename, contents)
file = File.expand_path(filename)
if File.exists? file
puts "#{filename} already exists! Aborting..."
exit 1
end
File.open(file, "w+") { |f| f.write(contents) }
exit(0)
end
opts = Slop.parse do |o|
#
# Generate a .gitignore file
#
o.on '-gi', '--gen-gitignore', "Generate a .gitignore file in the current directory" do
write_file(".gitignore",
"/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/Assets/AssetStoreTools*
# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
# Unity3D generated meta files
*.pidb.meta
# Unity3D Generated File On Crash Reports
sysinfo.txt
# Builds
*.apk
*.unitypackage
iOS/
")
end
#
# Generate a .gitattributes file
#
o.on '-ga', '--gen-gitattributes', "Generate a .gitattributes file in the current directory" do
write_file(".gitattributes",
"*.unity text
*.prefab text
*.asset text
*.meta -diff")
end
#
# Get a project's Unity version
#
o.on '-v', '--version', "Print the version of the current Unity project" do
version_filename = "ProjectSettings/ProjectVersion.txt"
version_file = File.expand_path(version_filename)
unless File.exists? version_file
raise "#{version_filename} doesn't exist in this directory!"
exit 1
end
contents = File.read(version_file)
puts "Version: " + contents.split("\n").first.chomp.gsub("m_EditorVersion: ", "")
exit
end
o.on '-h', '--help' do
puts o
exit
end
end
puts opts