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
|
# File 'lib/entityjs/commands/min.rb', line 5
def self.generate(args=nil)
if !Dirc.game?
return 2
end
Config.instance.reload
if !File.directory?(Config.instance.build_path)
Dir.mkdir(Config.instance.build_path)
end
final_name = Config.instance.build_name+'.js'
path = Config.instance.build_path+'/'+final_name
puts "Compiling code"
out = Build.compile_game
puts "Minifying"
out = Build.minify(out)
puts "Writing to #{path}"
File.open(path, 'w') do |f|
f.write(out)
end
puts "Done"
return 0
end
|