|
|
@ -244,12 +244,18 @@ class DocsCLI < Thor
|
|
|
|
FileUtils.mkpath(dir)
|
|
|
|
FileUtils.mkpath(dir)
|
|
|
|
|
|
|
|
|
|
|
|
['index.json', 'meta.json'].each do |filename|
|
|
|
|
['index.json', 'meta.json'].each do |filename|
|
|
|
|
open("https://docs.devdocs.io/#{doc.path}/#{filename}?#{time}") do |file|
|
|
|
|
json = "https://docs.devdocs.io/#{doc.path}/#{filename}?#{time}"
|
|
|
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
open(json) do |file|
|
|
|
|
mutex.synchronize do
|
|
|
|
mutex.synchronize do
|
|
|
|
path = File.join(dir, filename)
|
|
|
|
path = File.join(dir, filename)
|
|
|
|
File.write(path, file.read)
|
|
|
|
File.write(path, file.read)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
rescue => e
|
|
|
|
|
|
|
|
puts "Docs -- Failed to download #{json}!"
|
|
|
|
|
|
|
|
throw e
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
puts "Docs -- Downloaded #{doc.slug}"
|
|
|
|
puts "Docs -- Downloaded #{doc.slug}"
|
|
|
|