mirror of
https://github.com/freeCodeCamp/devdocs
synced 2024-11-16 19:48:10 +01:00
feat: use the new buckets
The tarballs are currently getting put into /bundles, but maybe this isn't necessary
This commit is contained in:
parent
c6264eb1bf
commit
7713074c93
1 changed files with 12 additions and 16 deletions
|
@ -191,7 +191,7 @@ class DocsCLI < Thor
|
|||
puts '[S3] Begin syncing.'
|
||||
docs.each do |doc|
|
||||
puts "[S3] Syncing #{doc.path}..."
|
||||
cmd = "aws s3 sync #{File.join(Docs.store_path, doc.path)} s3://devdocs-assets/#{doc.path} --delete --profile devdocs"
|
||||
cmd = "aws s3 sync #{File.join(Docs.store_path, doc.path)} s3://devdocs-staging-documents/#{doc.path} --delete --profile devdocs"
|
||||
cmd << ' --dryrun' if options[:dryrun]
|
||||
system(cmd)
|
||||
end
|
||||
|
@ -199,20 +199,16 @@ class DocsCLI < Thor
|
|||
|
||||
# Upload packages to dl.devdocs.io (used by the "thor docs:download" command)
|
||||
# TODO(MIGRATION): replace this with an S3 bucket upload.
|
||||
puts '[MaxCDN] Begin uploading.'
|
||||
Net::SFTP.start('ftp.devdocs-dl.devdocs.netdna-cdn.com', ENV['DEVDOCS_DL_USERNAME'], password: ENV['DEVDOCS_DL_PASSWORD']) do |sftp|
|
||||
docs.each do |doc|
|
||||
filename = "#{doc.path}.tar.gz"
|
||||
print "[MaxCDN] Uploading #{filename}..."
|
||||
if options[:dryrun]
|
||||
print "\n"
|
||||
else
|
||||
sftp.upload! File.join(Docs.store_path, filename), File.join('', 'public_html', filename)
|
||||
print " OK\n"
|
||||
end
|
||||
end
|
||||
puts '[S3 bundle] Begin uploading.'
|
||||
|
||||
docs.each do |doc|
|
||||
filename = "#{doc.path}.tar.gz"
|
||||
print "[S3 bundle] Uploading #{filename}..."
|
||||
cmd = "aws s3 cp #{File.join(Docs.store_path, filename)} s3://devdocs-staging-downloads/bundles/#{filename} --profile devdocs"
|
||||
cmd << ' --dryrun' if options[:dryrun]
|
||||
system(cmd)
|
||||
end
|
||||
puts '[MaxCDN] Done uploading.'
|
||||
puts '[S3 bundle] Done uploading.'
|
||||
end
|
||||
|
||||
desc 'commit', '[private]'
|
||||
|
@ -245,7 +241,7 @@ class DocsCLI < Thor
|
|||
FileUtils.mkpath(dir)
|
||||
|
||||
['index.json', 'meta.json'].each do |filename|
|
||||
json = "https://docs.devdocs.io/#{doc.path}/#{filename}?#{time}"
|
||||
json = "https://documents.devdocs.in/#{doc.path}/#{filename}?#{time}"
|
||||
begin
|
||||
open(json) do |file|
|
||||
mutex.synchronize do
|
||||
|
@ -342,7 +338,7 @@ class DocsCLI < Thor
|
|||
|
||||
def download_doc(doc)
|
||||
target_path = File.join(Docs.store_path, doc.path)
|
||||
open "http://dl.devdocs.io/#{doc.path}.tar.gz" do |file|
|
||||
open "https://downloads.devdocs.in/bundles/#{doc.path}.tar.gz" do |file|
|
||||
FileUtils.mkpath(target_path)
|
||||
file.close
|
||||
tar = UnixUtils.gunzip(file.path)
|
||||
|
|
Loading…
Reference in a new issue