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
|
# File 'lib/superbot/cloud/cli/test/download_command.rb', line 17
def download_test
puts "Downloading #{name}..."
test = Superbot::Cloud::Api.request(
:test_download,
params: {
name: name,
organization_name: organization
}
)
if Dir.exist?(test[:name])
puts "Directory #{test[:name]} already exists"
print "Override files? [Y/n] "
answer = $stdin.gets.rstrip
abort "Aborted." unless answer.downcase.start_with?('y') || answer.empty?
end
FileUtils.mkdir_p test[:name]
test[:files].each do |file|
File.write(File.join(test[:name], file[:filename]), file[:content])
print file[:filename], ' - ', 'Success'
puts
end
puts "Test files successfully downloaded to #{File.join(Dir.pwd, test[:name])}"
end
|