Explorar o código

Ensure documentation files are present before uploading in thor docs:upload command

Thibaut Courouble %!s(int64=7) %!d(string=hai) anos
pai
achega
436a98a5c8
Modificáronse 1 ficheiros con 13 adicións e 0 borrados
  1. 13 0
      lib/tasks/docs.thor

+ 13 - 0
lib/tasks/docs.thor

@@ -174,6 +174,19 @@ class DocsCLI < Thor
 
     assert_docs(docs)
 
+    # Verify files are present
+    docs.each do |doc|
+      unless Dir.exists?(File.join(Docs.store_path, doc.path))
+        puts "ERROR: directory #{File.join(Docs.store_path, doc.path)} not found."
+        return
+      end
+
+      unless File.exists?(File.join(Docs.store_path, "#{doc.path}.tar.gz"))
+        puts "ERROR: package for '#{doc.slug}' documentation not found. Run 'thor docs:package #{doc.slug}' to create it."
+        return
+      end
+    end
+
     # Sync files with S3 (used by the web app)
     puts '[S3] Begin syncing.'
     docs.each do |doc|