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
|
# File 'lib/centerstage.rb', line 32
def setup(fork=URL)
if not valid_url?(fork)
puts "URL provided for fork of Centerstage, is invalid."
return
end
if File.directory?(CENTER_STAGE_DIR)
FileUtils.rm_rf CENTER_STAGE_DIR
end
FileUtils.mkdir_p(CENTER_STAGE_DIR)
zip_path = "#{CENTER_STAGE_DIR}/center-stage.zip"
open zip_path, 'wb' do |file|
file << open(fork).read
end
Zip::File.open zip_path do |zip_file|
zip_file.each do |entry|
path_array = entry.name.split("/").drop(1)
path = "#{CENTER_STAGE_DIR}/#{path_array.join("/")}"
entry. path
end
end
File.delete zip_path
puts "Setup complete"
end
|