浏览代码

Add 'docs:upload' command

Thibaut Courouble 10 年之前
父节点
当前提交
1f9ef63e9c
共有 1 个文件被更改,包括 13 次插入0 次删除
  1. 13 0
      lib/tasks/docs.thor

+ 13 - 0
lib/tasks/docs.thor

@@ -134,6 +134,19 @@ class DocsCLI < Thor
     puts 'Done'
   end
 
+  desc 'upload', '[private]'
+  option :dryrun, type: :boolean
+  def upload(*names)
+    docs = find_docs(names)
+    assert_docs(docs)
+    docs.each do |doc|
+      puts "Syncing #{doc.path}..."
+      cmd = "aws s3 sync #{File.join(Docs.store_path, doc.path)} s3://docs.devdocs.io/#{doc.path} --delete"
+      cmd << ' --dryrun' if options[:dryrun]
+      system(cmd)
+    end
+  end
+
   private
 
   def find_docs(names)